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/css/ActiveStyleSheets.h" | 5 #include "core/css/ActiveStyleSheets.h" |
6 | 6 |
7 #include "core/css/CSSStyleSheet.h" | 7 #include "core/css/CSSStyleSheet.h" |
8 #include "core/css/MediaQueryEvaluator.h" | 8 #include "core/css/MediaQueryEvaluator.h" |
9 #include "core/css/StyleSheetContents.h" | 9 #include "core/css/StyleSheetContents.h" |
10 #include "core/css/StyleSheetList.h" | 10 #include "core/css/StyleSheetList.h" |
11 #include "core/css/parser/CSSParserContext.h" | 11 #include "core/css/parser/CSSParserContext.h" |
12 #include "core/dom/StyleEngine.h" | 12 #include "core/dom/StyleEngine.h" |
13 #include "core/dom/shadow/ShadowRoot.h" | 13 #include "core/dom/shadow/ShadowRoot.h" |
14 #include "core/dom/shadow/ShadowRootInit.h" | 14 #include "core/dom/shadow/ShadowRootInit.h" |
15 #include "core/frame/FrameView.h" | 15 #include "core/frame/FrameView.h" |
16 #include "core/html/HTMLElement.h" | 16 #include "core/html/HTMLElement.h" |
17 #include "core/testing/DummyPageHolder.h" | 17 #include "core/testing/DummyPageHolder.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class ActiveStyleSheetsTest : public ::testing::Test { | 22 class ActiveStyleSheetsTest : public ::testing::Test { |
23 protected: | 23 protected: |
24 static CSSStyleSheet* createSheet(const String& cssText = String()) { | 24 static CSSStyleSheet* createSheet(const String& cssText = String()) { |
25 StyleSheetContents* contents = | 25 StyleSheetContents* contents = |
26 StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr)); | 26 StyleSheetContents::create(CSSParserContext::create(HTMLStandardMode)); |
27 contents->parseString(cssText); | 27 contents->parseString(cssText); |
28 contents->ensureRuleSet(MediaQueryEvaluator(), | 28 contents->ensureRuleSet(MediaQueryEvaluator(), |
29 RuleHasDocumentSecurityOrigin); | 29 RuleHasDocumentSecurityOrigin); |
30 return CSSStyleSheet::create(contents); | 30 return CSSStyleSheet::create(contents); |
31 } | 31 } |
32 }; | 32 }; |
33 | 33 |
34 class ApplyRulesetsTest : public ActiveStyleSheetsTest { | 34 class ApplyRulesetsTest : public ActiveStyleSheetsTest { |
35 protected: | 35 protected: |
36 void SetUp() override { | 36 void SetUp() override { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ActiveStyleSheetVector oldStyleSheets; | 460 ActiveStyleSheetVector oldStyleSheets; |
461 oldStyleSheets.push_back( | 461 oldStyleSheets.push_back( |
462 std::make_pair(cssSheet, &cssSheet->contents()->ruleSet())); | 462 std::make_pair(cssSheet, &cssSheet->contents()->ruleSet())); |
463 styleEngine().applyRuleSetChanges(shadowRoot, oldStyleSheets, | 463 styleEngine().applyRuleSetChanges(shadowRoot, oldStyleSheets, |
464 ActiveStyleSheetVector()); | 464 ActiveStyleSheetVector()); |
465 | 465 |
466 EXPECT_TRUE(styleEngine().treeBoundaryCrossingScopes().isEmpty()); | 466 EXPECT_TRUE(styleEngine().treeBoundaryCrossingScopes().isEmpty()); |
467 } | 467 } |
468 | 468 |
469 } // namespace blink | 469 } // namespace blink |
OLD | NEW |