Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerTest.cpp

Issue 2832603002: Only store previous clip rects for PaintLayers that support subsequences. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_FALSE(parent->SupportsSubsequenceCaching());
307 EXPECT_FALSE(child1->SupportsSubsequenceCaching());
308 EXPECT_TRUE(child2->SupportsSubsequenceCaching());
309 EXPECT_FALSE(grandchild1->SupportsSubsequenceCaching());
310
311 GetDocument()
312 .GetElementById("grandchild1")
313 ->setAttribute(HTMLNames::styleAttr, "isolation: isolate");
314 GetDocument().View()->UpdateAllLifecyclePhases();
315
316 EXPECT_FALSE(parent->SupportsSubsequenceCaching());
317 EXPECT_FALSE(child1->SupportsSubsequenceCaching());
318 EXPECT_TRUE(child2->SupportsSubsequenceCaching());
319 EXPECT_TRUE(grandchild1->SupportsSubsequenceCaching());
320 }
321
322 TEST_P(PaintLayerTest, SubsequenceCachingSVGRoot) {
323 SetBodyInnerHTML(
324 "<div id='parent' style='position: relative'>"
325 " <svg id='svgroot' style='position: relative'></svg>"
326 "</div>");
327
328 PaintLayer* svgroot = GetPaintLayerByElementId("svgroot");
329 EXPECT_TRUE(svgroot->SupportsSubsequenceCaching());
330 }
331
289 TEST_P(PaintLayerTest, HasDescendantWithClipPath) { 332 TEST_P(PaintLayerTest, HasDescendantWithClipPath) {
290 SetBodyInnerHTML( 333 SetBodyInnerHTML(
291 "<div id='parent' style='position:relative'>" 334 "<div id='parent' style='position:relative'>"
292 " <div id='clip-path' style='clip-path: circle(50px at 0 100px)'>" 335 " <div id='clip-path' style='clip-path: circle(50px at 0 100px)'>"
293 " </div>" 336 " </div>"
294 "</div>"); 337 "</div>");
295 PaintLayer* parent = GetPaintLayerByElementId("parent"); 338 PaintLayer* parent = GetPaintLayerByElementId("parent");
296 PaintLayer* clip_path = GetPaintLayerByElementId("clip-path"); 339 PaintLayer* clip_path = GetPaintLayerByElementId("clip-path");
297 340
298 EXPECT_TRUE(parent->HasDescendantWithClipPath()); 341 EXPECT_TRUE(parent->HasDescendantWithClipPath());
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 RefPtr<ComputedStyle> old_style = 1018 RefPtr<ComputedStyle> old_style =
976 ComputedStyle::Clone(target_object->StyleRef()); 1019 ComputedStyle::Clone(target_object->StyleRef());
977 ComputedStyle* new_style = target_object->MutableStyle(); 1020 ComputedStyle* new_style = target_object->MutableStyle();
978 new_style->SetHasCurrentTransformAnimation(); 1021 new_style->SetHasCurrentTransformAnimation();
979 target_paint_layer->UpdateTransform(old_style.Get(), *new_style); 1022 target_paint_layer->UpdateTransform(old_style.Get(), *new_style);
980 1023
981 EXPECT_NE(nullptr, target_paint_layer->Transform()); 1024 EXPECT_NE(nullptr, target_paint_layer->Transform());
982 } 1025 }
983 1026
984 } // namespace blink 1027 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698