Changeset 67261 in webkit
- Timestamp:
- Sep 10, 2010 6:16:12 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r67256 r67261 1 2010-09-10 Peter Kasting <pkasting@google.com> 2 3 Reviewed by Darin Adler. 4 5 Make middle clicks not fire DOM onclick events. 6 https://bugs.webkit.org/show_bug.cgi?id=22382 7 8 * fast/events/mouse-click-events-expected.txt: 9 * fast/events/script-tests/mouse-click-events.js: 10 1 11 2010-09-10 Dirk Pranke <dpranke@chromium.org> 2 12 -
trunk/LayoutTests/fast/events/mouse-click-events-expected.txt
r50926 r67261 7 7 PASS eventLog is "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) " 8 8 Middle Mouse Button 9 PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "9 PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) " 10 10 Right Mouse Button 11 11 PASS eventLog is "mousedown(2) mouseup(2) mousedown(2) mouseup(2) " 12 12 4th Mouse Button 13 PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "13 PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) " 14 14 PASS successfullyParsed is true 15 15 -
trunk/LayoutTests/fast/events/script-tests/mouse-click-events.js
r50926 r67261 50 50 if (window.eventSender) { 51 51 testEvents("Left Mouse Button", 0, "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) "); 52 testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");52 testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "); 53 53 testEvents("Right Mouse Button", 2, "mousedown(2) mouseup(2) mousedown(2) mouseup(2) "); 54 testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");54 testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "); 55 55 } 56 56 -
trunk/WebCore/ChangeLog
r67257 r67261 1 2010-09-10 Peter Kasting <pkasting@google.com> 2 3 Reviewed by Darin Adler. 4 5 Make middle clicks not fire DOM onclick events. 6 https://bugs.webkit.org/show_bug.cgi?id=22382 7 8 * html/HTMLAnchorElement.cpp: Explicitly include middle-clicks in the 9 computation of what constitutes a link click, since they're no longer 10 implicitly included. 11 (WebCore::isLinkClick): 12 * html/HTMLInputElement.cpp: Removed unneeded checks that click events 13 are coming from the left mouse button, since they all are now. 14 (WebCore::HTMLInputElement::preDispatchEventHandler): 15 (WebCore::HTMLInputElement::postDispatchEventHandler): 16 (WebCore::HTMLInputElement::defaultEventHandler): 17 * page/EventHandler.cpp: Changed logic to send a click event only for 18 the left button. 19 (WebCore::EventHandler::handleMouseDoubleClickEvent): 20 (WebCore::EventHandler::handleMouseReleaseEvent): 21 1 22 2010-09-10 Adam Barth <abarth@webkit.org> 2 23 … … 100 121 * rendering/RenderThemeWin.h: 101 122 102 2010-09-10 9Peter Kasting <pkasting@google.com>123 2010-09-10 Peter Kasting <pkasting@google.com> 103 124 104 125 Reviewed by Darin Adler. -
trunk/WebCore/html/HTMLAnchorElement.cpp
r67246 r67261 515 515 bool isLinkClick(Event* event) 516 516 { 517 return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button() != RightButton);517 return event->type() == eventNames().clickEvent || (event->type() == eventNames().mouseupEvent && isMiddleMouseButtonEvent(event)); 518 518 } 519 519 -
trunk/WebCore/html/HTMLInputElement.cpp
r67208 r67261 2156 2156 }; 2157 2157 2158 void* HTMLInputElement::preDispatchEventHandler(Event *evt)2158 void* HTMLInputElement::preDispatchEventHandler(Event* evt) 2159 2159 { 2160 2160 // preventDefault or "return false" are used to reverse the automatic checking/selection we do here. 2161 2161 // This result gives us enough info to perform the "undo" in postDispatch of the action we take here. 2162 2162 void* result = 0; 2163 if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->isMouseEvent() 2164 && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) { 2165 2163 if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->type() == eventNames().clickEvent) { 2166 2164 OwnPtr<EventHandlingState> state = adoptPtr(new EventHandlingState(indeterminate(), checked())); 2167 2168 2165 if (inputType() == CHECKBOX) { 2169 2166 if (indeterminate()) … … 2193 2190 void HTMLInputElement::postDispatchEventHandler(Event *evt, void* data) 2194 2191 { 2195 if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->isMouseEvent() 2196 && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) { 2192 if ((inputType() == CHECKBOX || inputType() == RADIO) && evt->type() == eventNames().clickEvent) { 2197 2193 2198 2194 if (EventHandlingState* state = reinterpret_cast<EventHandlingState*>(data)) { … … 2277 2273 } 2278 2274 2279 if (inputType() == RADIO 2280 && evt->isMouseEvent() 2281 && evt->type() == eventNames().clickEvent 2282 && static_cast<MouseEvent*>(evt)->button() == LeftButton) { 2275 if (inputType() == RADIO && evt->type() == eventNames().clickEvent) { 2283 2276 evt->setDefaultHandled(); 2284 2277 return; -
trunk/WebCore/page/EventHandler.cpp
r67238 r67261 1376 1376 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false); 1377 1377 1378 bool swallowClickEvent = false; 1379 // Don't ever dispatch click events for right clicks 1380 if (mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode) 1381 swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true); 1378 bool swallowClickEvent = mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true); 1382 1379 1383 1380 if (m_lastScrollbarUnderMouse) 1384 1381 swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp(); 1385 1386 bool swallowMouseReleaseEvent = false; 1387 if (!swallowMouseUpEvent) 1388 swallowMouseReleaseEvent = handleMouseReleaseEvent(mev); 1382 1383 bool swallowMouseReleaseEvent = !swallowMouseUpEvent && handleMouseReleaseEvent(mev); 1389 1384 1390 1385 invalidateClick(); … … 1572 1567 bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false); 1573 1568 1574 // Don't ever dispatch click events for right clicks 1575 bool swallowClickEvent = false; 1576 if (m_clickCount > 0 && mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode) 1577 swallowClickEvent = dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true); 1569 bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true); 1578 1570 1579 1571 if (m_resizeLayer) {
Note: See TracChangeset
for help on using the changeset viewer.