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

Unified Diff: Source/core/layout/LayoutReplaced.cpp

Issue 1212213004: Simplify paint rect calculations in LayoutReplaced::shouldPaint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutReplaced.cpp
diff --git a/Source/core/layout/LayoutReplaced.cpp b/Source/core/layout/LayoutReplaced.cpp
index 7a6250239a1cd7d7684e5fc56643f443814f3a3e..80096013623213eb402c3d0f3951b4ee69efe83e 100644
--- a/Source/core/layout/LayoutReplaced.cpp
+++ b/Source/core/layout/LayoutReplaced.cpp
@@ -124,11 +124,12 @@ bool LayoutReplaced::shouldPaint(const PaintInfo& paintInfo, const LayoutPoint&
if (style()->visibility() != VISIBLE)
return false;
- LayoutPoint adjustedPaintOffset = paintOffset + location();
+ LayoutRect paintRect(visualOverflowRect());
+ paintRect.moveBy(paintOffset + location());
// Early exit if the element touches the edges.
- LayoutUnit top = adjustedPaintOffset.y() + visualOverflowRect().y();
- LayoutUnit bottom = adjustedPaintOffset.y() + visualOverflowRect().maxY();
+ LayoutUnit top = paintRect.y();
+ LayoutUnit bottom = paintRect.maxY();
if (isSelected() && inlineBoxWrapper()) {
LayoutUnit selTop = paintOffset.y() + inlineBoxWrapper()->root().selectionTop();
LayoutUnit selBottom = paintOffset.y() + selTop + inlineBoxWrapper()->root().selectionHeight();
@@ -136,7 +137,7 @@ bool LayoutReplaced::shouldPaint(const PaintInfo& paintInfo, const LayoutPoint&
bottom = std::max(selBottom, bottom);
}
- if (adjustedPaintOffset.x() + visualOverflowRect().x() >= paintInfo.rect.maxX() || adjustedPaintOffset.x() + visualOverflowRect().maxX() <= paintInfo.rect.x())
+ if (paintRect.x() >= paintInfo.rect.maxX() || paintRect.maxX() <= paintInfo.rect.x())
return false;
if (top >= paintInfo.rect.maxY() || bottom <= paintInfo.rect.y())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698