Index: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
index 0a6252bb97619ba13f0f2ee27db062730789b882..577e3faed94dfbf51e8e375afe24aa6efc97120b 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp |
@@ -454,9 +454,23 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(Graphi |
ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(clipRectsContext); |
} |
+ LayoutObject* object = m_paintLayer.layoutObject(); |
+ LayoutView* view = object->view(); |
+ bool isFixedPosObjectInPagedMedia = object->style()->position() == FixedPosition && view->pageLogicalHeight(); |
Xianzhu
2016/03/21 19:37:18
We should exclude the case that the view is not th
|
PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer(); |
PaintLayerFragments fragments; |
- if (paginationLayer) { |
+ if (isFixedPosObjectInPagedMedia) { |
+ // "For paged media, boxes with fixed positions are repeated on every page." |
Xianzhu
2016/03/21 19:37:18
Nit: include the link of source of the above state
|
+ ASSERT(view->firstChild() && view->firstChild()->isLayoutBlock()); |
+ int pages = toLayoutBlock(view->firstChild())->logicalHeight() / view->pageLogicalHeight(); |
+ LayoutPoint paginationOffset; |
+ for (int i = 0; i <= pages; i++) { |
+ PaintLayerFragment fragment; |
+ fragment.paginationOffset = paginationOffset; |
+ fragments.append(fragment); |
+ paginationOffset += LayoutPoint(0, view->pageLogicalHeight()); |
+ } |
+ } else if (paginationLayer) { |
// FIXME: This is a mess. Look closely at this code and the code in Layer and fix any |
// issues in it & refactor to make it obvious from code structure what it does and that it's |
// correct. |
@@ -484,7 +498,7 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(Graphi |
if (needsScope) |
scopeRecorder.emplace(context); |
Optional<LayerClipRecorder> clipRecorder; |
- if (parentLayer) { |
+ if (parentLayer && !isFixedPosObjectInPagedMedia) { |
Xianzhu
2016/03/21 19:37:18
I think we should still clip (especially css clip)
|
ClipRect clipRectForFragment(ancestorBackgroundClipRect); |
clipRectForFragment.moveBy(fragment.paginationOffset); |
clipRectForFragment.intersect(fragment.backgroundRect); |