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

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2812523003: Update layer position on scroll origin change (Closed)
Patch Set: Add Test Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91bb12aa3655a317b619448984efdb37be7bd5ff..f89397ef40a89203768e95ee61a2df0be43e89c9 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -11611,6 +11611,32 @@ TEST_F(WebFrameSimTest, NormalIFrameHasLayoutObjects) {
EXPECT_FALSE(iframe_doc->documentElement()->GetLayoutObject());
}
+TEST_F(WebFrameSimTest, ScrollOriginChangeUpdatesLayerPositions) {
+ WebView().Resize(WebSize(800, 600));
+ SimRequest main_resource("https://example.com/test.html", "text/html");
+
+ LoadURL("https://example.com/test.html");
+ main_resource.Complete(
+ "<!DOCTYPE html>"
+ "<body dir='rtl'>"
+ " <div style='width:1px; height:1px; position:absolute; left:-10000px'>"
+ " </div>"
+ "</body>");
+
+ Compositor().BeginFrame();
+ ScrollableArea* area = GetDocument().View()->LayoutViewportScrollableArea();
+ ASSERT_EQ(10000, area->ScrollOrigin().X());
+ ASSERT_EQ(10000, area->LayerForScrolling()->GetPosition().X());
+
+ // Removing the overflowing element removes all overflow so the scroll origin
+ // implicitly is reset to (0, 0).
+ GetDocument().QuerySelector("div")->remove();
+ Compositor().BeginFrame();
+
+ EXPECT_EQ(0, area->ScrollOrigin().X());
+ EXPECT_EQ(0, area->LayerForScrolling()->GetPosition().X());
+}
+
TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) {
class LoadingObserverFrameClient
: public FrameTestHelpers::TestWebFrameClient {
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698