[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

pkasting at chromium.org pkasting at chromium.org
Wed Dec 22 13:19:20 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 121f7e0a4fd00eee7d70847b1e8395c3c6d8158f
Author: pkasting at chromium.org <pkasting at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 11 01:16:12 2010 +0000

    Make middle clicks not fire DOM onclick events.
    https://bugs.webkit.org/show_bug.cgi?id=22382
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    * html/HTMLAnchorElement.cpp: Explicitly include middle-clicks in the
    computation of what constitutes a link click, since they're no longer
    implicitly included.
    (WebCore::isLinkClick):
    * html/HTMLInputElement.cpp: Removed unneeded checks that click events
    are coming from the left mouse button, since they all are now.
    (WebCore::HTMLInputElement::preDispatchEventHandler):
    (WebCore::HTMLInputElement::postDispatchEventHandler):
    (WebCore::HTMLInputElement::defaultEventHandler):
    * page/EventHandler.cpp: Changed logic to send a click event only for
    the left button.
    (WebCore::EventHandler::handleMouseDoubleClickEvent):
    (WebCore::EventHandler::handleMouseReleaseEvent):
    
    LayoutTests:
    
    * fast/events/mouse-click-events-expected.txt:
    * fast/events/script-tests/mouse-click-events.js:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67261 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c2cf688..c0d303b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-09-10  Peter Kasting  <pkasting at google.com>
+
+        Reviewed by Darin Adler.
+
+        Make middle clicks not fire DOM onclick events.
+        https://bugs.webkit.org/show_bug.cgi?id=22382
+
+        * fast/events/mouse-click-events-expected.txt:
+        * fast/events/script-tests/mouse-click-events.js:
+
 2010-09-10  Dirk Pranke  <dpranke at chromium.org>
 
         Unreviewed, expectations change.
diff --git a/LayoutTests/fast/events/mouse-click-events-expected.txt b/LayoutTests/fast/events/mouse-click-events-expected.txt
index a62adae..6aea661 100644
--- a/LayoutTests/fast/events/mouse-click-events-expected.txt
+++ b/LayoutTests/fast/events/mouse-click-events-expected.txt
@@ -6,11 +6,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Left Mouse Button
 PASS eventLog is "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) "
 Middle Mouse Button
-PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "
+PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "
 Right Mouse Button
 PASS eventLog is "mousedown(2) mouseup(2) mousedown(2) mouseup(2) "
 4th Mouse Button
-PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "
+PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/events/script-tests/mouse-click-events.js b/LayoutTests/fast/events/script-tests/mouse-click-events.js
index 72a341b..f6d59c7 100644
--- a/LayoutTests/fast/events/script-tests/mouse-click-events.js
+++ b/LayoutTests/fast/events/script-tests/mouse-click-events.js
@@ -49,9 +49,9 @@ function testEvents(description, button, expectedString) {
 
 if (window.eventSender) {
     testEvents("Left Mouse Button", 0, "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) ");
-    testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");
+    testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) ");
     testEvents("Right Mouse Button", 2, "mousedown(2) mouseup(2) mousedown(2) mouseup(2) ");
-    testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");
+    testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) ");
 }
 
 var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b6610c7..c829121 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-10  Peter Kasting  <pkasting at google.com>
+
+        Reviewed by Darin Adler.
+
+        Make middle clicks not fire DOM onclick events.
+        https://bugs.webkit.org/show_bug.cgi?id=22382
+
+        * html/HTMLAnchorElement.cpp: Explicitly include middle-clicks in the
+        computation of what constitutes a link click, since they're no longer
+        implicitly included.
+        (WebCore::isLinkClick):
+        * html/HTMLInputElement.cpp: Removed unneeded checks that click events
+        are coming from the left mouse button, since they all are now.
+        (WebCore::HTMLInputElement::preDispatchEventHandler):
+        (WebCore::HTMLInputElement::postDispatchEventHandler):
+        (WebCore::HTMLInputElement::defaultEventHandler):
+        * page/EventHandler.cpp: Changed logic to send a click event only for
+        the left button.
+        (WebCore::EventHandler::handleMouseDoubleClickEvent):
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+
 2010-09-10  Adam Barth  <abarth at webkit.org>
 
         Attempted build fix for Qt Minimal.
@@ -99,7 +120,7 @@
         (WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton): Added. Pass through to RenderMediaControls.
         * rendering/RenderThemeWin.h:
 
-2010-09-109  Peter Kasting  <pkasting at google.com>
+2010-09-10  Peter Kasting  <pkasting at google.com>
 
         Reviewed by Darin Adler.
 
diff --git a/WebCore/html/HTMLAnchorElement.cpp b/WebCore/html/HTMLAnchorElement.cpp
index d1914fd..995552e 100644
--- a/WebCore/html/HTMLAnchorElement.cpp
+++ b/WebCore/html/HTMLAnchorElement.cpp
@@ -514,7 +514,7 @@ bool isMiddleMouseButtonEvent(Event* event)
 
 bool isLinkClick(Event* event)
 {
-    return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button() != RightButton);
+    return event->type() == eventNames().clickEvent || (event->type() == eventNames().mouseupEvent && isMiddleMouseButtonEvent(event));
 }
 
 void handleLinkClick(Event* event, Document* document, const String& url, const String& target, bool hideReferrer)
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index bdce256..e90525b 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -2155,16 +2155,13 @@ struct EventHandlingState : FastAllocBase {
         , m_checked(checked) { }
 };
 
-void* HTMLInputElement::preDispatchEventHandler(Event *evt)
+void* HTMLInputElement::preDispatchEventHandler(Event* evt)
 {
     // preventDefault or "return false" are used to reverse the automatic checking/selection we do here.
     // This result gives us enough info to perform the "undo" in postDispatch of the action we take here.
     void* result = 0; 
-    if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->isMouseEvent()
-            && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
-        
+    if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->type() == eventNames().clickEvent) {
         OwnPtr<EventHandlingState> state = adoptPtr(new EventHandlingState(indeterminate(), checked()));
-
         if (inputType() == CHECKBOX) {
             if (indeterminate())
                 setIndeterminate(false);
@@ -2192,8 +2189,7 @@ void* HTMLInputElement::preDispatchEventHandler(Event *evt)
 
 void HTMLInputElement::postDispatchEventHandler(Event *evt, void* data)
 {
-    if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->isMouseEvent()
-            && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
+    if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->type() == eventNames().clickEvent) {
         
         if (EventHandlingState* state = reinterpret_cast<EventHandlingState*>(data)) {
             if (inputType() == CHECKBOX) {
@@ -2276,10 +2272,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
         return;
     }
 
-    if (inputType() == RADIO
-            && evt->isMouseEvent()
-            && evt->type() == eventNames().clickEvent
-            && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
+    if (inputType() == RADIO && evt->type() == eventNames().clickEvent) {
         evt->setDefaultHandled();
         return;
     }
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index b31ae71..bec55de 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -1375,17 +1375,12 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv
     m_clickCount = mouseEvent.clickCount();
     bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false);
 
-    bool swallowClickEvent = false;
-    // Don't ever dispatch click events for right clicks
-    if (mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode)
-        swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+    bool swallowClickEvent = mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
 
     if (m_lastScrollbarUnderMouse)
         swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp();
-            
-    bool swallowMouseReleaseEvent = false;
-    if (!swallowMouseUpEvent)
-        swallowMouseReleaseEvent = handleMouseReleaseEvent(mev);
+
+    bool swallowMouseReleaseEvent = !swallowMouseUpEvent && handleMouseReleaseEvent(mev);
 
     invalidateClick();
 
@@ -1571,10 +1566,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
 
     bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false);
 
-    // Don't ever dispatch click events for right clicks
-    bool swallowClickEvent = false;
-    if (m_clickCount > 0 && mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode)
-        swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
+    bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
 
     if (m_resizeLayer) {
         m_resizeLayer->setInResizeMode(false);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list