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

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: x 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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 } 1414 }
1415 1415
1416 StyleDifference LayoutObject::adjustStyleDifference(StyleDifference diff) const 1416 StyleDifference LayoutObject::adjustStyleDifference(StyleDifference diff) const
1417 { 1417 {
1418 if (diff.transformChanged() && isSVG()) { 1418 if (diff.transformChanged() && isSVG()) {
1419 // Skip a full layout for transforms at the html/svg boundary which do n ot affect sizes inside SVG. 1419 // Skip a full layout for transforms at the html/svg boundary which do n ot affect sizes inside SVG.
1420 if (!isSVGRoot()) 1420 if (!isSVGRoot())
1421 diff.setNeedsFullLayout(); 1421 diff.setNeedsFullLayout();
1422 } 1422 }
1423 1423
1424 // If transform changed, and the layer does not paint into its own separate backing, then we need to invalidate paints. 1424 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
1425 if (diff.transformChanged()) { 1425 // Text nodes share style with their parents but the checked styles don' t apply to them,
1426 // Text nodes share style with their parents but transforms don't apply to them,
1427 // hence the !isText() check. 1426 // hence the !isText() check.
1428 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()- >hasStyleDeterminedDirectCompositingReasons())) 1427 if (!isText()
1429 diff.setNeedsPaintInvalidationSubtree(); 1428 && (diff.transformChanged() || diff.opacityChanged() || diff.zIndexC hanged() || diff.filterChanged() || diff.backdropFilterChanged())) {
1430 } 1429 // We don't need to invalidate paint of objects on SPv2 when only pa int property or
1430 // paint order change. Mark the painting layer needing repaint for c hanged paint
1431 // property or paint order. Raster invalidation will be issued if ne eded during paint.
1432 ObjectPaintInvalidator(*this).slowSetPaintingLayerNeedsRepaint();
1433 }
1434 } else {
1435 // If transform changed, and the layer does not paint into its own separ ate backing, then we need to invalidate paints.
1436 if (diff.transformChanged()) {
1437 // Text nodes share style with their parents but transforms don't ap ply to them,
1438 // hence the !isText() check.
1439 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->laye r()->hasStyleDeterminedDirectCompositingReasons()))
1440 diff.setNeedsPaintInvalidationSubtree();
1441 }
1431 1442
1432 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to invalidate paints (also 1443 // If opacity or zIndex changed, and the layer does not paint into its o wn separate backing, then we need to invalidate paints (also
1433 // ignoring text nodes) 1444 // ignoring text nodes)
1434 if (diff.opacityChanged() || diff.zIndexChanged()) { 1445 if (diff.opacityChanged() || diff.zIndexChanged()) {
1435 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->layer()- >hasStyleDeterminedDirectCompositingReasons())) 1446 if (!isText() && (!hasLayer() || !toLayoutBoxModelObject(this)->laye r()->hasStyleDeterminedDirectCompositingReasons()))
1436 diff.setNeedsPaintInvalidationSubtree(); 1447 diff.setNeedsPaintInvalidationSubtree();
1437 } 1448 }
1438 1449
1439 // 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. 1450 // 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.
1440 if (diff.filterChanged() && hasLayer()) { 1451 if (diff.filterChanged() && hasLayer()) {
1441 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); 1452 PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
1442 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithFilters()) 1453 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->p aintsWithFilters())
1443 diff.setNeedsPaintInvalidationSubtree(); 1454 diff.setNeedsPaintInvalidationSubtree();
1444 } 1455 }
1445 1456
1446 // 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. 1457 // 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.
1447 if (diff.backdropFilterChanged() && hasLayer()) { 1458 if (diff.backdropFilterChanged() && hasLayer()) {
1448 PaintLayer* layer = toLayoutBoxModelObject(this)->layer(); 1459 PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
1449 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint sWithBackdropFilters()) 1460 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->p aintsWithBackdropFilters())
1450 diff.setNeedsPaintInvalidationSubtree(); 1461 diff.setNeedsPaintInvalidationSubtree();
1462 }
1451 } 1463 }
1452 1464
1453 // Optimization: for decoration/color property changes, invalidation is only needed if we have style or text affected by these properties. 1465 // Optimization: for decoration/color property changes, invalidation is only needed if we have style or text affected by these properties.
1454 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) { 1466 if (diff.textDecorationOrColorChanged() && !diff.needsPaintInvalidation()) {
1455 if (style()->hasBorder() || style()->hasOutline() 1467 if (style()->hasBorder() || style()->hasOutline()
1456 || style()->hasBackgroundRelatedColorReferencingCurrentColor() 1468 || style()->hasBackgroundRelatedColorReferencingCurrentColor()
1457 // Skip any text nodes that do not contain text boxes. Whitespace ca nnot be 1469 // Skip any text nodes that do not contain text boxes. Whitespace ca nnot be
1458 // skipped or we will miss invalidating decorations (e.g., underline s). 1470 // skipped or we will miss invalidating decorations (e.g., underline s).
1459 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()) 1471 || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes())
1460 // Caret is painted in text color. 1472 // Caret is painted in text color.
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 const blink::LayoutObject* root = object1; 3245 const blink::LayoutObject* root = object1;
3234 while (root->parent()) 3246 while (root->parent())
3235 root = root->parent(); 3247 root = root->parent();
3236 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3248 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3237 } else { 3249 } else {
3238 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3250 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3239 } 3251 }
3240 } 3252 }
3241 3253
3242 #endif 3254 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698