| OLD | NEW |
| (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 |
| OLD | NEW |