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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.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
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 90125c3b68cb5fe98aeddd30222f760ac61cbced..dadd721655640307c156703aed548be748d3fa7c 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -10165,4 +10165,37 @@ TEST_F(WebFrameTest, ImageDocumentDecodeError) {
toImageDocument(document)->cachedImage()->getStatus());
}
+// Load a page with display:none set and try to scroll it. It shouldn't crash
+// due to lack of layoutObject. crbug.com/653327.
+TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) {
+ registerMockedHttpURLLoad("display-none.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "display-none.html");
+ WebViewImpl* webView = webViewHelper.webView();
+ webViewHelper.resize(WebSize(640, 480));
+
+ Document* document = webView->mainFrameImpl()->frame()->document();
+ document->documentElement()->setLayoutObject(nullptr);
+
+ WebGestureEvent beginEvent;
+ beginEvent.type = WebInputEvent::GestureScrollEnd;
+ beginEvent.sourceDevice = WebGestureDeviceTouchpad;
+ WebGestureEvent updateEvent;
+ updateEvent.type = WebInputEvent::GestureScrollEnd;
+ updateEvent.sourceDevice = WebGestureDeviceTouchpad;
+ WebGestureEvent endEvent;
+ endEvent.type = WebInputEvent::GestureScrollEnd;
+ endEvent.sourceDevice = WebGestureDeviceTouchpad;
+
+ // Try GestureScrollEnd and GestureScrollUpdate first to make sure that not
+ // seeing a Begin first doesn't break anything. (This currently happens).
+ webViewHelper.webView()->handleInputEvent(endEvent);
+ webViewHelper.webView()->handleInputEvent(updateEvent);
+
+ // Try a full Begin/Update/End cycle.
+ webViewHelper.webView()->handleInputEvent(beginEvent);
+ webViewHelper.webView()->handleInputEvent(updateEvent);
+ webViewHelper.webView()->handleInputEvent(endEvent);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/ScrollManager.cpp ('k') | third_party/WebKit/Source/web/tests/data/display-none.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698