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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/layout/LayoutView.h"
6 #include "core/paint/PaintLayerScrollableArea.h"
7 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
8 #include "platform/testing/UnitTestHelpers.h"
9 #include "public/web/WebScriptSource.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "web/WebLocalFrameImpl.h"
12 #include "web/tests/sim/SimDisplayItemList.h"
13 #include "web/tests/sim/SimRequest.h"
14 #include "web/tests/sim/SimTest.h"
15
16 namespace blink {
17
18 namespace {
19
20 class ScrollbarsTest : private ScopedRootLayerScrollingForTest, public SimTest {
21 public:
22 ScrollbarsTest() : ScopedRootLayerScrollingForTest(true) {}
23 };
24
25 TEST_F(ScrollbarsTest, DocumentStyleRecalcPreservesScrollbars) {
26 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
27 webView().resize(WebSize(800, 600));
28 SimRequest request("https://example.com/test.html", "text/html");
29 loadURL("https://example.com/test.html");
30 request.complete("<style> body { width: 1600px; height: 1200px; } </style>");
31 PaintLayerScrollableArea* plsa = document().layoutView()->getScrollableArea();
32
33 compositor().beginFrame();
34 ASSERT_TRUE(plsa->verticalScrollbar() && plsa->horizontalScrollbar());
35
36 // Forces recalc of LayoutView's computed style in Document::updateStyle,
37 // without invalidating layout.
38 mainFrame().executeScriptAndReturnValue(WebScriptSource(
39 "document.querySelector('style').sheet.insertRule('body {}', 1);"));
40
41 compositor().beginFrame();
42 ASSERT_TRUE(plsa->verticalScrollbar() && plsa->horizontalScrollbar());
43 }
44
45 } // namespace
46
47 } // namespace blink
OLDNEW
« 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