Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
index 7bb1bae8ee63a317d586216baf13caabb48db6be..952029810cf562498b8636b304803b5329708ab5 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp |
@@ -268,10 +268,27 @@ void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, Clip |
adjustClipRectsForChildren(m_layoutObject, clipRects); |
if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) { |
- // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across |
- // some transformed layer boundary, for example, in the PaintLayerCompositor overlapMap, where |
- // clipRects are needed in view space. |
- applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObject.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipRects); |
+ PaintLayer* layer = m_layoutObject.layer(); |
+ LayoutPoint offset; |
+ if (!layer->enclosingPaginationLayer()) { |
+ // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across |
+ // some transformed layer boundary, for example, in the PaintLayerCompositor overlapMap, where |
+ // clipRects are needed in view space. |
+ |
+ // TODO(mstensho): Switch to always using convertToLayerCoords() (see code further |
chrishtr
2015/11/19 23:31:41
localToContainerPoint is actually incorrect here,
mstensho (USE GERRIT)
2015/11/20 10:37:15
Makes sense.
chrishtr
2015/12/08 22:56:07
The point I was getting at with asking what the ro
|
+ // below). Using localToContainerPoint() unfortunately seems necessary in some rare |
+ // cases, but isn't it bad that we need to cross transformed layer boundaries here? |
+ // localToContainerPoint() is multicol-aware (as well as being transforms-aware, which |
+ // is the reason why it's called here in the first place, in favor of |
+ // convertToLayerCoords()), in that it converts from flowthread coordinates to visual |
+ // coordinates. That won't work, because clip rectangles are... well... rectangles, so |
+ // they are calculated before everything is sliced and translated into columns (at |
+ // which point each column will get its own slice of the clip rectangle). |
+ offset = roundedLayoutPoint(m_layoutObject.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())); |
+ } else { |
+ m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset); |
+ } |
+ applyClipRects(context, m_layoutObject, offset, clipRects); |
} |
} |