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

Side by Side Diff: third_party/WebKit/Source/core/paint/MultiColumnSetPainter.cpp

Issue 2115013002: Include column rules for LayoutMultiColumnSet paint invalidation rects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/MultiColumnSetPainter.h" 5 #include "core/paint/MultiColumnSetPainter.h"
6 6
7 #include "core/layout/LayoutMultiColumnSet.h" 7 #include "core/layout/LayoutMultiColumnSet.h"
8 #include "core/paint/BlockPainter.h" 8 #include "core/paint/BlockPainter.h"
9 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
10 #include "core/paint/LayoutObjectDrawingRecorder.h" 10 #include "core/paint/LayoutObjectDrawingRecorder.h"
(...skipping 16 matching lines...) Expand all
27 // anyway, thus making it impossible for them to overlap one another. It's a lso really unlikely that the columns 27 // anyway, thus making it impossible for them to overlap one another. It's a lso really unlikely that the columns
28 // would overlap another block. 28 // would overlap another block.
29 if (!m_layoutMultiColumnSet.flowThread() || (paintInfo.phase != PaintPhaseFo reground && paintInfo.phase != PaintPhaseSelection)) 29 if (!m_layoutMultiColumnSet.flowThread() || (paintInfo.phase != PaintPhaseFo reground && paintInfo.phase != PaintPhaseSelection))
30 return; 30 return;
31 31
32 paintColumnRules(paintInfo, paintOffset); 32 paintColumnRules(paintInfo, paintOffset);
33 } 33 }
34 34
35 void MultiColumnSetPainter::paintColumnRules(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset) 35 void MultiColumnSetPainter::paintColumnRules(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset)
36 { 36 {
37 if (m_layoutMultiColumnSet.flowThread()->isLayoutPagedFlowThread()) 37 Vector<LayoutRect> columnRuleBounds;
38 return; 38 if (!m_layoutMultiColumnSet.computeColumnRuleBounds(paintOffset, columnRuleB ounds))
39
40 const ComputedStyle& blockStyle = m_layoutMultiColumnSet.multiColumnBlockFlo w()->styleRef();
41 const Color& ruleColor = m_layoutMultiColumnSet.resolveColor(blockStyle, CSS PropertyColumnRuleColor);
42 bool ruleTransparent = blockStyle.columnRuleIsTransparent();
43 EBorderStyle ruleStyle = blockStyle.columnRuleStyle();
44 LayoutUnit ruleThickness(blockStyle.columnRuleWidth());
45 LayoutUnit colGap = m_layoutMultiColumnSet.columnGap();
46 bool renderRule = ruleStyle > BorderStyleHidden && !ruleTransparent;
47 if (!renderRule)
48 return;
49
50 unsigned colCount = m_layoutMultiColumnSet.actualColumnCount();
51 if (colCount <= 1)
52 return; 39 return;
53 40
54 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutMultiColumnSet, DisplayItem::ColumnRules)) 41 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutMultiColumnSet, DisplayItem::ColumnRules))
55 return; 42 return;
56 43
57 LayoutRect paintRect = m_layoutMultiColumnSet.visualOverflowRect(); 44 LayoutRect paintRect = m_layoutMultiColumnSet.visualOverflowRect();
58 paintRect.moveBy(paintOffset); 45 paintRect.moveBy(paintOffset);
59 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutMulti ColumnSet, DisplayItem::ColumnRules, paintRect); 46 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutMulti ColumnSet, DisplayItem::ColumnRules, paintRect);
60 47
48 const ComputedStyle& blockStyle = m_layoutMultiColumnSet.multiColumnBlockFlo w()->styleRef();
49 EBorderStyle ruleStyle = blockStyle.columnRuleStyle();
61 bool leftToRight = m_layoutMultiColumnSet.style()->isLeftToRightDirection(); 50 bool leftToRight = m_layoutMultiColumnSet.style()->isLeftToRightDirection();
62 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : m_layoutMult iColumnSet.contentLogicalWidth();
63 LayoutUnit ruleAdd = m_layoutMultiColumnSet.borderAndPaddingLogicalLeft();
64 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : m_layoutMultiColum nSet.contentLogicalWidth();
65 LayoutUnit inlineDirectionSize = m_layoutMultiColumnSet.pageLogicalWidth();
66 BoxSide boxSide = m_layoutMultiColumnSet.isHorizontalWritingMode() 51 BoxSide boxSide = m_layoutMultiColumnSet.isHorizontalWritingMode()
67 ? leftToRight ? BSLeft : BSRight 52 ? leftToRight ? BSLeft : BSRight
68 : leftToRight ? BSTop : BSBottom; 53 : leftToRight ? BSTop : BSBottom;
54 const Color& ruleColor = m_layoutMultiColumnSet.resolveColor(blockStyle, CSS PropertyColumnRuleColor);
69 55
70 for (unsigned i = 0; i < colCount; i++) { 56 for (auto& bound : columnRuleBounds) {
71 // Move to the next position. 57 IntRect pixelSnappedRuleRect = pixelSnappedIntRect(bound);
72 if (leftToRight) { 58 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRec t.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRe ct.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, true);
73 ruleLogicalLeft += inlineDirectionSize + colGap / 2;
74 currLogicalLeftOffset += inlineDirectionSize + colGap;
75 } else {
76 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
77 currLogicalLeftOffset -= (inlineDirectionSize + colGap);
78 }
79
80 // Now paint the column rule.
81 if (i < colCount - 1) {
82 LayoutUnit ruleLeft = m_layoutMultiColumnSet.isHorizontalWritingMode () ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffs et.x() + m_layoutMultiColumnSet.borderLeft() + m_layoutMultiColumnSet.paddingLef t();
83 LayoutUnit ruleRight = m_layoutMultiColumnSet.isHorizontalWritingMod e() ? ruleLeft + ruleThickness : ruleLeft + m_layoutMultiColumnSet.contentWidth( );
84 LayoutUnit ruleTop = m_layoutMultiColumnSet.isHorizontalWritingMode( ) ? paintOffset.y() + m_layoutMultiColumnSet.borderTop() + m_layoutMultiColumnSe t.paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd ;
85 LayoutUnit ruleBottom = m_layoutMultiColumnSet.isHorizontalWritingMo de() ? ruleTop + m_layoutMultiColumnSet.contentHeight() : ruleTop + ruleThicknes s;
86 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft , ruleTop, ruleRight, ruleBottom);
87 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappedRul eRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRu leRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, true);
88 }
89
90 ruleLogicalLeft = currLogicalLeftOffset;
91 } 59 }
92 } 60 }
93 61
94 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698