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

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

Issue 2729683002: Handle resize in PaintPropertyTreeBuilder::updateForObjectSizeAndLocation() (Closed)
Patch Set: - 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..a67e8e5d94f95ebe08e0e8f56cf528dd8ea7529a 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::updateForObjectSizeAndLocation(
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;
+ if (object.isBox()) {
+ const LayoutBox& box = toLayoutBox(object);
+ if (box.size() != box.previousSize() &&
+ // 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.
+ (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();
+ }
- // 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);
}
void PaintPropertyTreeBuilder::updatePropertiesForSelf(
@@ -1070,7 +1089,7 @@ void PaintPropertyTreeBuilder::updatePropertiesForSelf(
PaintPropertyTreeBuilderContext& context) {
// This is not in FindObjectPropertiesNeedingUpdateScope because paint offset
// can change without needsPaintPropertyUpdate.
pdr. 2017/03/01 23:38:38 Nit: can you mention size changing in this comment
- updateForObjectLocation(object, context);
+ updateForObjectSizeAndLocation(object, context);
#if DCHECK_IS_ON()
FindObjectPropertiesNeedingUpdateScope checkNeedsUpdateScope(object, context);

Powered by Google App Engine
This is Rietveld 408576698