| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/dom/StyleEngine.h" | 5 #include "core/dom/StyleEngine.h" |
| 6 | 6 |
| 7 #include "core/css/StyleSheetContents.h" | 7 #include "core/css/StyleSheetContents.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/NodeComputedStyle.h" | 9 #include "core/dom/NodeComputedStyle.h" |
| 10 #include "core/dom/shadow/ShadowRootInit.h" | 10 #include "core/dom/shadow/ShadowRootInit.h" |
| 11 #include "core/frame/FrameView.h" | 11 #include "core/frame/FrameView.h" |
| 12 #include "core/html/HTMLElement.h" | 12 #include "core/html/HTMLElement.h" |
| 13 #include "core/html/HTMLStyleElement.h" | 13 #include "core/html/HTMLStyleElement.h" |
| 14 #include "core/testing/DummyPageHolder.h" | 14 #include "core/testing/DummyPageHolder.h" |
| 15 #include "platform/heap/Heap.h" | 15 #include "platform/heap/Heap.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include <memory> | 17 #include <memory> |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 class StyleEngineTest : public ::testing::Test { | 21 class StyleEngineTest : public ::testing::Test { |
| 22 protected: | 22 protected: |
| 23 void SetUp() override; | 23 void SetUp() override; |
| 24 | 24 |
| 25 Document& document() { return m_dummyPageHolder->document(); } | 25 Document& document() { return m_dummyPageHolder->document(); } |
| 26 StyleEngine& styleEngine() { return document().styleEngine(); } | 26 StyleEngine& styleEngine() { return document().styleEngine(); } |
| 27 | 27 |
| 28 bool isDocumentStyleSheetCollectionClean() { | 28 bool isDocumentStyleSheetCollectionClean() { |
| 29 return !styleEngine().shouldUpdateDocumentStyleSheetCollection( | 29 return !styleEngine().shouldUpdateDocumentStyleSheetCollection(); |
| 30 AnalyzedStyleUpdate); | |
| 31 } | 30 } |
| 32 | 31 |
| 33 enum RuleSetInvalidation { | 32 enum RuleSetInvalidation { |
| 34 RuleSetInvalidationsScheduled, | 33 RuleSetInvalidationsScheduled, |
| 35 RuleSetInvalidationFullRecalc | 34 RuleSetInvalidationFullRecalc |
| 36 }; | 35 }; |
| 37 RuleSetInvalidation scheduleInvalidationsForRules(TreeScope&, | 36 RuleSetInvalidation scheduleInvalidationsForRules(TreeScope&, |
| 38 const String& cssText); | 37 const String& cssText); |
| 39 | 38 |
| 40 private: | 39 private: |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 314 |
| 316 EXPECT_TRUE(document().styleEngine().hasViewportDependentMediaQueries()); | 315 EXPECT_TRUE(document().styleEngine().hasViewportDependentMediaQueries()); |
| 317 | 316 |
| 318 document().body()->removeChild(styleElement); | 317 document().body()->removeChild(styleElement); |
| 319 document().view()->updateAllLifecyclePhases(); | 318 document().view()->updateAllLifecyclePhases(); |
| 320 | 319 |
| 321 EXPECT_FALSE(document().styleEngine().hasViewportDependentMediaQueries()); | 320 EXPECT_FALSE(document().styleEngine().hasViewportDependentMediaQueries()); |
| 322 } | 321 } |
| 323 | 322 |
| 324 } // namespace blink | 323 } // namespace blink |
| OLD | NEW |