Index: third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp |
index c2ffb57d6b0f1d4e116b43903d8f17fd1b3ab2ff..dfdde1ccae781ff8e5d9551a99ff35e0506189d4 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp |
@@ -476,4 +476,66 @@ LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const |
return portionRect; |
} |
+bool LayoutMultiColumnSet::computeColumnRuleBounds(const LayoutPoint& paintOffset, Vector<LayoutRect>& columnRuleBounds) const |
+{ |
+ if (flowThread()->isLayoutPagedFlowThread()) |
+ return false; |
+ |
+ const ComputedStyle& blockStyle = multiColumnBlockFlow()->styleRef(); |
wkorman
2016/07/01 19:32:24
Maybe helpful to naive eng to link to spec in a co
chrishtr
2016/07/01 22:31:32
Done.
|
+ bool ruleTransparent = blockStyle.columnRuleIsTransparent(); |
+ EBorderStyle ruleStyle = blockStyle.columnRuleStyle(); |
+ LayoutUnit ruleThickness(blockStyle.columnRuleWidth()); |
+ LayoutUnit colGap = columnGap(); |
+ bool renderRule = ruleStyle > BorderStyleHidden && !ruleTransparent; |
+ if (!renderRule) |
+ return false; |
+ |
+ unsigned colCount = actualColumnCount(); |
+ if (colCount <= 1) |
+ return false; |
+ |
+ bool leftToRight = style()->isLeftToRightDirection(); |
+ LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogicalWidth(); |
+ LayoutUnit ruleAdd = borderAndPaddingLogicalLeft(); |
+ LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidth(); |
+ LayoutUnit inlineDirectionSize = pageLogicalWidth(); |
+ |
+ for (unsigned i = 0; i < colCount; i++) { |
+ // Move to the next position. |
+ if (leftToRight) { |
+ ruleLogicalLeft += inlineDirectionSize + colGap / 2; |
+ currLogicalLeftOffset += inlineDirectionSize + colGap; |
+ } else { |
+ ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); |
+ currLogicalLeftOffset -= (inlineDirectionSize + colGap); |
+ } |
+ |
+ // Now paint the column rule. |
wkorman
2016/07/01 19:32:24
Update comment, just accumulating bounds vs painti
chrishtr
2016/07/01 22:31:32
Done.
|
+ if (i < colCount - 1) { |
+ LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft(); |
wkorman
2016/07/01 19:32:24
nit: hard to read, maybe split into if/else block
chrishtr
2016/07/01 22:31:32
Good idea, done.
|
+ LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth(); |
+ LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd; |
+ LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness; |
+ |
+ columnRuleBounds.append(LayoutRect(ruleLeft, ruleTop, ruleRight - ruleLeft, ruleBottom - ruleTop)); |
+ } |
+ |
+ ruleLogicalLeft = currLogicalLeftOffset; |
+ } |
+ return true; |
+} |
+ |
+LayoutRect LayoutMultiColumnSet::localOverflowRectForPaintInvalidation() const |
+{ |
+ LayoutRect blockFlowBounds = LayoutBlockFlow::localOverflowRectForPaintInvalidation(); |
+ |
+ // Now add in column rule bounds, if present. |
+ Vector<LayoutRect> columnRuleBounds; |
+ if (computeColumnRuleBounds(LayoutPoint(), columnRuleBounds)) { |
+ for (auto& bound : columnRuleBounds) |
+ blockFlowBounds.unite(bound); |
+ } |
+ return blockFlowBounds; |
+} |
+ |
} // namespace blink |