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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1813383002: Move all fast-path paint invalidation mapping into PaintInvalidationState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorganize conditions in PaintInvalidationState constructor Created 4 years, 9 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/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 3df11c66b8083506f415e7e19e116f8394a40fe9..034e24fbc1c8844ef00bce79e066fd0a6faa7ab3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1474,7 +1474,7 @@ bool LayoutBox::intersectsVisibleViewport()
LayoutView* layoutView = view();
while (layoutView->frame()->ownerLayoutObject())
layoutView = layoutView->frame()->ownerLayoutObject()->view();
- mapToVisibleRectInAncestorSpace(layoutView, rect, nullptr);
+ mapToVisibleRectInAncestorSpace(layoutView, rect);
return rect.intersects(LayoutRect(layoutView->frameView()->getScrollableArea()->visibleContentRectDouble()));
}
@@ -1675,7 +1675,7 @@ LayoutUnit LayoutBox::perpendicularContainingBlockLogicalHeight() const
return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeightLength.value()));
}
-void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const
+void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const
{
bool isFixedPos = style()->position() == FixedPosition;
bool hasTransform = hasLayer() && layer()->transform();
@@ -1686,7 +1686,7 @@ void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, Transfo
else if (isFixedPos)
mode |= IsFixed;
- LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, wasFixed, paintInvalidationState);
+ LayoutBoxModelObject::mapLocalToAncestor(ancestor, transformState, mode, wasFixed);
}
void LayoutBox::mapAncestorToLocal(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode) const
@@ -1915,7 +1915,7 @@ bool LayoutBox::hasForcedBreakAfter() const
return isForcedFragmentainerBreakValue(breakAfter());
}
-LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const
{
if (style()->visibility() != VISIBLE) {
PaintLayer* layer = enclosingLayer();
@@ -1924,12 +1924,10 @@ LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
return LayoutRect();
}
- LayoutRect r = visualOverflowRect();
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalidationState);
- return r;
+ return visualOverflowRect();
}
-void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState) const
+void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect) const
{
// The rect we compute at each step is shifted by our x/y offset in the parent container's coordinate space.
// Only when we cross a writing mode boundary will we have to possibly flipForWritingMode (to convert into a more appropriate
@@ -1937,22 +1935,17 @@ void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
// properly even during layout, since the rect remains flipped all the way until the end.
//
// LayoutView::computeRectForPaintInvalidation then converts the rect to physical coordinates. We also convert to
- // physical when we hit a paintInvalidationContainer boundary. Therefore the final rect returned is always in the
- // physical coordinate space of the paintInvalidationContainer.
+ // physical when we hit the ancestor. Therefore the final rect returned is always in the
+ // physical coordinate space of the ancestor.
const ComputedStyle& styleToUse = styleRef();
EPosition position = styleToUse.position();
// We need to inflate the paint invalidation rect before we use paintInvalidationState,
// else we would forget to inflate it for the current layoutObject. FIXME: If these were
- // included into the visual overflow for repaint, we wouldn't have this issue.
+ // included into the visual overflow for paint invalidation, we wouldn't have this issue.
inflatePaintInvalidationRectForReflectionAndFilter(rect);
- if (paintInvalidationState && paintInvalidationState->canMapToAncestor(ancestor) && position != FixedPosition) {
- paintInvalidationState->mapObjectRectToAncestor(*this, ancestor, rect);
- return;
- }
-
if (ancestor == this) {
if (ancestor->style()->isFlippedBlocksWritingMode())
flipForWritingMode(rect);
@@ -2011,9 +2004,9 @@ void LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ance
}
if (container->isLayoutView())
- toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor, rect, LayoutView::toViewportConstrainedPosition(position), nullptr);
+ toLayoutView(container)->mapToVisibleRectInAncestorSpace(ancestor, rect, LayoutView::toViewportConstrainedPosition(position));
else
- container->mapToVisibleRectInAncestorSpace(ancestor, rect, nullptr);
+ container->mapToVisibleRectInAncestorSpace(ancestor, rect);
}
void LayoutBox::inflatePaintInvalidationRectForReflectionAndFilter(LayoutRect& paintInvalidationRect) const
@@ -4445,7 +4438,7 @@ LayoutObject* LayoutBox::splitAnonymousBoxesAroundChild(LayoutObject* beforeChil
LayoutBox* parentBox = toLayoutBox(boxToSplit->parent());
// We need to invalidate the |parentBox| before inserting the new node
// so that the table paint invalidation logic knows the structure is dirty.
- // See for example LayoutTableCell:clippedOverflowRectForPaintInvalidation.
+ // See for example LayoutTableCell:localOverflowRectForPaintInvalidation.
markBoxForRelayoutAfterSplit(parentBox);
parentBox->virtualChildren()->insertChildNode(parentBox, postBox, boxToSplit->nextSibling());
boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true);

Powered by Google App Engine
This is Rietveld 408576698