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

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 312193004: Don't force full repaint on size change in style (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase; Update test expectations Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/style/RenderStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderObject.cpp
diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
index 08b70dbe070f06f15d77a1cd068d9e6208867696..ee4dc15196e2df3e12ed93f9713bb0a509fd8127 100644
--- a/Source/core/rendering/RenderObject.cpp
+++ b/Source/core/rendering/RenderObject.cpp
@@ -1590,8 +1590,8 @@ const char* RenderObject::invalidationReasonToString(InvalidationReason reason)
switch (reason) {
case InvalidationIncremental:
return "incremental";
- case InvalidationSelfLayout:
- return "self layout";
+ case InvalidationFull:
+ return "full";
case InvalidationBorderFitLines:
return "border fit lines";
case InvalidationBorderRadius:
@@ -1641,7 +1641,7 @@ static PassRefPtr<JSONValue> jsonObjectForOldAndNewRects(const LayoutRect& oldRe
return object.release();
}
-bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObject* paintInvalidationContainer, bool wasSelfLayout,
+bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObject* paintInvalidationContainer, bool shouldDoFullPaintInvalidation,
const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRect* newBoundsPtr, const LayoutPoint* newLocationPtr)
{
RenderView* v = view();
@@ -1658,7 +1658,7 @@ bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
"object", this->debugName().ascii(),
"info", TracedValue::fromJSONValue(jsonObjectForOldAndNewRects(oldBounds, newBounds)));
- InvalidationReason invalidationReason = wasSelfLayout ? InvalidationSelfLayout : InvalidationIncremental;
+ InvalidationReason invalidationReason = shouldDoFullPaintInvalidation ? InvalidationFull : InvalidationIncremental;
// Presumably a background or a border exists if border-fit:lines was specified.
if (invalidationReason == InvalidationIncremental && style()->borderFit() == BorderFitLines)
@@ -1710,32 +1710,22 @@ bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
return true;
}
- LayoutUnit deltaLeft = newBounds.x() - oldBounds.x();
- if (deltaLeft > 0)
esprehn 2014/06/20 08:10:50 Was this code even reachable before? If the locati
Xianzhu 2014/06/20 16:57:01 I think these code have never been reached (perhap
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height()), invalidationReason);
- else if (deltaLeft < 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height()), invalidationReason);
+ ASSERT(newBounds.location() == oldBounds.location());
- LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
- if (deltaRight > 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()), invalidationReason);
- else if (deltaRight < 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height()), invalidationReason);
+ LayoutUnit deltaWidth = newBounds.width() - oldBounds.width();
+ if (deltaWidth > 0)
+ invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.maxX(), newBounds.y(), deltaWidth, newBounds.height()), invalidationReason);
+ else if (deltaWidth < 0)
+ invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.maxX(), oldBounds.y(), -deltaWidth, oldBounds.height()), invalidationReason);
- LayoutUnit deltaTop = newBounds.y() - oldBounds.y();
- if (deltaTop > 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop), invalidationReason);
- else if (deltaTop < 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop), invalidationReason);
-
- LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY();
- if (deltaBottom > 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom), invalidationReason);
- else if (deltaBottom < 0)
- invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom), invalidationReason);
+ LayoutUnit deltaHeight = newBounds.height() - oldBounds.height();
+ if (deltaHeight > 0)
+ invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaHeight), invalidationReason);
+ else if (deltaHeight < 0)
+ invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaHeight), invalidationReason);
// FIXME: This is a limitation of our visual overflow being a single rectangle.
- if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->hasOutline())
+ if (!style()->hasBorder() && !style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->hasOutline())
return false;
// We didn't move, but we did change size. Invalidate the delta, which will consist of possibly
@@ -1743,8 +1733,8 @@ bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
RenderStyle* outlineStyle = outlineStyleForPaintInvalidation();
LayoutUnit outlineWidth = outlineStyle->outlineSize();
LayoutBoxExtent insetShadowExtent = style()->getBoxShadowInsetExtent();
- LayoutUnit width = absoluteValue(newBounds.width() - oldBounds.width());
- if (width) {
+ if (deltaWidth) {
+ LayoutUnit width = absoluteValue(deltaWidth);
LayoutUnit shadowLeft;
LayoutUnit shadowRight;
style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
@@ -1764,8 +1754,8 @@ bool RenderObject::invalidatePaintAfterLayoutIfNeeded(const RenderLayerModelObje
invalidatePaintUsingContainer(paintInvalidationContainer, pixelSnappedIntRect(rightRect), invalidationReason);
}
}
- LayoutUnit height = absoluteValue(newBounds.height() - oldBounds.height());
- if (height) {
+ if (deltaHeight) {
+ LayoutUnit height = absoluteValue(deltaHeight);
LayoutUnit shadowTop;
LayoutUnit shadowBottom;
style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/style/RenderStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698