| 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..6444caff3ea8b63a5d25bc0e75805bdaa85a0e20 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
|
| @@ -454,9 +454,25 @@ 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 && object->container() == view && view->pageLogicalHeight();
|
| PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
|
| PaintLayerFragments fragments;
|
| - if (paginationLayer) {
|
| + if (isFixedPosObjectInPagedMedia) {
|
| + // "For paged media, boxes with fixed positions are repeated on every page."
|
| + // - https://www.w3.org/TR/2011/REC-CSS2-20110607/visuren.html#fixed-positioning
|
| + 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.backgroundRect = paintingInfo.paintDirtyRect;
|
| + 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.
|
|
|