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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 2307623002: [SPv2] Defer decision of raster invalidation after paint for changes z-index, transform, etc. (Closed)
Patch Set: All paint property Created 4 years, 3 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 } 1413 }
1414 1414
1415 StyleDifference LayoutObject::adjustStyleDifference(StyleDifference diff) const 1415 StyleDifference LayoutObject::adjustStyleDifference(StyleDifference diff) const
1416 { 1416 {
1417 if (diff.transformChanged() && isSVG()) { 1417 if (diff.transformChanged() && isSVG()) {
1418 // Skip a full layout for transforms at the html/svg boundary which do n ot affect sizes inside SVG. 1418 // Skip a full layout for transforms at the html/svg boundary which do n ot affect sizes inside SVG.
1419 if (!isSVGRoot()) 1419 if (!isSVGRoot())
1420 diff.setNeedsFullLayout(); 1420 diff.setNeedsFullLayout();
1421 } 1421 }
1422 1422
1423 // If transform changed, and the layer does not paint into its own separate backing, then we need to invalidate paints. 1423 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1424 if (diff.transformChanged()) { 1424 if (diff.transformChanged() || diff.opacityChanged() || diff.zIndexChang ed() || diff.filterChanged() || diff.backdropFilterChanged()) {
1425 // Text nodes share style with their parents but transforms don't apply to them, 1425 // We don't need to invalidate paint of objects on SPv2 when only pa int property or
1426 // hence the !isText() check. 1426 // paint order change. Mark the painting layer needing repaint for c hanged paint
1427 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()- >hasStyleDeterminedDirectCompositingReasons())) 1427 // property or paint order. Raster invalidation will be issued if ne eded during paint.
1428 diff.setNeedsPaintInvalidationSubtree(); 1428 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint();
1429 } 1429 }
1430 } else {
1431 // If transform changed, and the layer does not paint into its own separ ate backing, then we need to invalidate paints.
1432 if (diff.transformChanged()) {
1433 // Text nodes share style with their parents but transforms don't ap ply to them,
1434 // hence the !isText() check.
1435 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->laye r()->hasStyleDeterminedDirectCompositingReasons()))
1436 diff.setNeedsPaintInvalidationSubtree();
1437 }
1430 1438
1431 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to invalidate paints (also 1439 // If opacity or zIndex changed, and the layer does not paint into its o wn separate backing, then we need to invalidate paints (also
1432 // ignoring text nodes) 1440 // ignoring text nodes)
1433 if (diff.opacityChanged() || diff.zIndexChanged()) { 1441 if (diff.opacityChanged() || diff.zIndexChanged()) {
1434 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()- >hasStyleDeterminedDirectCompositingReasons())) 1442 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->laye r()->hasStyleDeterminedDirectCompositingReasons()))
1435 diff.setNeedsPaintInvalidationSubtree(); 1443 diff.setNeedsPaintInvalidationSubtree();
1436 } 1444 }
1437 1445
1438 // If filter changed, and the layer does not paint into its own separate bac king or it paints with filters, then we need to invalidate paints. 1446 // If filter changed, and the layer does not paint into its own separate backing or it paints with filters, then we need to invalidate paints.
1439 if (diff.filterChanged() && hasLayer()) { 1447 if (diff.filterChanged() && hasLayer()) {
1440 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); 1448 PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
1441 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters()) 1449 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->p aintsWithFilters())
1442 diff.setNeedsPaintInvalidationSubtree(); 1450 diff.setNeedsPaintInvalidationSubtree();
1443 } 1451 }
1444 1452
1445 // If backdrop filter changed, and the layer does not paint into its own sep arate backing or it paints with filters, then we need to invalidate paints. 1453 // If backdrop filter changed, and the layer does not paint into its own separate backing or it paints with filters, then we need to invalidate paints.
1446 if (diff.backdropFilterChanged() && hasLayer()) { 1454 if (diff.backdropFilterChanged() && hasLayer()) {
1447 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); 1455 PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
1448 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithBackdropFilters()) 1456 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->p aintsWithBackdropFilters())
1449 diff.setNeedsPaintInvalidationSubtree(); 1457 diff.setNeedsPaintInvalidationSubtree();
1458 }
1450 } 1459 }
1451 1460
1452 // Optimization: for decoration/color property changes, invalidation is only needed if we have style or text affected by these properties. 1461 // Optimization: for decoration/color property changes, invalidation is only needed if we have style or text affected by these properties.
1453 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) { 1462 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) {
1454 if (style()->hasBorder() || style()->hasOutline() 1463 if (style()->hasBorder() || style()->hasOutline()
1455 || style()->hasBackgroundRelatedColorReferencingCurrentColor() 1464 || style()->hasBackgroundRelatedColorReferencingCurrentColor()
1456 // Skip any text nodes that do not contain text boxes. Whitespace ca nnot be 1465 // Skip any text nodes that do not contain text boxes. Whitespace ca nnot be
1457 // skipped or we will miss invalidating decorations (e.g., underline s). 1466 // skipped or we will miss invalidating decorations (e.g., underline s).
1458 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) 1467 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes())
1459 // Caret is painted in text color. 1468 // Caret is painted in text color.
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
3232 const blink::LayoutObject* root = object1; 3241 const blink::LayoutObject* root = object1;
3233 while (root->parent()) 3242 while (root->parent())
3234 root = root->parent(); 3243 root = root->parent();
3235 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3244 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3236 } else { 3245 } else {
3237 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3246 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3238 } 3247 }
3239 } 3248 }
3240 3249
3241 #endif 3250 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698