Changeset 143148 in webkit


Ignore:
Timestamp:
Feb 17, 2013 10:31:19 PM (11 years ago)
Author:
mkwst@chromium.org
Message:

WheelEvent should not target text nodes.
https://bugs.webkit.org/show_bug.cgi?id=109939

Reviewed by Darin Adler.

Source/WebCore:

WheelEvent, like other mouse events, should not target text nodes.
EventHandler correctly handles other mouse events by retargeting
events to text nodes' parents; this patch adds that logic to the
WheelEvent handler.

This should allow jQuery to stop working around WebKit's behavior[1].

[1]: https://github.com/jquery/jquery/commit/c61150427fc8ccc8e884df8f221a6c9bb5477929

Test: fast/events/wheelevent-in-text-node.html

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleWheelEvent):

If a WheelEvent's hit test lands on a text node, retarget the
event to the text node's parent. Do this before latching the node.

LayoutTests:

  • fast/events/wheelevent-in-text-node-expected.txt: Added.
  • fast/events/wheelevent-in-text-node.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143144 r143148  
     12013-02-17  Mike West  <mkwst@chromium.org>
     2
     3        WheelEvent should not target text nodes.
     4        https://bugs.webkit.org/show_bug.cgi?id=109939
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/events/wheelevent-in-text-node-expected.txt: Added.
     9        * fast/events/wheelevent-in-text-node.html: Added.
     10
    1112013-02-17  Philip Rogers  <pdr@google.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r143147 r143148  
     12013-02-17  Mike West  <mkwst@chromium.org>
     2
     3        WheelEvent should not target text nodes.
     4        https://bugs.webkit.org/show_bug.cgi?id=109939
     5
     6        Reviewed by Darin Adler.
     7
     8        WheelEvent, like other mouse events, should not target text nodes.
     9        EventHandler correctly handles other mouse events by retargeting
     10        events to text nodes' parents; this patch adds that logic to the
     11        WheelEvent handler.
     12
     13        This should allow jQuery to stop working around WebKit's behavior[1].
     14
     15        [1]: https://github.com/jquery/jquery/commit/c61150427fc8ccc8e884df8f221a6c9bb5477929
     16
     17        Test: fast/events/wheelevent-in-text-node.html
     18
     19        * page/EventHandler.cpp:
     20        (WebCore::EventHandler::handleWheelEvent):
     21            If a WheelEvent's hit test lands on a text node, retarget the
     22            event to the text node's parent. Do this before latching the node.
     23
    1242013-02-17  Filip Pizlo  <fpizlo@apple.com>
    225
  • trunk/Source/WebCore/page/EventHandler.cpp

    r142977 r143148  
    23242324    LayoutPoint vPoint = view->windowToContents(e.position());
    23252325
    2326     Node* node;
    2327     bool isOverWidget;
    2328 
    23292326    HitTestRequest request(HitTestRequest::ReadOnly);
    23302327    HitTestResult result(vPoint);
     
    23332330    bool useLatchedWheelEventNode = e.useLatchedEventNode();
    23342331
     2332    Node* node = result.innerNode();
     2333    // Wheel events should not dispatch to text nodes.
     2334    if (node && node->isTextNode()) {
     2335        AncestorChainWalker walker(node);
     2336        walker.parent();
     2337        node = walker.get();
     2338    }
     2339
     2340    bool isOverWidget;
    23352341    if (useLatchedWheelEventNode) {
    23362342        if (!m_latchedWheelEventNode) {
    2337             m_latchedWheelEventNode = result.innerNode();
     2343            m_latchedWheelEventNode = node;
    23382344            m_widgetIsLatched = result.isOverWidget();
    2339         }
    2340 
    2341         node = m_latchedWheelEventNode.get();
     2345        } else
     2346            node = m_latchedWheelEventNode.get();
     2347
    23422348        isOverWidget = m_widgetIsLatched;
    23432349    } else {
     
    23472353            m_previousWheelScrolledNode = 0;
    23482354
    2349         node = result.innerNode();
    23502355        isOverWidget = result.isOverWidget();
    23512356    }
Note: See TracChangeset for help on using the changeset viewer.