Changeset 167684 in webkit


Ignore:
Timestamp:
Apr 22, 2014 2:55:59 PM (10 years ago)
Author:
akling@apple.com
Message:

REGRESSION (r151839): Subframe keeps getting mousemove events with the same coordinates after hiding a hovered element.
<https://webkit.org/b/131974>
<rdar://problem/15907469>

Source/WebCore:
When the currently hovered element disappears as a result of style recalc,
we send a fake mousemove event to the page, to see if anything newly added
should become hovered.

The faking mechanism lives in EventHandler and simply synthesizes a new
mousemove event using the last seen mouse location.

The problem here is that we were sending this fake mousemove event to the
subframe where the hovered element lived. Since subframes aren't kept up
to date on recent mouse locations, this could cause some strange behavior
where a subframe would dispatch mousemove events with stale coordinates.

The solution is to always dispatch fake mousemove events from the main
frame's event handler. This is how real event delivery happens, and hit
testing will then find the appropriate subframe, if any.

Reviewed by Benjamin Poulain.

Test: fast/events/ghostly-mousemoves-in-subframe.html

  • dom/Document.cpp:

(WebCore::Document::recalcStyle):

LayoutTests:
Add a test that triggers the weirdness where removing the renderer from
a hovered element in a subframe would leave the subframe's EventHandler
in a state where it could dispatch fake mousemove events with stale
coordinates in response to style recalc.

Note that the final 500ms delay is because fake mousemove events are
sent on 250ms delay timers so we need to give it some time to catch up.

Reviewed by Benjamin Poulain.

  • fast/events/ghostly-mousemoves-in-subframe-expected.txt: Added.
  • fast/events/ghostly-mousemoves-in-subframe.html: Added.
  • platform/mac-wk2/fast/events/resources/ghostly-mousemoves-in-subframe-the-actual-subframe.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167680 r167684  
     12014-04-22  Andreas Kling  <akling@apple.com>
     2
     3        REGRESSION (r151839): Subframe keeps getting mousemove events with the same coordinates after hiding a hovered element.
     4        <https://webkit.org/b/131974>
     5        <rdar://problem/15907469>
     6
     7        Add a test that triggers the weirdness where removing the renderer from
     8        a hovered element in a subframe would leave the subframe's EventHandler
     9        in a state where it could dispatch fake mousemove events with stale
     10        coordinates in response to style recalc.
     11
     12        Note that the final 500ms delay is because fake mousemove events are
     13        sent on 250ms delay timers so we need to give it some time to catch up.
     14
     15        Reviewed by Benjamin Poulain.
     16
     17        * fast/events/ghostly-mousemoves-in-subframe-expected.txt: Added.
     18        * fast/events/ghostly-mousemoves-in-subframe.html: Added.
     19        * platform/mac-wk2/fast/events/resources/ghostly-mousemoves-in-subframe-the-actual-subframe.html: Added.
     20
    1212014-04-22  Tim Horton  <timothy_horton@apple.com>
    222
  • trunk/Source/WebCore/ChangeLog

    r167683 r167684  
     12014-04-22  Andreas Kling  <akling@apple.com>
     2
     3        REGRESSION (r151839): Subframe keeps getting mousemove events with the same coordinates after hiding a hovered element.
     4        <https://webkit.org/b/131974>
     5        <rdar://problem/15907469>
     6
     7        When the currently hovered element disappears as a result of style recalc,
     8        we send a fake mousemove event to the page, to see if anything newly added
     9        should become hovered.
     10
     11        The faking mechanism lives in EventHandler and simply synthesizes a new
     12        mousemove event using the last seen mouse location.
     13
     14        The problem here is that we were sending this fake mousemove event to the
     15        subframe where the hovered element lived. Since subframes aren't kept up
     16        to date on recent mouse locations, this could cause some strange behavior
     17        where a subframe would dispatch mousemove events with stale coordinates.
     18
     19        The solution is to always dispatch fake mousemove events from the main
     20        frame's event handler. This is how real event delivery happens, and hit
     21        testing will then find the appropriate subframe, if any.
     22
     23        Reviewed by Benjamin Poulain.
     24
     25        Test: fast/events/ghostly-mousemoves-in-subframe.html
     26
     27        * dom/Document.cpp:
     28        (WebCore::Document::recalcStyle):
     29
    1302014-04-22  Myles C. Maxfield  <mmaxfield@apple.com>
    231
  • trunk/Source/WebCore/dom/Document.cpp

    r167594 r167684  
    17951795    // to check if any other elements ended up under the mouse pointer due to re-layout.
    17961796    if (m_hoveredElement && !m_hoveredElement->renderer())
    1797         frameView.frame().eventHandler().dispatchFakeMouseMoveEventSoon();
     1797        frameView.frame().mainFrame().eventHandler().dispatchFakeMouseMoveEventSoon();
    17981798
    17991799    // Style change may reset the focus, e.g. display: none, visibility: hidden.
Note: See TracChangeset for help on using the changeset viewer.