Bug 33887 - [Qt] QGraphicsWebView shows combo box popups in the wrong position
Summary: [Qt] QGraphicsWebView shows combo box popups in the wrong position
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Girish Ramakrishnan
URL:
Keywords: Qt
Depends on: 33418
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-20 01:39 PST by Girish Ramakrishnan
Modified: 2011-10-21 09:04 PDT (History)
5 users (show)

See Also:


Attachments
Patch against 4.6.1 (3.65 KB, patch)
2010-01-20 03:51 PST, Girish Ramakrishnan
no flags Details | Formatted Diff | Diff
Patch against 4.6.1 (clean up PopupMenu::~PopupMenu) (3.62 KB, patch)
2010-01-20 03:57 PST, Girish Ramakrishnan
no flags Details | Formatted Diff | Diff
Make the proxy widget a child of the QGraphicsWebView (1.32 KB, patch)
2010-01-22 04:21 PST, Girish Ramakrishnan
no flags Details | Formatted Diff | Diff
Patch against webkit-trubk (4.44 KB, patch)
2010-01-23 06:31 PST, Girish Ramakrishnan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Girish Ramakrishnan 2010-01-20 01:39:19 PST
The popup position is incorrect and works only when the QGraphicsWebView's coordinates matches exactly with the QGraphicsView coordinates. In addition, more complex cases like transformation of the QGraphicsWebView does not work.

Tested with Qt 4.6.1.
Comment 1 Girish Ramakrishnan 2010-01-20 01:41:15 PST
Test case:

#include <QtGui>
#include <QtWebKit>

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QGraphicsScene *scene = new QGraphicsScene;
    QGraphicsWebView *webView = new QGraphicsWebView;
    webView->load(QUrl("http://www.tizag.com/htmlT/htmlselect.php"));
    scene->addItem(webView);

    QGraphicsView *view = new QGraphicsView;
    view->setScene(scene);
    view->show();

    return app.exec();
}
Comment 2 Girish Ramakrishnan 2010-01-20 03:51:17 PST
Created attachment 47006 [details]
Patch against 4.6.1
Comment 3 Girish Ramakrishnan 2010-01-20 03:57:20 PST
Created attachment 47007 [details]
Patch against 4.6.1 (clean up PopupMenu::~PopupMenu)

Clean up as suggested by Simon.
Comment 4 Girish Ramakrishnan 2010-01-20 04:56:06 PST
Luiz Agostini is working on the same part of the code and my commit will probably break his ongoing work. So, I am waiting for him to finish his patch series, before I commit this one.

The patch attached will not apply against webkit-trunk, it's 4.6.x only.
Comment 5 Simon Hausmann 2010-01-21 05:46:24 PST
(In reply to comment #3)
> Created an attachment (id=47007) [details]
> Patch against 4.6.1 (clean up PopupMenu::~PopupMenu)
> 
> Clean up as suggested by Simon.

Cherry-picked into qtwebkit-4.6 as commit 8f5ca3ba5da63a47d4f90bbd867d3e8453443dd3
Comment 6 Girish Ramakrishnan 2010-01-22 04:21:09 PST
Created attachment 47188 [details]
Make the proxy widget a child of the QGraphicsWebView
Comment 7 Girish Ramakrishnan 2010-01-23 06:31:52 PST
Created attachment 47271 [details]
Patch against webkit-trubk

Note on the destructor part: In the case of QGraphicsWebView, the proxy is gets already deleted by the time it hits the QtFallbackPopup destructor. I am unable to create a debug build of Qt (it say out of memory!). But with qDebug() I have verified that there is no leak and m_proxy indeed gets deleted (I made it a QPointer and it printed out as 0 in the QtFallbackPopup destructor).

We probably need the above check for the patches against 4.6.1 too. (But from what I saw QtFallbackPopup destructor was _never_ called in the 4.6.x WebKit).
Comment 8 Kenneth Rohde Christiansen 2010-01-23 08:11:34 PST
Comment on attachment 47271 [details]
Patch against webkit-trubk

LGTM
Comment 9 WebKit Commit Bot 2010-01-23 08:37:49 PST
Comment on attachment 47271 [details]
Patch against webkit-trubk

Clearing flags on attachment: 47271

Committed r53769: <http://trac.webkit.org/changeset/53769>
Comment 10 WebKit Commit Bot 2010-01-23 08:37:55 PST
All reviewed patches have been landed.  Closing bug.
Comment 11 Simon Hausmann 2010-01-25 05:51:54 PST
(In reply to comment #6)
> Created an attachment (id=47188) [details]
> Make the proxy widget a child of the QGraphicsWebView

Cherry-picked into qtwebkit-4.6 with commit f2e94404e9b723442aa2d4eae5399014d763fb6d
Comment 12 Stefano D'Angelo 2011-10-21 09:04:16 PDT
This still happens to me from time to time with Qt 4.7.4 on ArchLinux 64 bit.

Offending page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>FreeADSP</title>
    <link rel="icon" href="icon.png" type="image/png" />
    <link rel="stylesheet" type="text/css" href="main.css" />
    <script type="text/javascript">

function adjustPluginHeight()
{
	var plugin = document.getElementById('plugin');
	var statusbar = document.getElementById('statusbar');

	plugin.style.marginBottom = (statusbar.offsetHeight + 2) + 'px';
}

    </script>
  </head>
  <body onload="adjustPluginHeight();">
    <div id="toolbar">
      <table>
	<tr>
          <td><button><div class="nowrap">Load plugin</div></button></td>
          <td><button>Mute</button></td>
          <td><button>Bypass</button></td>
          <td><div class="nowrap">Bank: <select><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option></select></div></td>
          <td><div class="nowrap">Program: <select><option>1</option><option>2</option><option>3</option></select></div></td>
        </tr>
      </table>
    </div>
    <div id="plugin">
      No plugin loaded
    </div>
    <div id="statusbar">
      status
    </div>
  </body>
</html>

(It happens also with no style sheet, just click several times on one of the two selects and from time to time the misplacement happens).