| 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/paint/PaintLayer.h" | 5 #include "core/paint/PaintLayer.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
| 9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 PaintLayer* parent = GetPaintLayerByElementId("non-stacking-parent"); | 279 PaintLayer* parent = GetPaintLayerByElementId("non-stacking-parent"); |
| 280 | 280 |
| 281 EXPECT_TRUE(parent->HasNonIsolatedDescendantWithBlendMode()); | 281 EXPECT_TRUE(parent->HasNonIsolatedDescendantWithBlendMode()); |
| 282 EXPECT_TRUE(stacking_parent->HasNonIsolatedDescendantWithBlendMode()); | 282 EXPECT_TRUE(stacking_parent->HasNonIsolatedDescendantWithBlendMode()); |
| 283 EXPECT_FALSE(stacking_grandparent->HasNonIsolatedDescendantWithBlendMode()); | 283 EXPECT_FALSE(stacking_grandparent->HasNonIsolatedDescendantWithBlendMode()); |
| 284 | 284 |
| 285 EXPECT_FALSE(parent->HasDescendantWithClipPath()); | 285 EXPECT_FALSE(parent->HasDescendantWithClipPath()); |
| 286 EXPECT_TRUE(parent->HasVisibleDescendant()); | 286 EXPECT_TRUE(parent->HasVisibleDescendant()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 TEST_P(PaintLayerTest, SubsequenceCachingStackingContexts) { |
| 290 SetBodyInnerHTML( |
| 291 "<div id='parent' style='position:relative'>" |
| 292 " <div id='child1' style='position: relative'>" |
| 293 " <div id='grandchild1' style='position: relative'>" |
| 294 " <div style='position: relative'></div>" |
| 295 " </div>" |
| 296 " </div>" |
| 297 " <div id='child2' style='isolation: isolate'>" |
| 298 " <div style='position: relative'></div>" |
| 299 " </div>" |
| 300 "</div>"); |
| 301 PaintLayer* parent = GetPaintLayerByElementId("parent"); |
| 302 PaintLayer* child1 = GetPaintLayerByElementId("child1"); |
| 303 PaintLayer* child2 = GetPaintLayerByElementId("child2"); |
| 304 PaintLayer* grandchild1 = GetPaintLayerByElementId("grandchild1"); |
| 305 |
| 306 EXPECT_TRUE(parent->HasDescendantThatSupportsSubsequenceCaching()); |
| 307 EXPECT_FALSE(child1->HasDescendantThatSupportsSubsequenceCaching()); |
| 308 EXPECT_FALSE(child2->HasDescendantThatSupportsSubsequenceCaching()); |
| 309 EXPECT_FALSE(grandchild1->HasDescendantThatSupportsSubsequenceCaching()); |
| 310 |
| 311 EXPECT_FALSE(parent->SupportsSubsequenceCaching()); |
| 312 EXPECT_FALSE(child1->SupportsSubsequenceCaching()); |
| 313 EXPECT_TRUE(child2->SupportsSubsequenceCaching()); |
| 314 EXPECT_FALSE(grandchild1->SupportsSubsequenceCaching()); |
| 315 |
| 316 GetDocument() |
| 317 .GetElementById("grandchild1") |
| 318 ->setAttribute(HTMLNames::styleAttr, "isolation: isolate"); |
| 319 GetDocument().View()->UpdateAllLifecyclePhases(); |
| 320 |
| 321 EXPECT_FALSE(grandchild1->HasDescendantThatSupportsSubsequenceCaching()); |
| 322 EXPECT_TRUE(child1->HasDescendantThatSupportsSubsequenceCaching()); |
| 323 |
| 324 EXPECT_FALSE(parent->SupportsSubsequenceCaching()); |
| 325 EXPECT_FALSE(child1->SupportsSubsequenceCaching()); |
| 326 EXPECT_TRUE(child2->SupportsSubsequenceCaching()); |
| 327 EXPECT_TRUE(grandchild1->SupportsSubsequenceCaching()); |
| 328 } |
| 329 |
| 330 TEST_P(PaintLayerTest, SubsequenceCachingSVGRoot) { |
| 331 SetBodyInnerHTML( |
| 332 "<div id='parent' style='position: relative'>" |
| 333 " <svg id='svgroot' style='position: relative'></svg>" |
| 334 "</div>"); |
| 335 |
| 336 PaintLayer* parent = GetPaintLayerByElementId("parent"); |
| 337 PaintLayer* svgroot = GetPaintLayerByElementId("svgroot"); |
| 338 EXPECT_TRUE(parent->HasDescendantThatSupportsSubsequenceCaching()); |
| 339 EXPECT_FALSE(svgroot->HasDescendantThatSupportsSubsequenceCaching()); |
| 340 } |
| 341 |
| 289 TEST_P(PaintLayerTest, HasDescendantWithClipPath) { | 342 TEST_P(PaintLayerTest, HasDescendantWithClipPath) { |
| 290 SetBodyInnerHTML( | 343 SetBodyInnerHTML( |
| 291 "<div id='parent' style='position:relative'>" | 344 "<div id='parent' style='position:relative'>" |
| 292 " <div id='clip-path' style='clip-path: circle(50px at 0 100px)'>" | 345 " <div id='clip-path' style='clip-path: circle(50px at 0 100px)'>" |
| 293 " </div>" | 346 " </div>" |
| 294 "</div>"); | 347 "</div>"); |
| 295 PaintLayer* parent = GetPaintLayerByElementId("parent"); | 348 PaintLayer* parent = GetPaintLayerByElementId("parent"); |
| 296 PaintLayer* clip_path = GetPaintLayerByElementId("clip-path"); | 349 PaintLayer* clip_path = GetPaintLayerByElementId("clip-path"); |
| 297 | 350 |
| 298 EXPECT_TRUE(parent->HasDescendantWithClipPath()); | 351 EXPECT_TRUE(parent->HasDescendantWithClipPath()); |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 RefPtr<ComputedStyle> old_style = | 1028 RefPtr<ComputedStyle> old_style = |
| 976 ComputedStyle::Clone(target_object->StyleRef()); | 1029 ComputedStyle::Clone(target_object->StyleRef()); |
| 977 ComputedStyle* new_style = target_object->MutableStyle(); | 1030 ComputedStyle* new_style = target_object->MutableStyle(); |
| 978 new_style->SetHasCurrentTransformAnimation(); | 1031 new_style->SetHasCurrentTransformAnimation(); |
| 979 target_paint_layer->UpdateTransform(old_style.Get(), *new_style); | 1032 target_paint_layer->UpdateTransform(old_style.Get(), *new_style); |
| 980 | 1033 |
| 981 EXPECT_NE(nullptr, target_paint_layer->Transform()); | 1034 EXPECT_NE(nullptr, target_paint_layer->Transform()); |
| 982 } | 1035 } |
| 983 | 1036 |
| 984 } // namespace blink | 1037 } // namespace blink |
| OLD | NEW |