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

Unified Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1942623002: Rename Document::ownerElement to localOwner and fix main frame checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: third_party/WebKit/Source/core/input/EventHandler.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 5f643cf8b2ad4e8a6e7efcf500ca41fed94410ee..67b9ccae48a310e7a3332d5b21edd02531eb9ecf 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -85,6 +85,7 @@
#include "core/page/SpatialNavigation.h"
#include "core/page/TouchAdjustment.h"
#include "core/page/scrolling/OverscrollController.h"
+#include "core/page/scrolling/RootScroller.h"
#include "core/page/scrolling/ScrollState.h"
#include "core/paint/PaintLayer.h"
#include "core/style/ComputedStyle.h"
@@ -2518,11 +2519,10 @@ bool EventHandler::isRootScroller(const Node& node) const
{
// The root scroller is the one Element on the page designated to perform
// "viewport actions" like top controls movement and overscroll glow.
-
- if (!node.isElementNode() || node.document().ownerElement())
+ if (!node.isElementNode() || !frameHost() || !frameHost()->rootScroller())
return false;
- return node.document().rootScroller() == toElement(&node);
+ return frameHost()->rootScroller()->get() == toElement(&node);
}
WebInputEventResult EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gestureEvent)
@@ -3874,7 +3874,7 @@ WebInputEventResult EventHandler::dispatchTouchEvents(const PlatformTouchEvent&
// Only report for top level documents with a single touch on
// touch-start or the first touch-move.
- if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.cancelable() && !m_frame->document()->ownerElement()) {
+ if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.cancelable() && m_frame->isMainFrame()) {
DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHistogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTypeMax));
rootDocumentListenerHistogram.count(toTouchTargetHistogramValue(eventTarget, domDispatchResult));
@@ -4176,4 +4176,12 @@ FrameHost* EventHandler::frameHost()
return &m_frame->page()->frameHost();
}
+const FrameHost* EventHandler::frameHost() const
+{
+ if (!m_frame->page())
+ return nullptr;
+
+ return &m_frame->page()->frameHost();
dcheng 2016/05/03 18:47:40 We don't really go for const-correctness elsewhere
bokan 2016/05/03 21:41:04 IMO, that's something we should be working towards
dcheng 2016/05/07 06:09:07 Do we have any instances of this pattern anywhere
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.h ('k') | third_party/WebKit/Source/core/input/TouchActionUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698