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

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

Issue 1155093004: Don't paint a border after the last frame on any axis in a frameset (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 | « LayoutTests/fast/frames/frame-set-too-many-frames-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/FrameSetPainter.cpp
diff --git a/Source/core/paint/FrameSetPainter.cpp b/Source/core/paint/FrameSetPainter.cpp
index a45306f5746b341e49940b9c69978072be6bb124..53876abc3ed0632a035c7d35a8660c68bfeaada8 100644
--- a/Source/core/paint/FrameSetPainter.cpp
+++ b/Source/core/paint/FrameSetPainter.cpp
@@ -62,6 +62,12 @@ void FrameSetPainter::paintRowBorder(const PaintInfo& paintInfo, const IntRect&
}
}
+static bool shouldPaintBorderAfter(const LayoutFrameSet::GridAxis& axis, size_t index)
+{
+ // Should not paint a border after the last frame along the axis.
+ return index + 1 < axis.m_sizes.size() && axis.m_allowBorder[index + 1];
chrishtr 2015/06/05 18:57:27 Why index + 1 < axis.m_sizes.size() and not index
fs 2015/06/05 19:18:46 index is in [0, size()-1], so the latter will alwa
+}
+
void FrameSetPainter::paintBorders(const PaintInfo& paintInfo, const LayoutPoint& adjustedPaintOffset)
{
LayoutRect adjustedFrameRect(adjustedPaintOffset, m_layoutFrameSet.size());
@@ -69,16 +75,19 @@ void FrameSetPainter::paintBorders(const PaintInfo& paintInfo, const LayoutPoint
if (recorder.canUseCachedDrawing())
return;
+ LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border();
+ if (!borderThickness)
+ return;
+
LayoutObject* child = m_layoutFrameSet.firstChild();
size_t rows = m_layoutFrameSet.rows().m_sizes.size();
size_t cols = m_layoutFrameSet.columns().m_sizes.size();
- LayoutUnit borderThickness = m_layoutFrameSet.frameSet()->border();
LayoutUnit yPos = 0;
for (size_t r = 0; r < rows; r++) {
LayoutUnit xPos = 0;
for (size_t c = 0; c < cols; c++) {
xPos += m_layoutFrameSet.columns().m_sizes[c];
- if (borderThickness && m_layoutFrameSet.columns().m_allowBorder[c + 1]) {
+ if (shouldPaintBorderAfter(m_layoutFrameSet.columns(), c)) {
paintColumnBorder(paintInfo, pixelSnappedIntRect(
LayoutRect(adjustedPaintOffset.x() + xPos, adjustedPaintOffset.y() + yPos, borderThickness, m_layoutFrameSet.size().height())));
xPos += borderThickness;
@@ -88,7 +97,7 @@ void FrameSetPainter::paintBorders(const PaintInfo& paintInfo, const LayoutPoint
return;
}
yPos += m_layoutFrameSet.rows().m_sizes[r];
- if (borderThickness && m_layoutFrameSet.rows().m_allowBorder[r + 1]) {
+ if (shouldPaintBorderAfter(m_layoutFrameSet.rows(), r)) {
paintRowBorder(paintInfo, pixelSnappedIntRect(
LayoutRect(adjustedPaintOffset.x(), adjustedPaintOffset.y() + yPos, m_layoutFrameSet.size().width(), borderThickness)));
yPos += borderThickness;
« no previous file with comments | « LayoutTests/fast/frames/frame-set-too-many-frames-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698