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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 478433002: Avoid RenderObject::paintInvalidationForWholeRenderer() if possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: TestExpectations Created 6 years, 4 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 | Annotate | Revision Log
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e) 141 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e)
142 { 142 {
143 RenderStyle* oldStyle = style(); 143 RenderStyle* oldStyle = style();
144 if (oldStyle) { 144 if (oldStyle) {
145 // The background of the root element or the body element could propagat e up to 145 // The background of the root element or the body element could propagat e up to
146 // the canvas. Just dirty the entire canvas when our style changes subst antially. 146 // the canvas. Just dirty the entire canvas when our style changes subst antially.
147 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node() 147 if ((diff.needsPaintInvalidation() || diff.needsLayout()) && node()
148 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { 148 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) {
149 view()->paintInvalidationForWholeRenderer(); 149 view()->setShouldDoFullPaintInvalidation(true);
150 150
151 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground()) 151 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground())
152 view()->compositor()->setNeedsUpdateFixedBackground(); 152 view()->compositor()->setNeedsUpdateFixedBackground();
153 } 153 }
154 154
155 // When a layout hint happens and an object's position style changes, we have to do a layout 155 // When a layout hint happens and an object's position style changes, we have to do a layout
156 // to dirty the render tree using the old position value now. 156 // to dirty the render tree using the old position value now.
157 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { 157 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) {
158 markContainingBlocksForLayout(); 158 markContainingBlocksForLayout();
159 if (oldStyle->position() == StaticPosition) 159 if (oldStyle->position() == StaticPosition)
160 paintInvalidationForWholeRenderer(); 160 setShouldDoFullPaintInvalidation(true);
161 else if (newStyle.hasOutOfFlowPosition()) 161 else if (newStyle.hasOutOfFlowPosition())
162 parent()->setChildNeedsLayout(); 162 parent()->setChildNeedsLayout();
163 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) 163 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition())
164 removeFloatingOrPositionedChildFromBlockLists(); 164 removeFloatingOrPositionedChildFromBlockLists();
165 } 165 }
166 // FIXME: This branch runs when !oldStyle, which means that layout was never called 166 // FIXME: This branch runs when !oldStyle, which means that layout was never called
167 // so what's the point in invalidating the whole view that we never painted? 167 // so what's the point in invalidating the whole view that we never painted?
168 } else if (isBody()) { 168 } else if (isBody()) {
169 view()->paintInvalidationForWholeRenderer(); 169 view()->setShouldDoFullPaintInvalidation(true);
170 } 170 }
171 171
172 RenderBoxModelObject::styleWillChange(diff, newStyle); 172 RenderBoxModelObject::styleWillChange(diff, newStyle);
173 } 173 }
174 174
175 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle ) 175 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle )
176 { 176 {
177 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle, 177 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle,
178 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal 178 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
179 // writing mode value before style change here. 179 // writing mode value before style change here.
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 1464
1465 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) 1465 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*)
1466 { 1466 {
1467 if (!parent()) 1467 if (!parent())
1468 return; 1468 return;
1469 1469
1470 AllowPaintInvalidationScope scoper(frameView()); 1470 AllowPaintInvalidationScope scoper(frameView());
1471 1471
1472 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) || 1472 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) ||
1473 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat a() == image)) { 1473 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat a() == image)) {
1474 paintInvalidationForWholeRenderer(); 1474 setShouldDoFullPaintInvalidation(true);
1475 return; 1475 return;
1476 } 1476 }
1477 1477
1478 ShapeValue* shapeOutsideValue = style()->shapeOutside(); 1478 ShapeValue* shapeOutsideValue = style()->shapeOutside();
1479 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) { 1479 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) {
1480 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); 1480 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty();
1481 markShapeOutsideDependentsForLayout(); 1481 markShapeOutsideDependentsForLayout();
1482 } 1482 }
1483 1483
1484 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(), true)) 1484 if (!paintInvalidationLayerRectsForImage(image, style()->backgroundLayers(), true))
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 layerRenderer = this; 1516 layerRenderer = this;
1517 rendererRect = borderBoxRect(); 1517 rendererRect = borderBoxRect();
1518 } 1518 }
1519 } 1519 }
1520 1520
1521 BackgroundImageGeometry geometry; 1521 BackgroundImageGeometry geometry;
1522 layerRenderer->calculateBackgroundImageGeometry(0, *curLayer, render erRect, geometry); 1522 layerRenderer->calculateBackgroundImageGeometry(0, *curLayer, render erRect, geometry);
1523 if (geometry.hasNonLocalGeometry()) { 1523 if (geometry.hasNonLocalGeometry()) {
1524 // Rather than incur the costs of computing the paintContainer f or renderers with fixed backgrounds 1524 // Rather than incur the costs of computing the paintContainer f or renderers with fixed backgrounds
1525 // in order to get the right destRect, just issue paint invalida tions for the entire renderer. 1525 // in order to get the right destRect, just issue paint invalida tions for the entire renderer.
1526 layerRenderer->paintInvalidationForWholeRenderer(); 1526 layerRenderer->setShouldDoFullPaintInvalidation(true);
1527 return true; 1527 return true;
1528 } 1528 }
1529 1529
1530 layerRenderer->invalidatePaintRectangle(geometry.destRect()); 1530 layerRenderer->invalidatePaintRectangle(geometry.destRect());
1531 if (geometry.destRect() == rendererRect) 1531 if (geometry.destRect() == rendererRect)
1532 return true; 1532 return true;
1533 } 1533 }
1534 } 1534 }
1535 return false; 1535 return false;
1536 } 1536 }
(...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4696 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4697 { 4697 {
4698 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); 4698 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor);
4699 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4699 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4700 ASSERT(hasBackground == style.hasBackground()); 4700 ASSERT(hasBackground == style.hasBackground());
4701 hasBorder = style.hasBorder(); 4701 hasBorder = style.hasBorder();
4702 hasAppearance = style.hasAppearance(); 4702 hasAppearance = style.hasAppearance();
4703 } 4703 }
4704 4704
4705 } // namespace blink 4705 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698