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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2729683002: Handle resize in PaintPropertyTreeBuilder::updateForObjectSizeAndLocation() (Closed)
Patch Set: Fix a typo (ScrollbarWithChange -> ScrollbarWidthChange) Created 3 years, 10 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/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 79b3fab9b93dc65391d72c4414519e730052fe7c..cecdb95c06cbeb13622c5175cc32a92ac58f7823 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -1043,7 +1043,7 @@ void PaintPropertyTreeBuilder::updatePaintOffset(
}
}
-void PaintPropertyTreeBuilder::updateForObjectLocation(
+void PaintPropertyTreeBuilder::updateForObjectLocationAndSize(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (object.isBoxModelObject()) {
@@ -1051,18 +1051,37 @@ void PaintPropertyTreeBuilder::updateForObjectLocation(
updatePaintOffsetTranslation(toLayoutBoxModelObject(object), context);
}
- if (object.paintOffset() == context.current.paintOffset)
- return;
-
- // Many paint properties depend on paint offset so we force an update of
- // the entire subtree on paint offset changes.
- context.forceSubtreeUpdate = true;
+ if (object.paintOffset() != context.current.paintOffset) {
+ // Many paint properties depend on paint offset so we force an update of
+ // the entire subtree on paint offset changes.
+ context.forceSubtreeUpdate = true;
- if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
- object.getMutableForPainting().setShouldDoFullPaintInvalidation(
- PaintInvalidationLocationChange);
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ object.getMutableForPainting().setShouldDoFullPaintInvalidation(
+ PaintInvalidationLocationChange);
+ }
+ object.getMutableForPainting().setPaintOffset(context.current.paintOffset);
}
- object.getMutableForPainting().setPaintOffset(context.current.paintOffset);
+
+ if (!object.isBox())
+ return;
+ const LayoutBox& box = toLayoutBox(object);
+ if (box.size() == box.previousSize())
+ return;
+
+ // The overflow clip paint property depends on the border box rect through
+ // overflowClipRect(). The border box rect's size equals the frame rect's
+ // size so we trigger a paint property update when the frame rect changes.
+ if (box.shouldClipOverflow() ||
+ // The used value of CSS clip may depend on size of the box, e.g. for
+ // clip: rect(auto auto auto -5px).
+ box.hasClip() ||
+ // Relative lengths (e.g., percentage values) in transform, perspective,
+ // transform-origin, and perspective-origin can depend on the size of the
+ // frame rect, so force a property update if it changes. TODO(pdr): We
+ // only need to update properties if there are relative lengths.
+ box.styleRef().hasTransform() || box.styleRef().hasPerspective())
+ box.getMutableForPainting().setNeedsPaintPropertyUpdate();
}
void PaintPropertyTreeBuilder::updatePropertiesForSelf(
@@ -1070,7 +1089,7 @@ void PaintPropertyTreeBuilder::updatePropertiesForSelf(
PaintPropertyTreeBuilderContext& context) {
// This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
// can change without needsPaintPropertyUpdate.
- updateForObjectLocation(object, context);
+ updateForObjectLocationAndSize(object, context);
#if DCHECK_IS_ON()
FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context);

Powered by Google App Engine
This is Rietveld 408576698