| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/MultiColumnSetPainter.h" | 6 #include "core/paint/MultiColumnSetPainter.h" |
| 7 | 7 |
| 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/RenderDrawingRecorder.h" |
| 10 #include "core/rendering/PaintInfo.h" | 11 #include "core/rendering/PaintInfo.h" |
| 11 #include "core/rendering/RenderMultiColumnSet.h" | 12 #include "core/rendering/RenderMultiColumnSet.h" |
| 12 #include "platform/geometry/LayoutPoint.h" | 13 #include "platform/geometry/LayoutPoint.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 void MultiColumnSetPainter::paintObject(const PaintInfo& paintInfo, const Layout
Point& paintOffset) | 17 void MultiColumnSetPainter::paintObject(const PaintInfo& paintInfo, const Layout
Point& paintOffset) |
| 17 { | 18 { |
| 18 if (m_renderMultiColumnSet.style()->visibility() != VISIBLE) | 19 if (m_renderMultiColumnSet.style()->visibility() != VISIBLE) |
| 19 return; | 20 return; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 43 LayoutUnit ruleThickness = blockStyle->columnRuleWidth(); | 44 LayoutUnit ruleThickness = blockStyle->columnRuleWidth(); |
| 44 LayoutUnit colGap = m_renderMultiColumnSet.columnGap(); | 45 LayoutUnit colGap = m_renderMultiColumnSet.columnGap(); |
| 45 bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; | 46 bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; |
| 46 if (!renderRule) | 47 if (!renderRule) |
| 47 return; | 48 return; |
| 48 | 49 |
| 49 unsigned colCount = m_renderMultiColumnSet.actualColumnCount(); | 50 unsigned colCount = m_renderMultiColumnSet.actualColumnCount(); |
| 50 if (colCount <= 1) | 51 if (colCount <= 1) |
| 51 return; | 52 return; |
| 52 | 53 |
| 54 DrawingRecorder drawingRecorder(paintInfo.context, m_renderMultiColumnSet.di
splayItemClient(), DisplayItem::ColumnRules, m_renderMultiColumnSet.visualOverfl
owRect()); |
| 53 bool antialias = BoxPainter::shouldAntialiasLines(paintInfo.context); | 55 bool antialias = BoxPainter::shouldAntialiasLines(paintInfo.context); |
| 54 | |
| 55 bool leftToRight = m_renderMultiColumnSet.style()->isLeftToRightDirection(); | 56 bool leftToRight = m_renderMultiColumnSet.style()->isLeftToRightDirection(); |
| 56 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : m_renderMult
iColumnSet.contentLogicalWidth(); | 57 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : m_renderMult
iColumnSet.contentLogicalWidth(); |
| 57 LayoutUnit ruleAdd = m_renderMultiColumnSet.borderAndPaddingLogicalLeft(); | 58 LayoutUnit ruleAdd = m_renderMultiColumnSet.borderAndPaddingLogicalLeft(); |
| 58 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : m_renderMultiColum
nSet.contentLogicalWidth(); | 59 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : m_renderMultiColum
nSet.contentLogicalWidth(); |
| 59 LayoutUnit inlineDirectionSize = m_renderMultiColumnSet.pageLogicalWidth(); | 60 LayoutUnit inlineDirectionSize = m_renderMultiColumnSet.pageLogicalWidth(); |
| 60 BoxSide boxSide = m_renderMultiColumnSet.isHorizontalWritingMode() | 61 BoxSide boxSide = m_renderMultiColumnSet.isHorizontalWritingMode() |
| 61 ? leftToRight ? BSLeft : BSRight | 62 ? leftToRight ? BSLeft : BSRight |
| 62 : leftToRight ? BSTop : BSBottom; | 63 : leftToRight ? BSTop : BSBottom; |
| 63 | 64 |
| 64 for (unsigned i = 0; i < colCount; i++) { | 65 for (unsigned i = 0; i < colCount; i++) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 LayoutUnit ruleBottom = m_renderMultiColumnSet.isHorizontalWritingMo
de() ? ruleTop + m_renderMultiColumnSet.contentHeight() : ruleTop + ruleThicknes
s; | 80 LayoutUnit ruleBottom = m_renderMultiColumnSet.isHorizontalWritingMo
de() ? ruleTop + m_renderMultiColumnSet.contentHeight() : ruleTop + ruleThicknes
s; |
| 80 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft
, ruleTop, ruleRight, ruleBottom); | 81 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft
, ruleTop, ruleRight, ruleBottom); |
| 81 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappedRul
eRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRu
leRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); | 82 ObjectPainter::drawLineForBoxSide(paintInfo.context, pixelSnappedRul
eRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRu
leRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); |
| 82 } | 83 } |
| 83 | 84 |
| 84 ruleLogicalLeft = currLogicalLeftOffset; | 85 ruleLogicalLeft = currLogicalLeftOffset; |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 | 88 |
| 88 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |