Chromium Code Reviews| Index: Source/core/rendering/RenderLayer.cpp |
| diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
| index 719dcefebe6bcf23d038fe433ca6d52844b70ae0..5fb7a52daea24eb356ae4189f9b5e91d20bbea87 100644 |
| --- a/Source/core/rendering/RenderLayer.cpp |
| +++ b/Source/core/rendering/RenderLayer.cpp |
| @@ -415,6 +415,38 @@ static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende |
| return true; |
| } |
| +// Convert a bounding box from flow thread coordinates, relative to |layer|, to visual coordinates, relative to |ancestorLayer|. |
| +static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const RenderLayer* layer, const RenderLayer* ancestorLayer, LayoutRect& rect) |
| +{ |
| + RenderLayer* paginationLayer = layer->enclosingPaginationLayer(); |
| + ASSERT(paginationLayer); |
| + RenderFlowThread* flowThread = toRenderFlowThread(paginationLayer->renderer()); |
| + LayoutPoint offsetWithinPaginationLayer; |
| + layer->convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer); |
| + |
| + // First make the flow thread rectangle relative to the flow thread, not to |layer|. |
| + rect.moveBy(offsetWithinPaginationLayer); |
|
chrishtr
2014/10/13 16:03:34
Why is this just an offset in all cases? What if t
Julien - ping for review
2014/10/13 19:25:03
convertToLayerCoords is expected not to call acros
chrishtr
2014/10/14 17:10:20
Yuck. Yes you're right. convertToLayerCoords does
|
| + |
| + // Then make the rectangle visual, relative to the fragmentation context. Split our box up into |
| + // the actual fragment boxes that render in the columns/pages and unite those together to get |
| + // our true bounding box. |
| + rect = flowThread->fragmentsBoundingBox(rect); |
| + |
| + // Finally, make the visual rectangle relative to |ancestorLayer|. |
| + // FIXME: nested fragmentation contexts. For now just give up if there are different pagination layers involved. |
|
Julien - ping for review
2014/10/13 19:25:03
Let's put the bug number for that as it will make
mstensho (USE GERRIT)
2014/10/13 20:47:25
Done.
|
| + if (!ancestorLayer->enclosingPaginationLayer() || ancestorLayer->enclosingPaginationLayer() != paginationLayer) { |
| + // The easy case. The ancestor layer is not within the pagination layer. |
| + paginationLayer->convertToLayerCoords(ancestorLayer, rect); |
| + return; |
| + } |
| + // 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); |
|
chrishtr
2014/10/13 16:03:34
Same question here. Why not use something like Ren
Julien - ping for review
2014/10/13 19:25:02
In general, RenderLayer::mapRectToPaintInvalidatio
chrishtr
2014/10/14 17:10:20
Why doesn't that hold?
Julien - ping for review
2014/10/14 17:52:58
|ancestorLayer| is one of your parents but it can
|
| +} |
| + |
| bool RenderLayer::useRegionBasedColumns() const |
| { |
| return renderer()->document().regionBasedColumnsEnabled(); |
| @@ -2242,16 +2274,7 @@ LayoutRect RenderLayer::fragmentsBoundingBox(const RenderLayer* ancestorLayer) c |
| return physicalBoundingBox(ancestorLayer); |
| LayoutRect result = flippedLogicalBoundingBox(); |
| - |
| - // Split our box up into the actual fragment boxes that render in the columns/pages and unite those together to |
| - // get our true bounding box. |
| - LayoutPoint offsetWithinPaginationLayer; |
| - convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginationLayer); |
| - result.moveBy(offsetWithinPaginationLayer); |
| - |
| - RenderFlowThread* enclosingFlowThread = toRenderFlowThread(enclosingPaginationLayer()->renderer()); |
| - result = enclosingFlowThread->fragmentsBoundingBox(result); |
| - enclosingPaginationLayer()->convertToLayerCoords(ancestorLayer, result); |
| + convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result); |
| return result; |
| } |
| @@ -2316,40 +2339,36 @@ LayoutRect RenderLayer::boundingBoxForCompositing(const RenderLayer* ancestorLay |
| const bool shouldIncludeTransform = paintsWithTransform(PaintBehaviorNormal) || (options == ApplyBoundsChickenEggHacks && transform()); |
|
Julien - ping for review
2014/10/13 19:25:02
This looks like it should be moved when needed bel
mstensho (USE GERRIT)
2014/10/13 20:47:25
Done.
|
| - LayoutRect localClipRect = clipper().localClipRect(); |
| - if (localClipRect != PaintInfo::infiniteRect()) { |
| - if (shouldIncludeTransform) |
| - localClipRect = transform()->mapRect(localClipRect); |
| + LayoutRect result = clipper().localClipRect(); |
| + if (result == PaintInfo::infiniteRect()) { |
| + LayoutPoint origin; |
| + result = physicalBoundingBox(ancestorLayer, &origin); |
| - LayoutPoint delta; |
| - convertToLayerCoords(ancestorLayer, delta); |
| - localClipRect.moveBy(delta); |
| - return localClipRect; |
| - } |
| - |
| - LayoutPoint origin; |
| - LayoutRect result = physicalBoundingBox(ancestorLayer, &origin); |
| - |
| - const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
| + const_cast<RenderLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); |
| - // Reflections are implemented with RenderLayers that hang off of the reflected layer. However, |
| - // the reflection layer subtree does not include the subtree of the parent RenderLayer, so |
| - // a recursive computation of stacking children yields no results. This breaks cases when there are stacking |
| - // children of the parent, that need to be included in reflected composited bounds. |
| - // Fix this by including composited bounds of stacking children of the reflected RenderLayer. |
| - if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this) |
| - expandRectForReflectionAndStackingChildren(parent(), options, result); |
| - else |
| - expandRectForReflectionAndStackingChildren(this, options, result); |
| + // Reflections are implemented with RenderLayers that hang off of the reflected layer. However, |
| + // the reflection layer subtree does not include the subtree of the parent RenderLayer, so |
| + // a recursive computation of stacking children yields no results. This breaks cases when there are stacking |
| + // children of the parent, that need to be included in reflected composited bounds. |
| + // Fix this by including composited bounds of stacking children of the reflected RenderLayer. |
| + if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this) |
| + expandRectForReflectionAndStackingChildren(parent(), options, result); |
| + else |
| + expandRectForReflectionAndStackingChildren(this, options, result); |
| - // FIXME: We can optimize the size of the composited layers, by not enlarging |
| - // filtered areas with the outsets if we know that the filter is going to render in hardware. |
| - // https://bugs.webkit.org/show_bug.cgi?id=81239 |
| - m_renderer->style()->filterOutsets().expandRect(result); |
| + // FIXME: We can optimize the size of the composited layers, by not enlarging |
| + // filtered areas with the outsets if we know that the filter is going to render in hardware. |
| + // https://bugs.webkit.org/show_bug.cgi?id=81239 |
| + m_renderer->style()->filterOutsets().expandRect(result); |
| + } |
| if (shouldIncludeTransform) |
| result = transform()->mapRect(result); |
| + if (enclosingPaginationLayer()) { |
| + convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result); |
| + return result; |
| + } |
| LayoutPoint delta; |
| convertToLayerCoords(ancestorLayer, delta); |
| result.moveBy(delta); |