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" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 *shadowRoot, ".a ::content span { background: green}"), | 290 *shadowRoot, ".a ::content span { background: green}"), |
291 RuleSetInvalidationFullRecalc); | 291 RuleSetInvalidationFullRecalc); |
292 EXPECT_EQ(scheduleInvalidationsForRules( | 292 EXPECT_EQ(scheduleInvalidationsForRules( |
293 *shadowRoot, ".a /deep/ span { background: green}"), | 293 *shadowRoot, ".a /deep/ span { background: green}"), |
294 RuleSetInvalidationFullRecalc); | 294 RuleSetInvalidationFullRecalc); |
295 EXPECT_EQ(scheduleInvalidationsForRules( | 295 EXPECT_EQ(scheduleInvalidationsForRules( |
296 *shadowRoot, ".a::shadow span { background: green}"), | 296 *shadowRoot, ".a::shadow span { background: green}"), |
297 RuleSetInvalidationFullRecalc); | 297 RuleSetInvalidationFullRecalc); |
298 } | 298 } |
299 | 299 |
| 300 TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { |
| 301 document().body()->setInnerHTML( |
| 302 "<style>div {}</style>" |
| 303 "<style id='sheet' media='(min-width: 200px)'>" |
| 304 " div {}" |
| 305 "</style>"); |
| 306 |
| 307 Element* styleElement = document().getElementById("sheet"); |
| 308 |
| 309 for (unsigned i = 0; i < 10; i++) { |
| 310 document().body()->removeChild(styleElement); |
| 311 document().view()->updateAllLifecyclePhases(); |
| 312 document().body()->appendChild(styleElement); |
| 313 document().view()->updateAllLifecyclePhases(); |
| 314 } |
| 315 |
| 316 EXPECT_TRUE(document().styleEngine().hasViewportDependentMediaQueries()); |
| 317 |
| 318 document().body()->removeChild(styleElement); |
| 319 document().view()->updateAllLifecyclePhases(); |
| 320 |
| 321 EXPECT_FALSE(document().styleEngine().hasViewportDependentMediaQueries()); |
| 322 } |
| 323 |
300 } // namespace blink | 324 } // namespace blink |
OLD | NEW |