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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2229643002: Don't invalidate paint on background image change if it's obscured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@BackgroundObscured
Patch Set: - Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 6afb5f4d8739a566deca49491e37c711d15a3459..f260e4094fbd28f352e3bab0bd9ca71ea921bf11 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1484,7 +1484,8 @@ void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*)
if ((style()->borderImage().image() && style()->borderImage().image()->data() == image)
|| (style()->maskBoxImage().image() && style()->maskBoxImage().image()->data() == image)) {
setShouldDoFullPaintInvalidation();
- return;
+ } else if (!invalidatePaintOfImageLayers(image, style()->backgroundLayers())) {
+ invalidatePaintOfImageLayers(image, style()->maskLayers());
}
ShapeValue* shapeOutsideValue = style()->shapeOutside();
chrishtr 2016/08/09 16:05:17 I guess you're fixing a bug also that this code di
Xianzhu 2016/08/09 18:51:48 There might be a bug if background and shape-outsi
@@ -1495,9 +1496,6 @@ void LayoutBox::imageChanged(WrappedImagePtr image, const IntRect*)
markShapeOutsideDependentsForLayout();
}
}
-
- if (!invalidatePaintOfLayerRectsForImage(image, style()->backgroundLayers(), true))
- invalidatePaintOfLayerRectsForImage(image, style()->maskLayers(), false);
}
ResourcePriority LayoutBox::computeResourcePriority() const
@@ -1525,21 +1523,27 @@ ResourcePriority LayoutBox::computeResourcePriority() const
return ResourcePriority(isVisible ? ResourcePriority::Visible : ResourcePriority::NotVisible, screenArea);
}
-bool LayoutBox::invalidatePaintOfLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground)
+bool LayoutBox::invalidatePaintOfImageLayers(WrappedImagePtr image, const FillLayer& layers)
{
- if (drawingBackground && (isDocumentElement() || backgroundStolenForBeingBody()))
+ bool isBackground = &layers == &styleRef().backgroundLayers();
eae 2016/08/09 14:41:48 NIT: Comparing references like this is a little od
Xianzhu 2016/08/09 18:51:48 We have FillLayer::operator== that compares the va
+ if (isBackground && (isDocumentElement() || backgroundStolenForBeingBody()))
Stephen Chennney 2016/08/09 14:22:31 if (isBackground) { if (isDocumentElement() || .
Xianzhu 2016/08/09 18:51:48 Done.
return false;
+
+ if (isBackground) {
+ invalidateBackgroundObscurationStatus();
+ if (backgroundIsKnownToBeObscured())
+ return false;
+ }
+
for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->next()) {
if (curLayer->image() && image == curLayer->image()->data()) {
bool maybeAnimated = curLayer->image()->cachedImage() && curLayer->image()->cachedImage()->getImage() && curLayer->image()->cachedImage()->getImage()->maybeAnimated();
- if (maybeAnimated && drawingBackground)
+ if (maybeAnimated && isBackground) {
setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull);
- else
+ } else {
setShouldDoFullPaintInvalidation();
-
- if (drawingBackground)
- invalidateBackgroundObscurationStatus();
- return true;
+ return true;
+ }
}
}
return false;

Powered by Google App Engine
This is Rietveld 408576698