Commit cb0a2dd7 authored by wangxianzhu's avatar wangxianzhu Committed by Commit bot

Remove PaintInvalidatorContext::newVisualRect

Use LayoutObject::visualRect() instead.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2745793004
Cr-Commit-Position: refs/heads/master@{#456176}
parent bdbe2f86
......@@ -1198,18 +1198,19 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(
ObjectPaintInvalidator paintInvalidator(*this);
context.oldVisualRect = visualRect();
context.oldLocation = paintInvalidator.locationInBacking();
context.newVisualRect = paintInvalidationState.computeVisualRectInBacking();
context.newLocation = paintInvalidationState.computeLocationInBacking(
context.newVisualRect.location());
LayoutRect newVisualRect =
paintInvalidationState.computeVisualRectInBacking();
context.newLocation =
paintInvalidationState.computeLocationInBacking(newVisualRect.location());
IntSize adjustment =
scrollAdjustmentForPaintInvalidation(paintInvalidationContainer);
context.newLocation.move(adjustment);
context.newVisualRect.move(adjustment);
newVisualRect.move(adjustment);
adjustVisualRectForRasterEffects(context.newVisualRect);
adjustVisualRectForRasterEffects(newVisualRect);
setVisualRect(context.newVisualRect);
setVisualRect(newVisualRect);
paintInvalidator.setLocationInBacking(context.newLocation);
if (!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() &&
......
......@@ -105,7 +105,7 @@ PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason() {
LayoutSize oldBorderBoxSize = m_box.previousSize();
LayoutSize newBorderBoxSize = m_box.size();
bool borderBoxChanged = oldBorderBoxSize != newBorderBoxSize;
if (!borderBoxChanged && m_context.oldVisualRect == m_context.newVisualRect)
if (!borderBoxChanged && m_context.oldVisualRect == m_box.visualRect())
return PaintInvalidationNone;
// If either border box changed or bounds changed, and old or new border box
......@@ -116,7 +116,7 @@ PaintInvalidationReason BoxPaintInvalidator::computePaintInvalidationReason() {
// - visual overflows.
if (m_context.oldVisualRect !=
LayoutRect(m_context.oldLocation, oldBorderBoxSize) ||
m_context.newVisualRect !=
m_box.visualRect() !=
LayoutRect(m_context.newLocation, newBorderBoxSize)) {
return borderBoxChanged ? PaintInvalidationBorderBoxChange
: PaintInvalidationBoundsChange;
......@@ -254,7 +254,7 @@ PaintInvalidationReason BoxPaintInvalidator::invalidatePaintIfNeeded() {
if (m_box.isLayoutView() &&
!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
invalidated = incrementallyInvalidatePaint(
reason, m_context.oldVisualRect, m_context.newVisualRect);
reason, m_context.oldVisualRect, m_box.visualRect());
} else {
invalidated = incrementallyInvalidatePaint(
reason, LayoutRect(m_context.oldLocation, m_box.previousSize()),
......@@ -292,7 +292,7 @@ bool BoxPaintInvalidator::
needsToSavePreviousContentBoxSizeOrLayoutOverflowRect() {
// Don't save old box geometries if the paint rect is empty because we'll
// fully invalidate once the paint rect becomes non-empty.
if (m_context.newVisualRect.isEmpty())
if (m_box.visualRect().isEmpty())
return false;
if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize())
......
......@@ -496,7 +496,7 @@ void ObjectPaintInvalidatorWithContext::invalidatePaintRectangleWithContext(
// on the same backing, skip the invalidation.
if (parentFullyInvalidatedOnSameBacking() &&
(m_context.parentContext->oldVisualRect.contains(rect) ||
m_context.parentContext->newVisualRect.contains(rect)))
m_object.parent()->visualRect().contains(rect)))
return;
invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, rect,
......@@ -523,7 +523,7 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
if (m_object.shouldDoFullPaintInvalidation())
return m_object.fullPaintInvalidationReason();
if (m_context.oldVisualRect.isEmpty() && m_context.newVisualRect.isEmpty())
if (m_context.oldVisualRect.isEmpty() && m_object.visualRect().isEmpty())
return PaintInvalidationNone;
if (backgroundObscurationChanged)
......@@ -545,14 +545,14 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
// to do a full invalidation of either old bounds or new bounds.
if (m_context.oldVisualRect.isEmpty())
return PaintInvalidationBecameVisible;
if (m_context.newVisualRect.isEmpty())
if (m_object.visualRect().isEmpty())
return PaintInvalidationBecameInvisible;
// If we shifted, we don't know the exact reason so we are conservative and
// trigger a full invalidation. Shifting could be caused by some layout
// property (left / top) or some in-flow layoutObject inserted / removed
// before us in the tree.
if (m_context.newVisualRect.location() != m_context.oldVisualRect.location())
if (m_object.visualRect().location() != m_context.oldVisualRect.location())
return PaintInvalidationBoundsChange;
if (m_context.newLocation != m_context.oldLocation)
......@@ -566,7 +566,7 @@ ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() {
if (m_object.isBox())
return PaintInvalidationIncremental;
if (m_context.oldVisualRect != m_context.newVisualRect)
if (m_context.oldVisualRect != m_object.visualRect())
return PaintInvalidationBoundsChange;
return PaintInvalidationNone;
......@@ -643,7 +643,7 @@ ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason(
default:
DCHECK(isImmediateFullPaintInvalidationReason(reason));
fullyInvalidatePaint(reason, m_context.oldVisualRect,
m_context.newVisualRect);
m_object.visualRect());
}
m_context.paintingLayer->setNeedsRepaint();
......
......@@ -367,13 +367,13 @@ void PaintInvalidator::updateVisualRect(const LayoutObject& object,
IntSize adjustment = object.scrollAdjustmentForPaintInvalidation(
*context.paintInvalidationContainer);
context.newVisualRect = computeVisualRectInBacking(object, context);
context.newVisualRect.move(adjustment);
LayoutRect newVisualRect = computeVisualRectInBacking(object, context);
newVisualRect.move(adjustment);
if (object.isText()) {
// Use visual rect location for LayoutTexts because it suffices to check
// whether a visual rect changes for layout caused invalidation.
context.newLocation = context.newVisualRect.location();
context.newLocation = newVisualRect.location();
} else {
context.newLocation = computeLocationInBacking(object, context);
context.newLocation.move(adjustment);
......@@ -381,11 +381,11 @@ void PaintInvalidator::updateVisualRect(const LayoutObject& object,
// Location of empty visual rect doesn't affect paint invalidation. Set it
// to newLocation to avoid saving the previous location separately in
// ObjectPaintInvalidator.
if (context.newVisualRect.isEmpty())
context.newVisualRect.setLocation(context.newLocation);
if (newVisualRect.isEmpty())
newVisualRect.setLocation(context.newLocation);
}
object.getMutableForPainting().setVisualRect(context.newVisualRect);
object.getMutableForPainting().setVisualRect(newVisualRect);
objectPaintInvalidator.setLocationInBacking(context.newLocation);
}
......
......@@ -71,11 +71,11 @@ struct PaintInvalidatorContext {
PaintLayer* paintingLayer = nullptr;
// Store the old and new visual rects in the paint invalidation backing's
// coordinates. The rects do *not* account for composited scrolling.
// Store the old visual rect in the paint invalidation backing's coordinates.
// It does *not* account for composited scrolling.
// See LayoutObject::adjustVisualRectForCompositedScrolling().
LayoutRect oldVisualRect;
LayoutRect newVisualRect;
// Use LayoutObject::visualRect() to get the new visual rect.
// Store the origin of the object's local coordinates in the paint
// invalidation backing's coordinates. They are used to detect layoutObject
......
......@@ -26,7 +26,7 @@ PaintInvalidationReason TablePaintInvalidator::invalidatePaintIfNeeded() {
// If any col changed background, we'll check all cells for background
// changes.
bool hasColChangedBackground = false;
bool visualRectChanged = m_context.oldVisualRect != m_context.newVisualRect;
bool visualRectChanged = m_context.oldVisualRect != m_table.visualRect();
for (LayoutTableCol* col = m_table.firstColumn(); col;
col = col->nextColumn()) {
// LayoutTableCol uses the table's localVisualRect(). Should check column
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment