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

Unified Diff: third_party/WebKit/Source/core/paint/BlockPainter.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: Created 4 years, 11 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/Source/core/paint/BlockPainter.h ('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/BlockPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.cpp b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
index be32974edac3edfc798fc3d83168dcca42f59ae0..3a8f8ca70e35fb1043e6768bdffa835157965257 100644
--- a/third_party/WebKit/Source/core/paint/BlockPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
@@ -10,6 +10,7 @@
#include "core/layout/LayoutBlockFlow.h"
#include "core/layout/LayoutFlexibleBox.h"
#include "core/layout/LayoutInline.h"
+#include "core/layout/LayoutView.h"
#include "core/layout/api/LineLayoutBox.h"
#include "core/page/Page.h"
#include "core/paint/BoxClipper.h"
@@ -69,6 +70,31 @@ void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset);
}
+void BlockPainter::paintFixedPositionObjectsOnAllPages(const PaintInfo& localPaintInfo, const LayoutPoint& paintOffset)
+{
+ // For paged media, boxes with fixed positions are repeated on every page.
mstensho (USE GERRIT) 2016/01/11 19:54:51 I think this approach is wrong. This would be in t
rhogan 2016/01/14 12:10:44 OK I don't have enough of a clue about painting to
Xianzhu 2016/02/24 19:22:51 I also think the current patch is incorrect about
rhogan 2016/02/25 20:33:04 When I do that it doesn't paint at all. --- a/th
+ if (!m_layoutBlock.parent() || !m_layoutBlock.parent()->isLayoutView())
+ return;
+
+ LayoutView* view = toLayoutView(m_layoutBlock.parent());
+ if (!view->pageLogicalHeight())
+ return;
+
+ TrackedLayoutBoxListHashSet* positionedDescendants = view->positionedObjects();
+ if (!positionedDescendants)
+ return;
+ int pages = m_layoutBlock.logicalHeight() / view->pageLogicalHeight();
+ for (auto* positionedObject : *positionedDescendants) {
+ if (positionedObject->style()->position() != FixedPosition)
+ continue;
+ LayoutPoint adjustedPaintOffset = paintOffset + toLayoutBlock(positionedObject)->location();
+ for (int i = 0; i < pages; i++) {
+ adjustedPaintOffset += LayoutPoint(0, view->pageLogicalHeight());
+ toLayoutBlock(positionedObject)->paintObject(localPaintInfo, adjustedPaintOffset);
+ }
+ }
+}
+
void BlockPainter::paintOverflowControlsIfNeeded(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
PaintPhase phase = paintInfo.phase;
@@ -270,6 +296,7 @@ void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint&
paintInfoForChild.updatePaintingRootForChildren(&m_layoutBlock);
m_layoutBlock.paintChildren(paintInfoForChild, paintOffset);
}
+ paintFixedPositionObjectsOnAllPages(paintInfo, paintOffset);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/paint/BlockPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698