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/TableCellPainter.h" | 6 #include "core/paint/TableCellPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutTableCell.h" | 8 #include "core/layout/LayoutTableCell.h" |
9 #include "core/layout/PaintInfo.h" | 9 #include "core/layout/PaintInfo.h" |
10 #include "core/paint/BlockPainter.h" | 10 #include "core/paint/BlockPainter.h" |
11 #include "core/paint/BoxPainter.h" | 11 #include "core/paint/BoxPainter.h" |
12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 inline CollapsedBorderValue TableCellPainter::cachedCollapsedLeftBorder(const La
youtStyle& styleForCellFlow) const | 16 inline CollapsedBorderValue TableCellPainter::cachedCollapsedLeftBorder(const Co
mputedStyle& styleForCellFlow) const |
17 { | 17 { |
18 if (styleForCellFlow.isHorizontalWritingMode()) { | 18 if (styleForCellFlow.isHorizontalWritingMode()) { |
19 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart) | 19 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart) |
20 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSEnd); | 20 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSEnd); |
21 } | 21 } |
22 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSAfter) | 22 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSAfter) |
23 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSBefore); | 23 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSBefore); |
24 } | 24 } |
25 | 25 |
26 inline CollapsedBorderValue TableCellPainter::cachedCollapsedRightBorder(const L
ayoutStyle& styleForCellFlow) const | 26 inline CollapsedBorderValue TableCellPainter::cachedCollapsedRightBorder(const C
omputedStyle& styleForCellFlow) const |
27 { | 27 { |
28 if (styleForCellFlow.isHorizontalWritingMode()) { | 28 if (styleForCellFlow.isHorizontalWritingMode()) { |
29 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd) | 29 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd) |
30 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSStart); | 30 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSStart); |
31 } | 31 } |
32 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore) | 32 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCell.se
ction()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore) |
33 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSAfter); | 33 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSAfter); |
34 } | 34 } |
35 | 35 |
36 inline CollapsedBorderValue TableCellPainter::cachedCollapsedTopBorder(const Lay
outStyle& styleForCellFlow) const | 36 inline CollapsedBorderValue TableCellPainter::cachedCollapsedTopBorder(const Com
putedStyle& styleForCellFlow) const |
37 { | 37 { |
38 if (styleForCellFlow.isHorizontalWritingMode()) | 38 if (styleForCellFlow.isHorizontalWritingMode()) |
39 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel
l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSAfter) : m_layoutTable
Cell.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore); | 39 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel
l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSAfter) : m_layoutTable
Cell.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore); |
40 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio
n()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart) : m_layoutTableCell.sec
tion()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd); | 40 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio
n()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart) : m_layoutTableCell.sec
tion()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd); |
41 } | 41 } |
42 | 42 |
43 inline CollapsedBorderValue TableCellPainter::cachedCollapsedBottomBorder(const
LayoutStyle& styleForCellFlow) const | 43 inline CollapsedBorderValue TableCellPainter::cachedCollapsedBottomBorder(const
ComputedStyle& styleForCellFlow) const |
44 { | 44 { |
45 if (styleForCellFlow.isHorizontalWritingMode()) { | 45 if (styleForCellFlow.isHorizontalWritingMode()) { |
46 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel
l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore) | 46 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel
l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore) |
47 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSAfter); | 47 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC
ell, CBSAfter); |
48 } | 48 } |
49 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio
n()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd) | 49 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio
n()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd) |
50 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSStart); | 50 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell,
CBSStart); |
51 } | 51 } |
52 | 52 |
53 void TableCellPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) | 53 void TableCellPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (drawingCullRect.maxY() <= paintInfo.rect.y()) | 132 if (drawingCullRect.maxY() <= paintInfo.rect.y()) |
133 return; | 133 return; |
134 | 134 |
135 if (!m_layoutTableCell.table()->currentBorderValue()) | 135 if (!m_layoutTableCell.table()->currentBorderValue()) |
136 return; | 136 return; |
137 | 137 |
138 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, p
aintInfo.phase, drawingCullRect); | 138 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, p
aintInfo.phase, drawingCullRect); |
139 if (recorder.canUseCachedDrawing()) | 139 if (recorder.canUseCachedDrawing()) |
140 return; | 140 return; |
141 | 141 |
142 const LayoutStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow(); | 142 const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow()
; |
143 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); | 143 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); |
144 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow)
; | 144 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow)
; |
145 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); | 145 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); |
146 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo
w); | 146 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo
w); |
147 | 147 |
148 // Adjust our x/y/width/height so that we paint the collapsed borders at the
correct location. | 148 // Adjust our x/y/width/height so that we paint the collapsed borders at the
correct location. |
149 int topWidth = topVal.width(); | 149 int topWidth = topVal.width(); |
150 int bottomWidth = bottomVal.width(); | 150 int bottomWidth = bottomVal.width(); |
151 int leftWidth = leftVal.width(); | 151 int leftWidth = leftVal.width(); |
152 int rightWidth = rightVal.width(); | 152 int rightWidth = rightVal.width(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) | 261 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) |
262 { | 262 { |
263 LayoutPoint adjustedPaintOffset = paintOffset; | 263 LayoutPoint adjustedPaintOffset = paintOffset; |
264 if (paintBoundOffsetBehavior == AddOffsetFromParent) | 264 if (paintBoundOffsetBehavior == AddOffsetFromParent) |
265 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); | 265 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); |
266 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); | 266 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); |
267 } | 267 } |
268 | 268 |
269 } // namespace blink | 269 } // namespace blink |
270 | 270 |
OLD | NEW |