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

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

Issue 2571893003: Set overflow: auto in StyleResolver::styleForDocument. (Closed)
Patch Set: resolve merge conflict with r438458 Created 4 years 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/web/BUILD.gn ('k') | third_party/WebKit/Source/web/tests/sim/SimTest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/tests/ScrollbarsTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/ScrollbarsTest.cpp b/third_party/WebKit/Source/web/tests/ScrollbarsTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..eee9d25621738eb0c628ed40bede8ff32fd0bc23
--- /dev/null
+++ b/third_party/WebKit/Source/web/tests/ScrollbarsTest.cpp
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/layout/LayoutView.h"
+#include "core/paint/PaintLayerScrollableArea.h"
+#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
+#include "platform/testing/UnitTestHelpers.h"
+#include "public/web/WebScriptSource.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "web/WebLocalFrameImpl.h"
+#include "web/tests/sim/SimDisplayItemList.h"
+#include "web/tests/sim/SimRequest.h"
+#include "web/tests/sim/SimTest.h"
+
+namespace blink {
+
+namespace {
+
+class ScrollbarsTest : private ScopedRootLayerScrollingForTest, public SimTest {
+ public:
+ ScrollbarsTest() : ScopedRootLayerScrollingForTest(true) {}
+};
+
+TEST_F(ScrollbarsTest, DocumentStyleRecalcPreservesScrollbars) {
+ v8::HandleScope handleScope(v8::Isolate::GetCurrent());
+ webView().resize(WebSize(800, 600));
+ SimRequest request("https://example.com/test.html", "text/html");
+ loadURL("https://example.com/test.html");
+ request.complete("<style> body { width: 1600px; height: 1200px; } </style>");
+ PaintLayerScrollableArea* plsa = document().layoutView()->getScrollableArea();
+
+ compositor().beginFrame();
+ ASSERT_TRUE(plsa->verticalScrollbar() && plsa->horizontalScrollbar());
+
+ // Forces recalc of LayoutView's computed style in Document::updateStyle,
+ // without invalidating layout.
+ mainFrame().executeScriptAndReturnValue(WebScriptSource(
+ "document.querySelector('style').sheet.insertRule('body {}', 1);"));
+
+ compositor().beginFrame();
+ ASSERT_TRUE(plsa->verticalScrollbar() && plsa->horizontalScrollbar());
+}
+
+} // namespace
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/tests/sim/SimTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698