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

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

Issue 2019583002: Don't include scroll offset in offsetFromLayoutObject for scrolling contents layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/LayoutBoxModelObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index 9081857db32c0caf9d08620a6d0a46f5ebc4eb72..cd3587ad63c36c9c01f3a8c43e808791cc8e3b93 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -412,6 +412,11 @@ void LayoutBoxModelObject::invalidateTreeIfNeeded(const PaintInvalidationState&
invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState);
}
+static bool compositedScrollsWithRespectTo(const LayoutObject* layoutObject, const LayoutBoxModelObject& paintInvalidationContainer)
wkorman 2016/05/31 18:34:15 If layoutObject is never null can use const &?
chrishtr 2016/05/31 18:51:54 It can be null, due to the default parameter of in
+{
+ return paintInvalidationContainer.usesCompositedScrolling() && layoutObject != &paintInvalidationContainer;
+}
+
void LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect(const LayoutRect& r, PaintInvalidationReason invalidationReason, const LayoutObject& object) const
{
// TODO(wangxianzhu): Enable the following assert after paint invalidation for spv2 is ready.
@@ -428,12 +433,15 @@ void LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect(const LayoutRe
// Note: the subpixel accumulation of layer() does not need to be added here. It is already taken into account.
squashingLayer->setNeedsDisplayInRect(enclosingIntRect(paintInvalidationRect), invalidationReason, object);
}
+ } else if (compositedScrollsWithRespectTo(&object, *this)) {
+ layer()->compositedLayerMapping()->setScrollingContentsNeedDisplayInRect(r, invalidationReason, object);
} else {
+ // TODO(chrishtr): we should be able to skip scrolling content layers in this case.
layer()->compositedLayerMapping()->setContentsNeedDisplayInRect(r, invalidationReason, object);
}
}
-void LayoutBoxModelObject::invalidateDisplayItemClientOnBacking(const DisplayItemClient& displayItemClient, PaintInvalidationReason invalidationReason) const
+void LayoutBoxModelObject::invalidateDisplayItemClientOnBacking(const DisplayItemClient& displayItemClient, PaintInvalidationReason invalidationReason, const LayoutObject* layoutObject) const
{
displayItemClient.setDisplayItemsUncached();
@@ -448,7 +456,10 @@ void LayoutBoxModelObject::invalidateDisplayItemClientOnBacking(const DisplayIte
if (GraphicsLayer* squashingLayer = layer()->groupedMapping()->squashingLayer())
squashingLayer->displayItemClientWasInvalidated(displayItemClient, invalidationReason);
} else if (CompositedLayerMapping* compositedLayerMapping = layer()->compositedLayerMapping()) {
- compositedLayerMapping->displayItemClientWasInvalidated(displayItemClient, invalidationReason);
+ if (compositedScrollsWithRespectTo(layoutObject, *this))
+ compositedLayerMapping->scrollingDisplayItemClientWasInvalidated(displayItemClient, invalidationReason);
+ else
+ compositedLayerMapping->displayItemClientWasInvalidated(displayItemClient, invalidationReason);
}
}

Powered by Google App Engine
This is Rietveld 408576698