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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 1575983002: Display fixed position objects on every page of paged media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 9 months 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
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.

Powered by Google App Engine
This is Rietveld 408576698