Chromium Code Reviews| 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 |