Chromium Code Reviews| Index: Source/core/rendering/RenderLayer.cpp |
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
| index 610e046567f75fcb790c16dee674c4a9542e91ee..5cf35e614f7bb90627547f6b7ab4649c84beb0df 100644 |
| --- a/Source/core/rendering/RenderLayer.cpp |
| +++ b/Source/core/rendering/RenderLayer.cpp |
| @@ -462,10 +462,7 @@ static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const RenderLayer |
| } |
| // The ancestor layer is also inside the pagination layer, so we need to subtract the visual |
| // distance from the ancestor layer to the pagination layer. |
| - LayoutPoint offsetFromPaginationLayerToAncestor; |
| - ancestorLayer->convertToLayerCoords(paginationLayer, offsetFromPaginationLayerToAncestor); |
| - offsetFromPaginationLayerToAncestor = flowThread->flowThreadPointToVisualPoint(offsetFromPaginationLayerToAncestor); |
| - rect.moveBy(-offsetFromPaginationLayerToAncestor); |
| + rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)); |
| } |
| bool RenderLayer::useRegionBasedColumns() const |
| @@ -1454,6 +1451,35 @@ void RenderLayer::convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutR |
| rect.moveBy(delta); |
| } |
| +LayoutPoint RenderLayer::visualOffsetFromAncestor(const RenderLayer* ancestorLayer) const |
| +{ |
| + RenderLayer* paginationLayer = enclosingPaginationLayer(); |
| + LayoutPoint offset; |
| + if (!paginationLayer || paginationLayer == this) { |
| + convertToLayerCoords(ancestorLayer, offset); |
| + return offset; |
| + } |
| + |
| + RenderFlowThread* flowThread = toRenderFlowThread(paginationLayer->renderer()); |
| + convertToLayerCoords(paginationLayer, offset); |
| + offset = flowThread->flowThreadPointToVisualPoint(offset); |
| + if (ancestorLayer == paginationLayer) |
| + return offset; |
| + |
| + // FIXME: Handle nested fragmentation contexts (crbug.com/423076). For now just give up if there |
|
chrishtr
2014/12/17 19:11:00
Does this FIXME still apply now that there is recu
mstensho (USE GERRIT)
2014/12/17 19:29:53
Yes, we're still not quite there. I have prepared
|
| + // are different pagination layers involved. |
| + if (!ancestorLayer->enclosingPaginationLayer() || ancestorLayer->enclosingPaginationLayer() != paginationLayer) { |
| + // The easy case. The ancestor layer is not within the pagination layer. |
| + return offset + paginationLayer->visualOffsetFromAncestor(ancestorLayer); |
| + } |
| + // The ancestor layer is also inside the pagination layer, so we need to subtract the visual |
| + // distance from the ancestor layer to the pagination layer. |
| + LayoutPoint offsetFromPaginationLayerToAncestor; |
|
chrishtr
2014/12/17 19:11:00
How about replacing 1477-1479 by:
offset.moveBy(-
mstensho (USE GERRIT)
2014/12/17 19:29:53
Done.
|
| + ancestorLayer->convertToLayerCoords(paginationLayer, offsetFromPaginationLayerToAncestor); |
| + offset.moveBy(-flowThread->flowThreadPointToVisualPoint(offsetFromPaginationLayerToAncestor)); |
| + return offset; |
| +} |
| + |
| void RenderLayer::didUpdateNeedsCompositedScrolling() |
| { |
| updateSelfPaintingLayer(); |