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/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
11 #include "core/html/HTMLElement.h" | 11 #include "core/html/HTMLElement.h" |
12 #include "core/testing/DummyPageHolder.h" | 12 #include "core/testing/DummyPageHolder.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class StyleEngineTest : public ::testing::Test { | 17 class StyleEngineTest : public ::testing::Test { |
18 protected: | 18 protected: |
19 void SetUp() override; | 19 void SetUp() override; |
20 | 20 |
21 Document& document() { return m_dummyPageHolder->document(); } | 21 Document& document() { return m_dummyPageHolder->document(); } |
22 StyleEngine& styleEngine() { return document().styleEngine(); } | 22 StyleEngine& styleEngine() { return document().styleEngine(); } |
23 | 23 |
24 bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpd
ateDocumentStyleSheetCollection(AnalyzedStyleUpdate); } | 24 bool isDocumentStyleSheetCollectionClean() { return !styleEngine().shouldUpd
ateDocumentStyleSheetCollection(); } |
25 | 25 |
26 private: | 26 private: |
27 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 27 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
28 }; | 28 }; |
29 | 29 |
30 void StyleEngineTest::SetUp() | 30 void StyleEngineTest::SetUp() |
31 { | 31 { |
32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 32 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
33 } | 33 } |
34 | 34 |
(...skipping 25 matching lines...) Loading... |
60 document().view()->updateAllLifecyclePhases(); | 60 document().view()->updateAllLifecyclePhases(); |
61 | 61 |
62 unsigned afterCount = styleEngine().styleForElementCount(); | 62 unsigned afterCount = styleEngine().styleForElementCount(); |
63 EXPECT_EQ(1u, afterCount - beforeCount); | 63 EXPECT_EQ(1u, afterCount - beforeCount); |
64 | 64 |
65 ASSERT_TRUE(t1->computedStyle()); | 65 ASSERT_TRUE(t1->computedStyle()); |
66 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS
PropertyColor)); | 66 EXPECT_EQ(makeRGB(0, 128, 0), t1->computedStyle()->visitedDependentColor(CSS
PropertyColor)); |
67 } | 67 } |
68 | 68 |
69 } // namespace blink | 69 } // namespace blink |
OLD | NEW |