| 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 <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "core/css/CSSRuleList.h" | 9 #include "core/css/CSSRuleList.h" |
| 10 #include "core/css/CSSStyleRule.h" | 10 #include "core/css/CSSStyleRule.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 host->attachShadow(ToScriptStateForMainWorld(GetDocument().GetFrame()), | 324 host->attachShadow(ToScriptStateForMainWorld(GetDocument().GetFrame()), |
| 325 init, ASSERT_NO_EXCEPTION); | 325 init, ASSERT_NO_EXCEPTION); |
| 326 ASSERT_TRUE(shadow_root); | 326 ASSERT_TRUE(shadow_root); |
| 327 | 327 |
| 328 shadow_root->setInnerHTML("<div></div><div class=a></div><div></div>"); | 328 shadow_root->setInnerHTML("<div></div><div class=a></div><div></div>"); |
| 329 GetDocument().View()->UpdateAllLifecyclePhases(); | 329 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 330 | 330 |
| 331 EXPECT_EQ(ScheduleInvalidationsForRules( | 331 EXPECT_EQ(ScheduleInvalidationsForRules( |
| 332 *shadow_root, ".a ::content span { background: green}"), | 332 *shadow_root, ".a ::content span { background: green}"), |
| 333 kRuleSetInvalidationFullRecalc); | 333 kRuleSetInvalidationFullRecalc); |
| 334 EXPECT_EQ(ScheduleInvalidationsForRules( | |
| 335 *shadow_root, ".a /deep/ span { background: green}"), | |
| 336 kRuleSetInvalidationFullRecalc); | |
| 337 EXPECT_EQ(ScheduleInvalidationsForRules( | |
| 338 *shadow_root, ".a::shadow span { background: green}"), | |
| 339 kRuleSetInvalidationFullRecalc); | |
| 340 } | 334 } |
| 341 | 335 |
| 342 TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { | 336 TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { |
| 343 GetDocument().body()->setInnerHTML( | 337 GetDocument().body()->setInnerHTML( |
| 344 "<style>div {}</style>" | 338 "<style>div {}</style>" |
| 345 "<style id='sheet' media='(min-width: 200px)'>" | 339 "<style id='sheet' media='(min-width: 200px)'>" |
| 346 " div {}" | 340 " div {}" |
| 347 "</style>"); | 341 "</style>"); |
| 348 | 342 |
| 349 Element* style_element = GetDocument().getElementById("sheet"); | 343 Element* style_element = GetDocument().getElementById("sheet"); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 "</style>" | 545 "</style>" |
| 552 "<div id='t1'></div>" | 546 "<div id='t1'></div>" |
| 553 "<span></span>"); | 547 "<span></span>"); |
| 554 | 548 |
| 555 GetStyleEngine().UpdateActiveStyle(); | 549 GetStyleEngine().UpdateActiveStyle(); |
| 556 EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); | 550 EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); |
| 557 EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); | 551 EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); |
| 558 } | 552 } |
| 559 | 553 |
| 560 } // namespace blink | 554 } // namespace blink |
| OLD | NEW |