| Index: Source/core/paint/BlockPainter.cpp
|
| diff --git a/Source/core/paint/BlockPainter.cpp b/Source/core/paint/BlockPainter.cpp
|
| index fae17489918f6045b2d8ff76a5185851c134a180..2d1b0a0eb00a4a51274a09a17f231a9f8d6d062a 100644
|
| --- a/Source/core/paint/BlockPainter.cpp
|
| +++ b/Source/core/paint/BlockPainter.cpp
|
| @@ -29,19 +29,13 @@ namespace blink {
|
|
|
| void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
|
| {
|
| - PaintInfo localPaintInfo(paintInfo);
|
| + if (!isVisibleInPaintRect(paintInfo, paintOffset))
|
| + return;
|
|
|
| LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
|
| -
|
| + PaintInfo localPaintInfo(paintInfo);
|
| PaintPhase originalPhase = localPaintInfo.phase;
|
|
|
| - // Check if we need to do anything at all.
|
| - LayoutRect overflowBox = overflowRectForPaintRejection();
|
| - m_layoutBlock.flipForWritingMode(overflowBox);
|
| - overflowBox.moveBy(adjustedPaintOffset);
|
| - if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect)))
|
| - return;
|
| -
|
| // There are some cases where not all clipped visual overflow is accounted for.
|
| // FIXME: reduce the number of such cases.
|
| ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
|
| @@ -240,15 +234,16 @@ void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& pa
|
| dragCaretController.paintDragCaret(frame, paintInfo.context, paintOffset, LayoutRect(paintInfo.rect));
|
| }
|
|
|
| -LayoutRect BlockPainter::overflowRectForPaintRejection() const
|
| +bool BlockPainter::isVisibleInPaintRect(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
|
| {
|
| LayoutRect overflowRect = m_layoutBlock.visualOverflowRect();
|
| - if (!m_layoutBlock.hasOverflowModel() || !m_layoutBlock.usesCompositedScrolling())
|
| - return overflowRect;
|
| -
|
| - overflowRect.unite(m_layoutBlock.layoutOverflowRect());
|
| - overflowRect.move(-m_layoutBlock.scrolledContentOffset());
|
| - return overflowRect;
|
| + if (m_layoutBlock.hasOverflowModel() && m_layoutBlock.usesCompositedScrolling()) {
|
| + overflowRect.unite(m_layoutBlock.layoutOverflowRect());
|
| + overflowRect.move(-m_layoutBlock.scrolledContentOffset());
|
| + }
|
| + m_layoutBlock.flipForWritingMode(overflowRect);
|
| + overflowRect.moveBy(paintOffset + m_layoutBlock.location());
|
| + return (overflowRect.intersects(LayoutRect(paintInfo.rect)));
|
| }
|
|
|
| bool BlockPainter::hasCaret() const
|
|
|