Chromium Code Reviews| Index: Source/core/paint/DeprecatedPaintLayerPainter.cpp |
| diff --git a/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/Source/core/paint/DeprecatedPaintLayerPainter.cpp |
| index 8282e7f9ed085d28b4b990393e0c150715e9394d..6d83ec28b215a58631fcdd4d9bbd141aa1521867 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,10 @@ 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()) { |
|
chrishtr
2015/06/03 18:46:08
Can you explain more why we need to do this accumu
Xianzhu
2015/06/03 19:06:59
This is covered by existing tests. Previously the
Xianzhu
2015/06/03 19:42:41
Done.
|
| + 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); |
| } |