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); |
334 } | 340 } |
335 | 341 |
336 TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { | 342 TEST_F(StyleEngineTest, HasViewportDependentMediaQueries) { |
337 GetDocument().body()->setInnerHTML( | 343 GetDocument().body()->setInnerHTML( |
338 "<style>div {}</style>" | 344 "<style>div {}</style>" |
339 "<style id='sheet' media='(min-width: 200px)'>" | 345 "<style id='sheet' media='(min-width: 200px)'>" |
340 " div {}" | 346 " div {}" |
341 "</style>"); | 347 "</style>"); |
342 | 348 |
343 Element* style_element = GetDocument().getElementById("sheet"); | 349 Element* style_element = GetDocument().getElementById("sheet"); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 "</style>" | 551 "</style>" |
546 "<div id='t1'></div>" | 552 "<div id='t1'></div>" |
547 "<span></span>"); | 553 "<span></span>"); |
548 | 554 |
549 GetStyleEngine().UpdateActiveStyle(); | 555 GetStyleEngine().UpdateActiveStyle(); |
550 EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); | 556 EXPECT_FALSE(GetDocument().ChildNeedsStyleInvalidation()); |
551 EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); | 557 EXPECT_FALSE(GetDocument().NeedsStyleInvalidation()); |
552 } | 558 } |
553 | 559 |
554 } // namespace blink | 560 } // namespace blink |
OLD | NEW |