Bug 33887

Summary: [Qt] QGraphicsWebView shows combo box popups in the wrong position
Product: WebKit Reporter: Girish Ramakrishnan <girish>
Component: WebKit QtAssignee: Girish Ramakrishnan <girish>
Severity: Normal CC: commit-queue, hausmann, kenneth, luiz, zanga.mail
Priority: P2 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Bug Depends on: 33418    
Bug Blocks:    
Description Flags
Patch against 4.6.1
Patch against 4.6.1 (clean up PopupMenu::~PopupMenu)
Make the proxy widget a child of the QGraphicsWebView
Patch against webkit-trubk none

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;

    QGraphicsView *view = new QGraphicsView;

    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

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">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <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';

  <body onload="adjustPluginHeight();">
    <div id="toolbar">
          <td><button><div class="nowrap">Load plugin</div></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>
    <div id="plugin">
      No plugin loaded
    <div id="statusbar">

(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).