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..60e365f72e6e677ad8f213075b86c0b5ecd71885 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,36 @@ 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) { |
|
chrishtr
2014/12/16 17:33:45
Do you need to special-case paginationLayer == thi
mstensho (USE GERRIT)
2014/12/16 22:31:47
If paginationLayer == this, this is the flow threa
|
| + 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 |
| + // are different pagination layers involved. |
| + if (!ancestorLayer->enclosingPaginationLayer() || ancestorLayer->enclosingPaginationLayer() != paginationLayer) { |
|
chrishtr
2014/12/16 17:33:45
Why are lines 1471 - 1472 not implementable as a r
mstensho (USE GERRIT)
2014/12/16 22:31:47
Done.
|
| + // The easy case. The ancestor layer is not within the pagination layer. |
| + paginationLayer->convertToLayerCoords(ancestorLayer, offset); |
| + return offset; |
| + } |
| + // 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); |
| + offset.moveBy(-flowThread->flowThreadPointToVisualPoint(offsetFromPaginationLayerToAncestor)); |
| + return offset; |
| +} |
| + |
| void RenderLayer::didUpdateNeedsCompositedScrolling() |
| { |
| updateSelfPaintingLayer(); |