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

Unified Diff: Source/core/paint/BlockPainter.cpp

Issue 1312493007: Fix table cell background caching issue about interest rect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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: 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

Powered by Google App Engine
This is Rietveld 408576698