Changeset 86461 in webkit


Ignore:
Timestamp:
May 13, 2011 2:35:06 PM (13 years ago)
Author:
rniwa@webkit.org
Message:

2011-05-13 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

click event shouldn't fire when the target is ever removed in mouseup
https://bugs.webkit.org/show_bug.cgi?id=60600

Added tests to ensure WebKit does not fire click event when the target node
is removed in mouseup event.

  • fast/events/remove-target-in-mouseup-deep-expected.txt: Added.
  • fast/events/remove-target-in-mouseup-deep.html: Added.
  • fast/events/remove-target-in-mouseup-expected.txt: Added.
  • fast/events/remove-target-in-mouseup-insertback-expected.txt: Added.
  • fast/events/remove-target-in-mouseup-insertback.html: Added.
  • fast/events/remove-target-in-mouseup-twice-expected.txt: Added.
  • fast/events/remove-target-in-mouseup-twice.html: Added.
  • fast/events/remove-target-in-mouseup.html: Added.

2011-05-13 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Darin Adler.

click event shouldn't fire when the target is ever removed in mouseup
https://bugs.webkit.org/show_bug.cgi?id=60600

Fixed the bug by invalidating m_clickNode when it or one of its ancestors has been removed
from the document. New behavior matches Internet Explorer and Firefox.

Tests: fast/events/remove-target-in-mouseup-deep.html

fast/events/remove-target-in-mouseup-insertback.html
fast/events/remove-target-in-mouseup-twice.html
fast/events/remove-target-in-mouseup.html

  • dom/Document.cpp: (WebCore::Document::nodeChildrenWillBeRemoved): Calls EventHandler::nodeWillBeRemoved. (WebCore::Document::nodeWillBeRemoved): Calls EventHandler::nodeWillBeRemoved.
  • page/EventHandler.cpp: (WebCore::EventHandler::nodeWillBeRemoved): Added; invalidates m_clickNode when m_clickNode or one of its ancestor is removed from the document.
  • page/EventHandler.h:
Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r86458 r86461  
     12011-05-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        click event shouldn't fire when the target is ever removed in mouseup
     6        https://bugs.webkit.org/show_bug.cgi?id=60600
     7
     8        Added tests to ensure WebKit does not fire click event when the target node
     9        is removed in mouseup event.
     10
     11        * fast/events/remove-target-in-mouseup-deep-expected.txt: Added.
     12        * fast/events/remove-target-in-mouseup-deep.html: Added.
     13        * fast/events/remove-target-in-mouseup-expected.txt: Added.
     14        * fast/events/remove-target-in-mouseup-insertback-expected.txt: Added.
     15        * fast/events/remove-target-in-mouseup-insertback.html: Added.
     16        * fast/events/remove-target-in-mouseup-twice-expected.txt: Added.
     17        * fast/events/remove-target-in-mouseup-twice.html: Added.
     18        * fast/events/remove-target-in-mouseup.html: Added.
     19
    1202011-05-13  Adam Barth  <abarth@webkit.org>
    221
  • trunk/Source/WebCore/ChangeLog

    r86460 r86461  
     12011-05-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        click event shouldn't fire when the target is ever removed in mouseup
     6        https://bugs.webkit.org/show_bug.cgi?id=60600
     7
     8        Fixed the bug by invalidating m_clickNode when it or one of its ancestors has been removed
     9        from the document. New behavior matches Internet Explorer and Firefox.
     10
     11        Tests: fast/events/remove-target-in-mouseup-deep.html
     12               fast/events/remove-target-in-mouseup-insertback.html
     13               fast/events/remove-target-in-mouseup-twice.html
     14               fast/events/remove-target-in-mouseup.html
     15
     16        * dom/Document.cpp:
     17        (WebCore::Document::nodeChildrenWillBeRemoved): Calls EventHandler::nodeWillBeRemoved.
     18        (WebCore::Document::nodeWillBeRemoved): Calls EventHandler::nodeWillBeRemoved.
     19        * page/EventHandler.cpp:
     20        (WebCore::EventHandler::nodeWillBeRemoved): Added; invalidates m_clickNode when m_clickNode
     21        or one of its ancestor is removed from the document.
     22        * page/EventHandler.h:
     23
    1242011-05-13  Alexey Proskuryakov  <ap@apple.com>
    225
  • trunk/Source/WebCore/dom/Document.cpp

    r86279 r86461  
    34003400    if (Frame* frame = this->frame()) {
    34013401        for (Node* n = container->firstChild(); n; n = n->nextSibling()) {
     3402            frame->eventHandler()->nodeWillBeRemoved(n);
    34023403            frame->selection()->nodeWillBeRemoved(n);
    34033404            frame->page()->dragCaretController()->nodeWillBeRemoved(n);
     
    34193420
    34203421    if (Frame* frame = this->frame()) {
     3422        frame->eventHandler()->nodeWillBeRemoved(n);
    34213423        frame->selection()->nodeWillBeRemoved(n);
    34223424        frame->page()->dragCaretController()->nodeWillBeRemoved(n);
  • trunk/Source/WebCore/page/EventHandler.cpp

    r86325 r86461  
    258258    m_originatingTouchPointTargets.clear();
    259259#endif
     260}
     261
     262void EventHandler::nodeWillBeRemoved(Node* nodeToBeRemoved)
     263{
     264    if (nodeToBeRemoved->contains(m_clickNode.get()))
     265        m_clickNode = 0;
    260266}
    261267
  • trunk/Source/WebCore/page/EventHandler.h

    r86131 r86461  
    9999
    100100    void clear();
     101    void nodeWillBeRemoved(Node*);
    101102
    102103#if ENABLE(DRAG_SUPPORT)
Note: See TracChangeset for help on using the changeset viewer.