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

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

Issue 2394263003: Make sure we don't try scrolling a node without a LayoutObject (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/ScrollManager.cpp
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp
index 0f720e50cc0be53cb15c520582691be06c61a6ea..434949635f5412c94608a3f1aa914bb335ace0ce 100644
--- a/third_party/WebKit/Source/core/input/ScrollManager.cpp
+++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -212,7 +212,8 @@ WebInputEventResult ScrollManager::handleGestureScrollBegin(
if (!m_scrollGestureHandlingNode)
m_scrollGestureHandlingNode = m_frame->document()->documentElement();
- if (!m_scrollGestureHandlingNode)
+ if (!m_scrollGestureHandlingNode ||
+ !m_scrollGestureHandlingNode->layoutObject())
return WebInputEventResult::NotHandled;
passScrollGestureEventToWidget(gestureEvent,
@@ -238,6 +239,10 @@ WebInputEventResult ScrollManager::handleGestureScrollUpdate(
const PlatformGestureEvent& gestureEvent) {
DCHECK_EQ(gestureEvent.type(), PlatformEvent::GestureScrollUpdate);
+ Node* node = m_scrollGestureHandlingNode.get();
+ if (!node || !node->layoutObject())
+ return WebInputEventResult::NotHandled;
+
// Negate the deltas since the gesture event stores finger movement and
// scrolling occurs in the direction opposite the finger's movement
// direction. e.g. Finger moving up has negative event delta but causes the
@@ -249,14 +254,7 @@ WebInputEventResult ScrollManager::handleGestureScrollUpdate(
if (delta.isZero())
return WebInputEventResult::NotHandled;
- Node* node = m_scrollGestureHandlingNode.get();
-
- if (!node)
- return WebInputEventResult::NotHandled;
-
LayoutObject* layoutObject = node->layoutObject();
- if (!layoutObject)
- return WebInputEventResult::NotHandled;
// Try to send the event to the correct view.
WebInputEventResult result =
@@ -322,7 +320,7 @@ WebInputEventResult ScrollManager::handleGestureScrollEnd(
const PlatformGestureEvent& gestureEvent) {
Node* node = m_scrollGestureHandlingNode;
- if (node) {
+ if (node && node->layoutObject()) {
passScrollGestureEventToWidget(gestureEvent, node->layoutObject());
std::unique_ptr<ScrollStateData> scrollStateData =
wrapUnique(new ScrollStateData());
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698