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 64ef222d9b55c431bfa187e31fc6f6188c78b019..c06872338305f38627e16ca68b46f5110cef77b9 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintInvalidator.cpp |
@@ -74,7 +74,7 @@ static LayoutRect mapLocalRectToPaintInvalidationBacking( |
// For SVG, the input rect is in local SVG coordinates in which paint |
// offset doesn't apply. |
if (!object.isSVGChild()) |
- rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
+ rect.moveBy(FloatPoint(object.paintOffset())); |
Xianzhu
2017/01/06 17:24:39
This is just changed to a shorter form. They are a
|
// Use enclosingIntRect to ensure the final visual rect will cover the |
// rect in source coordinates no matter if the painting will use pixel |
// snapping. |
@@ -92,7 +92,7 @@ static LayoutRect mapLocalRectToPaintInvalidationBacking( |
// For non-root SVG, the input rect is in local SVG coordinates in which |
// paint offset doesn't apply. |
if (!object.isSVGChild()) { |
- rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
+ rect.moveBy(FloatPoint(object.paintOffset())); |
// Use enclosingIntRect to ensure the final visual rect will cover the |
// rect in source coordinates no matter if the painting will use pixel |
// snapping. |
@@ -111,12 +111,11 @@ static LayoutRect mapLocalRectToPaintInvalidationBacking( |
bool success = false; |
result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace( |
- rect, currentTreeState, containerContentsProperties.propertyTreeState, |
- success)); |
+ rect, currentTreeState, containerContentsProperties, success)); |
DCHECK(success); |
// Convert the result to the container's contents space. |
- result.moveBy(-containerContentsProperties.paintOffset); |
+ result.moveBy(-context.paintInvalidationContainer->paintOffset()); |
} |
object.adjustVisualRectForRasterEffects(result); |
@@ -165,7 +164,7 @@ LayoutPoint PaintInvalidator::computeLocationInBacking( |
FloatPoint point; |
if (object != context.paintInvalidationContainer) { |
- point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
+ point.moveBy(FloatPoint(object.paintOffset())); |
PropertyTreeState currentTreeState( |
context.treeBuilderContext.current.transform, |
@@ -179,14 +178,14 @@ LayoutPoint PaintInvalidator::computeLocationInBacking( |
bool success = false; |
point = m_geometryMapper |
- .mapRectToDestinationSpace( |
- FloatRect(point, FloatSize()), currentTreeState, |
- containerContentsProperties.propertyTreeState, success) |
+ .mapRectToDestinationSpace(FloatRect(point, FloatSize()), |
+ currentTreeState, |
+ containerContentsProperties, success) |
.location(); |
DCHECK(success); |
// Convert the result to the container's contents space. |
- point.moveBy(-containerContentsProperties.paintOffset); |
+ point.moveBy(-context.paintInvalidationContainer->paintOffset()); |
} |
PaintLayer::mapPointInPaintInvalidationContainerToBacking( |
@@ -339,8 +338,6 @@ void PaintInvalidator::updateContext(const LayoutObject& object, |
context.oldLocation = objectPaintInvalidator.previousLocationInBacking(); |
context.newVisualRect = computeVisualRectInBacking(object, context); |
context.newLocation = computeLocationInBacking(object, context); |
- context.oldPaintOffset = object.previousPaintOffset(); |
- context.newPaintOffset = context.treeBuilderContext.current.paintOffset; |
IntSize adjustment = object.scrollAdjustmentForPaintInvalidation( |
*context.paintInvalidationContainer); |
@@ -349,7 +346,6 @@ void PaintInvalidator::updateContext(const LayoutObject& object, |
object.getMutableForPainting().setPreviousVisualRect(context.newVisualRect); |
objectPaintInvalidator.setPreviousLocationInBacking(context.newLocation); |
- object.getMutableForPainting().setPreviousPaintOffset(context.newPaintOffset); |
} |
void PaintInvalidator::invalidatePaintIfNeeded( |
@@ -374,9 +370,18 @@ void PaintInvalidator::invalidatePaintIfNeeded( |
void PaintInvalidator::invalidatePaintIfNeeded( |
const LayoutObject& object, |
+ const LayoutPoint& oldPaintOffset, |
PaintInvalidatorContext& context) { |
object.getMutableForPainting().ensureIsReadyForPaintInvalidation(); |
+ DCHECK(context.treeBuilderContext.current.paintOffset == |
+ object.paintOffset()); |
+ if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
+ object.paintOffset() != oldPaintOffset) { |
+ object.getMutableForPainting().setShouldDoFullPaintInvalidation( |
+ PaintInvalidationLocationChange); |
+ } |
+ |
if (!context.forcedSubtreeInvalidationFlags && |
!object |
.shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState()) |
@@ -421,9 +426,7 @@ void PaintInvalidator::invalidatePaintIfNeeded( |
break; |
} |
- if (context.oldLocation != context.newLocation || |
- (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
- context.oldPaintOffset != context.newPaintOffset)) { |
+ if (context.oldLocation != context.newLocation) { |
context.forcedSubtreeInvalidationFlags |= |
PaintInvalidatorContext::ForcedSubtreeInvalidationChecking; |
} |