Bug 40017 - [Qt] DRT EventSender support to graphics mouse events activation
Summary: [Qt] DRT EventSender support to graphics mouse events activation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Diego Gonzalez
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 40014
  Show dependency treegraph
 
Reported: 2010-06-01 12:00 PDT by Diego Gonzalez
Modified: 2010-06-10 08:46 PDT (History)
5 users (show)

See Also:


Attachments
Patch (10.69 KB, patch)
2010-06-08 10:18 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.62 KB, patch)
2010-06-08 15:03 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.18 KB, patch)
2010-06-09 06:59 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.20 KB, patch)
2010-06-09 11:07 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.10 KB, patch)
2010-06-09 11:54 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.05 KB, patch)
2010-06-09 13:29 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff
Patch (9.03 KB, patch)
2010-06-09 13:51 PDT, Diego Gonzalez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Gonzalez 2010-06-01 12:00:10 PDT
Make Qt DRT send the correct QGraphicsSceneEvent's when it is
in QGraphicsWebView mode.
Comment 1 Diego Gonzalez 2010-06-08 10:18:39 PDT
Created attachment 58151 [details]
Patch
Comment 2 Antonio Gomes 2010-06-08 10:42:44 PDT
lgtm.

I'd rename hasGraphicsEvents , since it does not sound good to me. Maybe isGraphicsBasedView() ? or something ...

or even better, just remove it, since you do not need this method. Inside EventSender class you can know if it is GraphicsBased or not, by checking page->view() - as you did in EventSender::sendEvent
Comment 3 Diego Gonzalez 2010-06-08 12:29:00 PDT
(In reply to comment #2)
> lgtm.
> 
> I'd rename hasGraphicsEvents , since it does not sound good to me. Maybe isGraphicsBasedView() ? or something ...
> 
> or even better, just remove it, since you do not need this method. Inside EventSender class you can know if it is GraphicsBased or not, by checking page->view() - as you did in EventSender::sendEvent

Make sense Antonio.
Comment 4 Diego Gonzalez 2010-06-08 15:03:01 PDT
Created attachment 58189 [details]
Patch
Comment 5 Antonio Gomes 2010-06-08 16:08:35 PDT
comments:

(In reply to comment #4)
> Created an attachment (id=58189) [details]
> Patch

+        event->setModifiers(Qt::NoModifier);
+        sendOrQueueEvent(event);
+    } else {
+        QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier);
+        sendOrQueueEvent(event);

I'd put "endOrQueueEvent(event);" out of the if-else block, since it will be executed in both cases. It happens twice in the code.

if (WebCore::WebViewGraphicsBased* view ...

do you need the WebCore namespace?
Comment 6 Diego Gonzalez 2010-06-09 05:17:19 PDT
(In reply to comment #5)
> comments:
> 
> (In reply to comment #4)
> > Created an attachment (id=58189) [details] [details]
> > Patch
> 
> +        event->setModifiers(Qt::NoModifier);
> +        sendOrQueueEvent(event);
> +    } else {
> +        QMouseEvent* event = new QMouseEvent(QEvent::MouseButtonRelease, m_mousePos, m_mousePos, mouseButton, m_mouseButtons, Qt::NoModifier);
> +        sendOrQueueEvent(event);
> 
> I'd put "endOrQueueEvent(event);" out of the if-else block, since it will be executed in both cases. It happens twice in the code.
> 

The events types are different in this case, so more casts will
be necessary.

> if (WebCore::WebViewGraphicsBased* view ...
> 
> do you need the WebCore namespace?

Unfortunately the namespace is necessary :(. A little refactory i, DumpRenderTreeQt will be necessary to remove it,
Comment 7 Diego Gonzalez 2010-06-09 05:49:54 PDT
The results with this patch running in graphics view mode:

13767 test cases (99%) succeeded
19 test cases (<1%) had incorrect layout
49 test cases (<1%) were new
1 test case (<1%) crashed
5 test cases (<1%) had stderr output

Before this patch:

13502 test cases (97%) succeeded
270 test cases (1%) had incorrect layout
38 test cases (<1%) were new
2 test cases (<1%) crashed
162 test cases (1%) had stderr output

Results with normal mode (QWebView):

13778 test cases (99%) succeeded
9 test cases (<1%) had incorrect layout
49 test cases (<1%) were new
5 test cases (<1%) had stderr output
Comment 8 Kenneth Rohde Christiansen 2010-06-09 06:06:07 PDT
Comment on attachment 58189 [details]
Patch


> +    if (qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view()))
> +        m_graphicsBasedView = true;
> +    else
> +        m_graphicsBasedView = false;

Make a method for that

bool isGraphicsBased() { return qobject_cast<WebCore::WebViewGraphicsBased*>(m_page->view()); }
Comment 9 Diego Gonzalez 2010-06-09 06:59:44 PDT
Created attachment 58240 [details]
Patch

Make Kenneth's suggestion
Comment 10 Kenneth Rohde Christiansen 2010-06-09 07:04:26 PDT
Comment on attachment 58240 [details]
Patch

Wouldn't it be possible to make methods like QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(... ) etc.
Comment 11 Diego Gonzalez 2010-06-09 08:53:59 PDT
(In reply to comment #10)
> (From update of attachment 58240 [details])
> Wouldn't it be possible to make methods like QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(... ) etc.

You mean a method similar to QMouseEvent constructor? Like this:
QGraphicsSceneMouseEvent* createGraphicsSceneMouseEvent(QEvent::Type type, const QPoint& pos, const QPoint& screenPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
Comment 12 Diego Gonzalez 2010-06-09 11:07:29 PDT
Created attachment 58263 [details]
Patch
Comment 13 Kenneth Rohde Christiansen 2010-06-09 11:17:56 PDT
Comment on attachment 58263 [details]
Patch


> +void EventSender::sendEvent(QObject* receiver, QEvent* event, bool graphics)

Couldn't it verify this "graphics" inside the method? This is never going to change through runs anyway.

> +{
> +    if (!graphics)
> +        QApplication::sendEvent(receiver, event);
> +    else {
> +        if (WebCore::WebViewGraphicsBased* view = qobject_cast<WebCore::WebViewGraphicsBased*>(receiver))
> +            view->scene()->sendEvent(view->graphicsView(), event);
> +    }
> +}
Comment 14 Diego Gonzalez 2010-06-09 11:54:41 PDT
Created attachment 58268 [details]
Patch
Comment 15 Diego Gonzalez 2010-06-09 13:29:30 PDT
Created attachment 58288 [details]
Patch
Comment 16 Diego Gonzalez 2010-06-09 13:51:21 PDT
Created attachment 58292 [details]
Patch
Comment 17 WebKit Commit Bot 2010-06-10 08:45:58 PDT
Comment on attachment 58292 [details]
Patch

Clearing flags on attachment: 58292

Committed r60959: <http://trac.webkit.org/changeset/60959>
Comment 18 WebKit Commit Bot 2010-06-10 08:46:06 PDT
All reviewed patches have been landed.  Closing bug.