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

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

Issue 1837533002: LayoutObject::localOverflowRectForPaintInvalidation() and localSelectionRect() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pi0
Patch Set: Rebase 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/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index 24a0d0b1e03ec4aa37671718501d2108b2290ae4..b2d442b184778fa5d25d004e8995b49aa35e3e07 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
chrishtr 2016/03/25 20:20:14 Make this non-virtual?
chrishtr 2016/03/25 20:21:08 IOW: what subclasses still override it?
Xianzhu 2016/03/25 20:24:20 SVG objects still need to override. This function
+{
+ LayoutRect rect = localOverflowRectForPaintInvalidation();
+ mapToVisibleRectInAncestorSpace(paintInvalidationContainer, rect, paintInvalidationState);
+ return rect;
+}
+
+LayoutRect LayoutObject::localOverflowRectForPaintInvalidation() const
{
ASSERT_NOT_REACHED();
return LayoutRect();
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutReplaced.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698