Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1731353003: Prevent propagation of wheel events to dispatch event in parent iframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 1790
1791 if (m_previousWheelScrolledNode) 1791 if (m_previousWheelScrolledNode)
1792 m_previousWheelScrolledNode = nullptr; 1792 m_previousWheelScrolledNode = nullptr;
1793 1793
1794 bool isOverWidget = result.isOverWidget(); 1794 bool isOverWidget = result.isOverWidget();
1795 1795
1796 if (node) { 1796 if (node) {
1797 // Figure out which view to send the event to. 1797 // Figure out which view to send the event to.
1798 LayoutObject* target = node->layoutObject(); 1798 LayoutObject* target = node->layoutObject();
1799 1799
1800 bool sendDOMEvent = true;
1800 if (isOverWidget && target && target->isLayoutPart()) { 1801 if (isOverWidget && target && target->isLayoutPart()) {
1801 if (Widget* widget = toLayoutPart(target)->widget()) { 1802 if (Widget* widget = toLayoutPart(target)->widget()) {
1802 WebInputEventResult result = passWheelEventToWidget(event, *widg et); 1803 WebInputEventResult result = passWheelEventToWidget(event, *widg et);
1803 if (result != WebInputEventResult::NotHandled) { 1804 if (result != WebInputEventResult::NotHandled) {
1804 setFrameWasScrolledByUser(); 1805 setFrameWasScrolledByUser();
1805 return result; 1806 return result;
1806 } 1807 }
1808 // TODO(dtapuska): Remove this once wheel gesture scroll has
1809 // been enabled everywhere; as we can just return early.
Rick Byers 2016/02/25 16:34:16 nit: reference the crbug link for that incase anyo
1810 // Don't propagate the DOM event into the parent iframe
1811 // but do dispatch the scroll event.
1812 sendDOMEvent = false;
1807 } 1813 }
1808 } 1814 }
1809 1815
1810 RefPtrWillBeRawPtr<Event> domEvent = WheelEvent::create(event, node->doc ument().domWindow()); 1816 if (sendDOMEvent) {
1811 if (!node->dispatchEvent(domEvent)) { 1817 RefPtrWillBeRawPtr<Event> domEvent = WheelEvent::create(event, node- >document().domWindow());
1812 setFrameWasScrolledByUser(); 1818 if (!node->dispatchEvent(domEvent)) {
1813 return eventToEventResult(domEvent, false); 1819 setFrameWasScrolledByUser();
1820 return eventToEventResult(domEvent, false);
1821 }
1814 } 1822 }
1815 } 1823 }
1816 1824
1817 // We do another check on the frame view because the event handler can run 1825 // We do another check on the frame view because the event handler can run
1818 // JS which results in the frame getting destroyed. 1826 // JS which results in the frame getting destroyed.
1819 view = m_frame->view(); 1827 view = m_frame->view();
1820 if (!view) 1828 if (!view)
1821 return WebInputEventResult::NotHandled; 1829 return WebInputEventResult::NotHandled;
1822 1830
1823 // Wheel events which do not scroll are used to trigger zooming. 1831 // Wheel events which do not scroll are used to trigger zooming.
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3976 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 3984 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
3977 { 3985 {
3978 #if OS(MACOSX) 3986 #if OS(MACOSX)
3979 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 3987 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
3980 #else 3988 #else
3981 return PlatformEvent::AltKey; 3989 return PlatformEvent::AltKey;
3982 #endif 3990 #endif
3983 } 3991 }
3984 3992
3985 } // namespace blink 3993 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698