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

Unified Diff: Source/core/page/EventHandler.cpp

Issue 296003011: Fix event passing to overlay scrollbars when over a plugin (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index a8bbae6ccffe852d844af806e7b6ac254eda6594..08f7d618e91a6d69982c237f29004d9a54f0a1ec 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -1287,26 +1287,14 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
if (swallowEvent) {
// scrollbars should get events anyway, even disabled controls might be scrollable
- Scrollbar* scrollbar = mev.scrollbar();
-
- updateLastScrollbarUnderMouse(scrollbar, true);
-
- if (scrollbar)
- passMousePressEventToScrollbar(mev, scrollbar);
+ passMousePressEventToScrollbar(mev);
} else {
if (shouldRefetchEventTarget(mev)) {
HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ConfusingAndOftenMisusedDisallowShadowContent);
mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
}
- FrameView* view = m_frame->view();
- Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mouseEvent.position()) : 0;
- if (!scrollbar)
- scrollbar = mev.scrollbar();
-
- updateLastScrollbarUnderMouse(scrollbar, true);
-
- if (scrollbar && passMousePressEventToScrollbar(mev, scrollbar))
+ if (passMousePressEventToScrollbar(mev))
swallowEvent = true;
else
swallowEvent = handleMousePressEvent(mev);
@@ -3317,8 +3305,18 @@ void EventHandler::setFrameWasScrolledByUser()
view->setWasScrolledByUser(true);
}
-bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev, Scrollbar* scrollbar)
+bool EventHandler::passMousePressEventToScrollbar(MouseEventWithHitTestResults& mev)
{
+ // First try to use the frame scrollbar.
+ FrameView* view = m_frame->view();
+ Scrollbar* scrollbar = view ? view->scrollbarAtPoint(mev.event().position()) : 0;
+
+ // Then try the scrollbar in the hit test.
+ if (!scrollbar)
+ scrollbar = mev.scrollbar();
+
+ updateLastScrollbarUnderMouse(scrollbar, true);
+
if (!scrollbar || !scrollbar->enabled())
return false;
setFrameWasScrolledByUser();

Powered by Google App Engine
This is Rietveld 408576698