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

Unified Diff: Source/core/paint/DeprecatedPaintLayerPainter.cpp

Issue 1159113003: [SP] Don't invalidate the whole scrolled tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaselines (see previous try result); Comments Created 5 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/paint/DeprecatedPaintLayerPaintingInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/DeprecatedPaintLayerPainter.cpp
diff --git a/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
index 8282e7f9ed085d28b4b990393e0c150715e9394d..ebb11ad0a1094ba2ccb1689be90c5b16afa9625e 100644
--- a/Source/core/paint/DeprecatedPaintLayerPainter.cpp
+++ b/Source/core/paint/DeprecatedPaintLayerPainter.cpp
@@ -423,6 +423,10 @@ void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi
LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
#endif
+ IntSize scrollOffsetAccumulation = paintingInfo.scrollOffsetAccumulation;
+ if (m_paintLayer.layoutObject()->hasOverflowClip())
+ scrollOffsetAccumulation += m_paintLayer.layoutBox()->scrolledContentOffset();
+
DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode(), childrenToVisit);
while (DeprecatedPaintLayerStackingNode* child = iterator.next()) {
DeprecatedPaintLayerPainter childPainter(*child->layer());
@@ -431,10 +435,18 @@ void DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, Graphi
if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo, paintFlags))
continue;
+ DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo;
+ childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulation;
+ // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer.
+ for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); parentLayer != &m_paintLayer; parentLayer = parentLayer->parent()) {
+ if (parentLayer->layoutObject()->hasOverflowClip())
+ childPaintingInfo.scrollOffsetAccumulation += parentLayer->layoutBox()->scrolledContentOffset();
+ }
+
if (!child->layer()->isPaginated())
- childPainter.paintLayer(context, paintingInfo, paintFlags);
+ childPainter.paintLayer(context, childPaintingInfo, paintFlags);
else
- childPainter.paintPaginatedChildLayer(context, paintingInfo, paintFlags);
+ childPainter.paintPaginatedChildLayer(context, childPaintingInfo, paintFlags);
}
}
@@ -633,16 +645,14 @@ void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const
PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, paintBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObject());
OwnPtr<ScrollRecorder> scrollRecorder;
LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation());
- if (&m_paintLayer != paintingInfo.rootLayer && paintingInfo.rootLayer->layoutObject()->hasOverflowClip()) {
- // As a sublayer of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorder
- // created by BlockPainter of the root layer, so we need to issue ScrollRecorder for them separately.
- // FIXME: This doesn't apply in slimming paint phase 2.
- IntSize scrollOffset = paintingInfo.rootLayer->layoutBox()->scrolledContentOffset();
- if (paintingInfo.rootLayer->scrollsOverflow() || !scrollOffset.isZero()) {
- paintOffset += scrollOffset;
- paintInfo.rect.move(scrollOffset);
- scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_paintLayer.layoutObject(), paintInfo.phase, scrollOffset));
- }
+ if (!paintingInfo.scrollOffsetAccumulation.isZero()) {
+ // As a descendant of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorders
+ // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder
+ // for this layer seperately, with the scroll offset accumulated from the root layer to the parent of this
+ // layer, to get the same result as ScrollRecorder in BlockPainter.
+ paintOffset += paintingInfo.scrollOffsetAccumulation;
+ paintInfo.rect.move(paintingInfo.scrollOffsetAccumulation);
+ scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_paintLayer.layoutObject(), paintInfo.phase, paintingInfo.scrollOffsetAccumulation));
}
m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
}
« no previous file with comments | « LayoutTests/TestExpectations ('k') | Source/core/paint/DeprecatedPaintLayerPaintingInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698