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

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, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50cf8909f8d7707404891c2771710465986c82a3..cc6d5fd5d73adc42bff391586b628d64da7ef9dd 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -461,9 +461,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.
@@ -493,7 +509,10 @@ PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(Graphi
Optional<LayerClipRecorder> clipRecorder;
if (parentLayer) {
ClipRect clipRectForFragment(ancestorBackgroundClipRect);
- clipRectForFragment.moveBy(fragment.paginationOffset);
+ // A fixed-position object is repeated on every page, but if it is clipped by an ancestor layer then
+ // the repetitions are clipped out.
+ if (!isFixedPosObjectInPagedMedia)
+ clipRectForFragment.moveBy(fragment.paginationOffset);
clipRectForFragment.intersect(fragment.backgroundRect);
if (clipRectForFragment.isEmpty())
continue;
« no previous file with comments | « third_party/WebKit/LayoutTests/printing/fixed-positioned-headers-and-footers-larger-than-page-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698