summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangxianzhu <wangxianzhu@chromium.org>2016-03-25 13:34:36 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-25 20:36:06 +0000
commita17fa727d64fb2a5cd12269e033a3a903641eab5 (patch)
tree1162a02f1052fd6956316ad02f25bb37021d6264
parent348a13d830f6f7e3c3f73f97c0f7f206bc3763fa (diff)
downloadchromium_src-a17fa727d64fb2a5cd12269e033a3a903641eab5.zip
chromium_src-a17fa727d64fb2a5cd12269e033a3a903641eab5.tar.gz
chromium_src-a17fa727d64fb2a5cd12269e033a3a903641eab5.tar.bz2
LayoutObject::localOverflowRectForPaintInvalidation() and localSelectionRect()
They replace some original implementations of clippedOverflowRectForPaintInvalidation() and selectionRectForPaintInvalidation(), so that the implementations don't need to map to backing by themselves. BUG=591199 Review URL: https://codereview.chromium.org/1837533002 Cr-Commit-Position: refs/heads/master@{#383345}
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutBR.cpp7
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutBR.h4
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutBox.cpp8
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutBox.h2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutInline.cpp29
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutInline.h8
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutListMarker.cpp16
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutListMarker.h3
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutObject.cpp31
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutObject.h13
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutReplaced.cpp22
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutReplaced.h3
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutTableCell.cpp10
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutTableCell.h2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutTableCol.cpp6
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutTableCol.h2
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutText.cpp12
-rw-r--r--third_party/WebKit/Source/core/layout/LayoutText.h4
18 files changed, 71 insertions, 111 deletions
diff --git a/third_party/WebKit/Source/core/layout/LayoutBR.cpp b/third_party/WebKit/Source/core/layout/LayoutBR.cpp
index 25ba1c9..64c5dff 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBR.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBR.cpp
@@ -43,13 +43,6 @@ LayoutBR::~LayoutBR()
{
}
-LayoutRect LayoutBR::selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const
-{
- // Although line breaks contain no actual text, if we're selected we need
- // to return a rect that includes space to illustrate a newline.
- return LayoutText::selectionRectForPaintInvalidation(paintInvalidationContainer);
-}
-
int LayoutBR::lineHeight(bool firstLine) const
{
const ComputedStyle& style = styleRef(firstLine && document().styleEngine().usesFirstLineRules());
diff --git a/third_party/WebKit/Source/core/layout/LayoutBR.h b/third_party/WebKit/Source/core/layout/LayoutBR.h
index 84b8bb0..524b455 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBR.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBR.h
@@ -36,7 +36,9 @@ public:
const char* name() const override { return "LayoutBR"; }
- LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* /* paintInvalidationContainer */) const override;
+ // Although line breaks contain no actual text, if we're selected we need
+ // to return a rect that includes space to illustrate a newline.
+ using LayoutText::localSelectionRect;
float width(unsigned /* from */, unsigned /* len */, const Font&, LayoutUnit /* xpos */, TextDirection, HashSet<const SimpleFontData*>* = nullptr /* fallbackFonts */ , FloatRect* /* glyphBounds */ = nullptr) const override { return 0; }
float width(unsigned /* from */, unsigned /* len */, LayoutUnit /* xpos */, TextDirection, bool = false /* firstLine */, HashSet<const SimpleFontData*>* = nullptr /* fallbackFonts */, FloatRect* /* glyphBounds */ = nullptr) const override { return 0; }
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 9618e83..280a8ba 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1923,7 +1923,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();
@@ -1932,9 +1932,7 @@ LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
return LayoutRect();
}
- LayoutRect r = visualOverflowRect();
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalidationState);
- return r;
+ return visualOverflowRect();
}
bool LayoutBox::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags) const
@@ -4450,7 +4448,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);
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h
index c309836..ebde1d5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -638,7 +638,7 @@ public:
bool hasForcedBreakBefore() const;
bool hasForcedBreakAfter() const;
- LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
+ LayoutRect localOverflowRectForPaintInvalidation() const override;
bool mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect&, const PaintInvalidationState*, VisibleRectFlags = DefaultVisibleRectFlags) const override;
virtual void invalidatePaintForOverhangingFloats(bool paintAllDescendants);
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index 0b3898f..c310452 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -1021,8 +1021,11 @@ LayoutRect LayoutInline::linesVisualOverflowBoundingBox() const
LayoutRect LayoutInline::absoluteClippedOverflowRect() const
{
- if (!continuation())
- return clippedOverflowRect(view());
+ if (!continuation()) {
+ LayoutRect rect = visualOverflowRect();
+ mapToVisibleRectInAncestorSpace(view(), rect, nullptr);
+ return rect;
+ }
FloatRect floatResult;
LinesBoundingBoxGeneratorContext context(floatResult);
@@ -1033,34 +1036,28 @@ LayoutRect LayoutInline::absoluteClippedOverflowRect() const
for (LayoutBlock* currBlock = containingBlock(); currBlock && currBlock->isAnonymousBlock(); currBlock = toLayoutBlock(currBlock->nextSibling())) {
for (LayoutObject* curr = currBlock->firstChild(); curr; curr = curr->nextSibling()) {
- LayoutRect rect(curr->clippedOverflowRectForPaintInvalidation(view()));
+ LayoutRect rect(curr->localOverflowRectForPaintInvalidation());
context(FloatRect(rect));
- if (curr == endContinuation)
- return LayoutRect(enclosingIntRect(floatResult));
+ if (curr == endContinuation) {
+ LayoutRect rect(enclosingIntRect(floatResult));
+ mapToVisibleRectInAncestorSpace(view(), rect, nullptr);
+ return rect;
+ }
}
}
return LayoutRect();
}
-LayoutRect LayoutInline::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+LayoutRect LayoutInline::localOverflowRectForPaintInvalidation() const
{
// If we don't create line boxes, we don't have any invalidations to do.
if (!alwaysCreateLineBoxes())
return LayoutRect();
- return clippedOverflowRect(paintInvalidationContainer);
-}
-LayoutRect LayoutInline::clippedOverflowRect(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
-{
if (style()->visibility() != VISIBLE)
return LayoutRect();
- LayoutRect overflowRect(visualOverflowRect());
- if (overflowRect.isEmpty())
- return overflowRect;
-
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, overflowRect, paintInvalidationState);
- return overflowRect;
+ return visualOverflowRect();
}
LayoutRect LayoutInline::visualOverflowRect() const
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.h b/third_party/WebKit/Source/core/layout/LayoutInline.h
index 42899b7..1a452d7 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.h
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.h
@@ -236,12 +236,12 @@ private:
LayoutUnit offsetHeight() const final { return LayoutUnit(linesBoundingBox().height()); }
LayoutRect absoluteClippedOverflowRect() const override;
- LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
+
bool mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect&, const PaintInvalidationState*, VisibleRectFlags = DefaultVisibleRectFlags) const override;
- // This method differs from clippedOverflowRectForPaintInvalidation in that it includes
- // the rects for culled inline boxes, which aren't necessary for paint invalidation.
- LayoutRect clippedOverflowRect(const LayoutBoxModelObject*, const PaintInvalidationState* = nullptr) const;
+ // This method differs from visualOverflowRect in that it doesn't include the rects
+ // for culled inline boxes, which aren't necessary for paint invalidation.
+ LayoutRect localOverflowRectForPaintInvalidation() const override;
PositionWithAffinity positionForPoint(const LayoutPoint&) final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
index a5c7e7a..31e5f27 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
@@ -439,22 +439,6 @@ void LayoutListMarker::setSelectionState(SelectionState state)
inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone);
}
-LayoutRect LayoutListMarker::selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const
-{
- ASSERT(!needsLayout());
-
- if (getSelectionState() == SelectionNone || !inlineBoxWrapper())
- return LayoutRect();
-
- RootInlineBox& root = inlineBoxWrapper()->root();
- LayoutRect rect(LayoutUnit(), root.selectionTop() - location().y(), size().width(), root.selectionHeight());
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, nullptr);
- // FIXME: groupedMapping() leaks the squashing abstraction.
- if (paintInvalidationContainer->layer()->groupedMapping())
- PaintLayer::mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rect);
- return rect;
-}
-
void LayoutListMarker::listItemStyleDidChange()
{
RefPtr<ComputedStyle> newStyle = ComputedStyle::create();
diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.h b/third_party/WebKit/Source/core/layout/LayoutListMarker.h
index ce0f09d..98dc805 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListMarker.h
+++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.h
@@ -54,7 +54,7 @@ public:
void updateMarginsAndContent();
IntRect getRelativeMarkerRect() const;
- LayoutRect localSelectionRect() const;
+ LayoutRect localSelectionRect() const final;
bool isImage() const override;
const StyleImage* image() const { return m_image.get(); }
const LayoutListItem* listItem() const { return m_listItem; }
@@ -88,7 +88,6 @@ private:
bool isText() const { return !isImage(); }
void setSelectionState(SelectionState) override;
- LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const override;
bool canBeSelectionLeaf() const override { return true; }
LayoutUnit getWidthOfTextWithSuffix() const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 24a0d0b..b2d442b 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -1369,7 +1369,10 @@ static PassOwnPtr<TracedValue> jsonObjectForOldAndNewRects(const LayoutRect& old
LayoutRect LayoutObject::selectionRectInViewCoordinates() const
{
- return selectionRectForPaintInvalidation(view());
+ LayoutRect selectionRect = localSelectionRect();
+ if (!selectionRect.isEmpty())
+ mapToVisibleRectInAncestorSpace(view(), selectionRect, nullptr);
+ return selectionRect;
}
LayoutRect LayoutObject::previousSelectionRectForPaintInvalidation() const
@@ -1404,13 +1407,16 @@ inline void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject
return;
LayoutRect oldSelectionRect = previousSelectionRectForPaintInvalidation();
- LayoutRect newSelectionRect = selectionRectForPaintInvalidation(&paintInvalidationContainer);
-
- // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller
- // does not move on scroll.
- if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidationContainer != this) {
- LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset());
- newSelectionRect.move(inverseOffset);
+ LayoutRect newSelectionRect = localSelectionRect();
+ if (!newSelectionRect.isEmpty()) {
+ PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, newSelectionRect, &paintInvalidationState);
+
+ // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller
+ // does not move on scroll.
+ if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidationContainer != this) {
+ LayoutSize inverseOffset(toLayoutBox(&paintInvalidationContainer)->scrolledContentOffset());
+ newSelectionRect.move(inverseOffset);
+ }
}
setPreviousSelectionRectForPaintInvalidation(newSelectionRect);
@@ -1632,7 +1638,14 @@ LayoutRect LayoutObject::absoluteClippedOverflowRect() const
return clippedOverflowRectForPaintInvalidation(view());
}
-LayoutRect LayoutObject::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject*, const PaintInvalidationState*) const
+LayoutRect LayoutObject::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+{
+ LayoutRect rect = localOverflowRectForPaintInvalidation();
+ mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInvalidationState);
+ return rect;
+}
+
+LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const
{
ASSERT_NOT_REACHED();
return LayoutRect();
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 032c868..47360a2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -1103,11 +1103,6 @@ public:
bool isPaintInvalidationContainer() const;
- LayoutRect computePaintInvalidationRect()
- {
- return computePaintInvalidationRect(containerForPaintInvalidation());
- }
-
// Returns the paint invalidation rect for this LayoutObject in the coordinate space of the paint backing (typically a GraphicsLayer) for |paintInvalidationContainer|.
LayoutRect computePaintInvalidationRect(const LayoutBoxModelObject& paintInvalidationContainer, const PaintInvalidationState* = nullptr) const;
@@ -1142,6 +1137,10 @@ public:
virtual LayoutRect absoluteClippedOverflowRect() const;
virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const;
+ // Returns the rect that should have paint invalidated whenever this object changes. The rect is in the object's
+ // local coordinate space.
+ virtual LayoutRect localOverflowRectForPaintInvalidation() const;
+
// Given a rect in the object's coordinate space, compute a rect in the coordinate space of |ancestor|. If
// intermediate containers have clipping or scrolling of any kind, it is applied; but overflow clipping is
// *not* applied for |ancestor| itself. The output rect is suitable for purposes such as paint invalidation.
@@ -1174,8 +1173,8 @@ public:
bool canUpdateSelectionOnRootLineBoxes() const;
// A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest
- // possible bounding box for the selection. The rect returned is in the coordinate space of the paint invalidation container's backing.
- virtual LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* /* paintInvalidationContainer */) const { return LayoutRect(); }
+ // possible bounding box for the selection. The rect returned is in the object's local coordinate space.
+ virtual LayoutRect localSelectionRect() const { return LayoutRect(); }
// View coordinates means the coordinate space of |view()|.
LayoutRect selectionRectInViewCoordinates() const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
index 4e67e03..1e02150 100644
--- a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
@@ -709,21 +709,6 @@ PositionWithAffinity LayoutReplaced::positionForPoint(const LayoutPoint& point)
return LayoutBox::positionForPoint(point);
}
-LayoutRect LayoutReplaced::selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const
-{
- ASSERT(!needsLayout());
-
- LayoutRect rect = localSelectionRect();
- if (rect.isEmpty())
- return rect;
-
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, 0);
- // FIXME: groupedMapping() leaks the squashing abstraction.
- if (paintInvalidationContainer->layer()->groupedMapping())
- PaintLayer::mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rect);
- return rect;
-}
-
LayoutRect LayoutReplaced::localSelectionRect() const
{
if (getSelectionState() == SelectionNone)
@@ -751,8 +736,11 @@ void LayoutReplaced::setSelectionState(SelectionState state)
// We only include the space below the baseline in our layer's cached paint invalidation rect if the
// image is selected. Since the selection state has changed update the rect.
- if (hasLayer())
- setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containerForPaintInvalidation()));
+ if (hasLayer()) {
+ LayoutRect rect = localOverflowRectForPaintInvalidation();
+ PaintLayer::mapRectToPaintInvalidationBacking(this, &containerForPaintInvalidation(), rect);
+ setPreviousPaintInvalidationRect(rect);
+ }
if (canUpdateSelectionOnRootLineBoxes())
inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone);
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.h b/third_party/WebKit/Source/core/layout/LayoutReplaced.h
index a3bfce4..35ac0c3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutReplaced.h
+++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.h
@@ -66,7 +66,7 @@ public:
static const int defaultHeight;
bool canHaveChildren() const override { return false; }
virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) const { }
- LayoutRect localSelectionRect() const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left).
+ LayoutRect localSelectionRect() const final;
bool hasObjectFit() const { return style()->getObjectFit() != ComputedStyle::initialObjectFit(); }
@@ -123,7 +123,6 @@ private:
bool canBeSelectionLeaf() const override { return true; }
- LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const final;
void computeIntrinsicSizingInfoForReplacedContent(LayoutReplaced*, IntrinsicSizingInfo&) const;
FloatSize constrainIntrinsicSizeToMinMax(const IntrinsicSizingInfo&) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
index 34f26d9..e149e66 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -315,14 +315,14 @@ LayoutSize LayoutTableCell::offsetFromContainer(const LayoutObject* o) const
return offset;
}
-LayoutRect LayoutTableCell::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+LayoutRect LayoutTableCell::localOverflowRectForPaintInvalidation() const
{
// If the table grid is dirty, we cannot get reliable information about adjoining cells,
// so we ignore outside borders. This should not be a problem because it means that
// the table is going to recalculate the grid, relayout and issue a paint invalidation of its current rect, which
// includes any outside borders of this cell.
if (!table()->collapseBorders() || table()->needsSectionRecalc())
- return LayoutBlockFlow::clippedOverflowRectForPaintInvalidation(paintInvalidationContainer, paintInvalidationState);
+ return LayoutBlockFlow::localOverflowRectForPaintInvalidation();
bool rtl = !styleForCellFlow().isLeftToRightDirection();
int outlineOutset = style()->outlineOutsetExtent();
@@ -355,17 +355,13 @@ LayoutRect LayoutTableCell::clippedOverflowRectForPaintInvalidation(const Layout
}
}
LayoutPoint location(std::max(LayoutUnit(left), -visualOverflowRect().x()), std::max(LayoutUnit(top), -visualOverflowRect().y()));
- LayoutRect r(-location.x(), -location.y(), location.x() + std::max(size().width() + right, visualOverflowRect().maxX()), location.y() + std::max(size().height() + bottom, visualOverflowRect().maxY()));
-
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalidationState);
- return r;
+ return LayoutRect(-location.x(), -location.y(), location.x() + std::max(size().width() + right, visualOverflowRect().maxX()), location.y() + std::max(size().height() + bottom, visualOverflowRect().maxY()));
}
bool LayoutTableCell::mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect& r, const PaintInvalidationState* paintInvalidationState, VisibleRectFlags visibleRectFlags) const
{
if (ancestor == this)
return true;
- r.setY(r.y());
if ((!paintInvalidationState || !paintInvalidationState->canMapToAncestor(ancestor)) && parent())
r.moveBy(-parentBox()->location()); // Rows are in the same coordinate space, so don't add their offset in.
return LayoutBlockFlow::mapToVisibleRectInAncestorSpace(ancestor, r, paintInvalidationState, visibleRectFlags);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
index c8ea1dc..61196d0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -291,7 +291,7 @@ private:
bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, const InlineFlowBox*) const override;
LayoutSize offsetFromContainer(const LayoutObject*) const override;
- LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
+ LayoutRect localOverflowRectForPaintInvalidation() const override;
bool mapToVisibleRectInAncestorSpace(const LayoutBoxModelObject* ancestor, LayoutRect&, const PaintInvalidationState*, VisibleRectFlags = DefaultVisibleRectFlags) const override;
int borderHalfLeft(bool outer) const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
index ab9da43..019ab84 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
@@ -108,7 +108,7 @@ bool LayoutTableCol::canHaveChildren() const
return isTableColumnGroup();
}
-LayoutRect LayoutTableCol::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+LayoutRect LayoutTableCol::localOverflowRectForPaintInvalidation() const
{
// Entire table gets invalidated, instead of invalidating
// every cell in the column.
@@ -122,9 +122,7 @@ LayoutRect LayoutTableCol::clippedOverflowRectForPaintInvalidation(const LayoutB
// location is always zero.
ASSERT(this->location() == LayoutPoint());
- LayoutRect r = table->visualOverflowRect();
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, r, paintInvalidationState);
- return r;
+ return table->localOverflowRectForPaintInvalidation();
}
void LayoutTableCol::imageChanged(WrappedImagePtr, const IntRect*)
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.h b/third_party/WebKit/Source/core/layout/LayoutTableCol.h
index a028b3b..8f6a266 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCol.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.h
@@ -107,7 +107,7 @@ private:
bool canHaveChildren() const override;
PaintLayerType layerTypeRequired() const override { return NoPaintLayer; }
- LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
+ LayoutRect localOverflowRectForPaintInvalidation() const override;
void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index f52008f..7e8990d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1573,17 +1573,15 @@ LayoutRect LayoutText::visualOverflowRect() const
return rect;
}
-LayoutRect LayoutText::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
+LayoutRect LayoutText::localOverflowRectForPaintInvalidation() const
{
if (style()->visibility() != VISIBLE)
return LayoutRect();
- LayoutRect paintInvalidationRect(visualOverflowRect());
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, paintInvalidationRect, paintInvalidationState);
- return paintInvalidationRect;
+ return visualOverflowRect();
}
-LayoutRect LayoutText::selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const
+LayoutRect LayoutText::localSelectionRect() const
{
ASSERT(!needsLayout());
@@ -1618,10 +1616,6 @@ LayoutRect LayoutText::selectionRectForPaintInvalidation(const LayoutBoxModelObj
rect.unite(LayoutRect(ellipsisRectForBox(box, startPos, endPos)));
}
- mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, 0);
- // FIXME: groupedMapping() leaks the squashing abstraction.
- if (paintInvalidationContainer->layer()->groupedMapping())
- PaintLayer::mapRectInPaintInvalidationContainerToBacking(paintInvalidationContainer, rect);
return rect;
}
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h
index 590493a..19fd44a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -148,7 +148,7 @@ public:
bool canBeSelectionLeaf() const override { return true; }
void setSelectionState(SelectionState) final;
- LayoutRect selectionRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer) const override;
+ LayoutRect localSelectionRect() const final;
LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) override;
InlineTextBox* firstTextBox() const { return m_firstTextBox; }
@@ -220,7 +220,7 @@ private:
bool isText() const = delete; // This will catch anyone doing an unnecessary check.
- LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
+ LayoutRect localOverflowRectForPaintInvalidation() const override;
void checkConsistency() const;