Index: third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
index d6f93077f10445e3e80dffc43128877addad0fd2..60252ff4a02304856f337cc4b1698eced313f759 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
@@ -35,14 +35,16 @@ static LayoutRect mapLocalRectToPaintInvalidationBacking(GeometryMapper& geometr |
if (object == context.paintInvalidationContainer) { |
result = LayoutRect(rect); |
} else { |
- rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
- |
- bool success = false; |
PropertyTreeState currentTreeState(context.treeBuilderContext.current.transform, context.treeBuilderContext.current.clip, context.treeBuilderContext.currentEffect); |
PropertyTreeState containerTreeState; |
- context.paintInvalidationContainer->objectPaintProperties()->getContentsProperties(containerTreeState); |
+ const ObjectPaintProperties* containerPaintProperties = context.paintInvalidationContainer->objectPaintProperties(); |
+ containerPaintProperties->getContentsProperties(containerTreeState); |
+ |
+ rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
+ bool success = false; |
result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(rect, currentTreeState, containerTreeState, success)); |
DCHECK(success); |
+ result.moveBy(-containerPaintProperties->localBorderBoxProperties()->paintOffset); |
} |
if (context.paintInvalidationContainer->layer()->groupedMapping()) |
@@ -195,6 +197,17 @@ void PaintInvalidator::invalidatePaintIfNeeded(FrameView& frameView, PaintInvali |
layoutView->sendMediaPositionChangeNotifications(visibleRect); |
} |
+static bool hasPercentageTransform(const ComputedStyle& style) |
+{ |
+ if (TransformOperation* translate = style.translate()) { |
+ if (translate->dependsOnBoxSize()) |
+ return true; |
+ } |
+ return style.transform().dependsOnBoxSize() |
+ || (style.transformOriginX() != Length(50, Percent) && style.transformOriginX().isPercentOrCalc()) |
+ || (style.transformOriginY() != Length(50, Percent) && style.transformOriginY().isPercentOrCalc()); |
+} |
+ |
Xianzhu
2016/09/13 17:42:33
This and the changes below are copied from LayoutB
|
void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& object, PaintInvalidatorContext& context) |
{ |
object.getMutableForPainting().ensureIsReadyForPaintInvalidation(); |
@@ -216,7 +229,8 @@ void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& object, Paint |
return; |
} |
- switch (object.invalidatePaintIfNeeded(context)) { |
+ PaintInvalidationReason reason = object.invalidatePaintIfNeeded(context); |
+ switch (reason) { |
case PaintInvalidationDelayedFull: |
m_pendingDelayedPaintInvalidations.append(&object); |
break; |
@@ -233,6 +247,19 @@ void PaintInvalidator::invalidatePaintIfNeeded(const LayoutObject& object, Paint |
if (context.oldLocation != context.newLocation) |
context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; |
+ // TODO(crbug.com/533277): This is a workaround for the bug. Remove when we detect paint offset change. |
+ if (reason != PaintInvalidationNone && hasPercentageTransform(object.styleRef())) |
+ context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; |
+ |
+ // TODO(crbug.com/490725): This is a workaround for the bug, to force descendant to update paint invalidation |
+ // rects on clipping change. |
+ if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() |
+ && context.oldBounds != context.newBounds |
+ // Note that isLayoutView() below becomes unnecessary after the launch of root layer scrolling. |
+ && (object.hasOverflowClip() || object.isLayoutView()) |
+ && !toLayoutBox(object).usesCompositedScrolling()) |
+ context.forcedSubtreeInvalidationFlags |= PaintInvalidatorContext::ForcedSubtreeInvalidationRectUpdate; |
+ |
object.getMutableForPainting().clearPaintInvalidationFlags(); |
} |