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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 799403006: [New Multicolumn] Make computeOffsetFromCompositedAncestor() flowthread-aware. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplify test. Created 6 years 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 | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 610e046567f75fcb790c16dee674c4a9542e91ee..a5338a7a46720b797650ea691c2f3cd514c8003a 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,34 @@ 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
+ // are different pagination layers involved.
+ if (!ancestorLayer->enclosingPaginationLayer() || ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
+ // The easy case. The ancestor layer is not within the pagination layer.
+ offset.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
+ } else {
+ // 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.
+ offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
+ }
+ return offset;
+}
+
void RenderLayer::didUpdateNeedsCompositedScrolling()
{
updateSelfPaintingLayer();
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698