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/TablePainter.h" | 6 #include "core/paint/TablePainter.h" |
7 | 7 |
8 #include "core/layout/LayoutTable.h" | 8 #include "core/layout/LayoutTable.h" |
9 #include "core/layout/LayoutTableSection.h" | 9 #include "core/layout/LayoutTableSection.h" |
10 #include "core/style/CollapsedBorderValue.h" | 10 #include "core/style/CollapsedBorderValue.h" |
11 #include "core/paint/BoxClipper.h" | 11 #include "core/paint/BoxClipper.h" |
12 #include "core/paint/BoxPainter.h" | 12 #include "core/paint/BoxPainter.h" |
13 #include "core/paint/LayoutObjectDrawingRecorder.h" | 13 #include "core/paint/LayoutObjectDrawingRecorder.h" |
14 #include "core/paint/ObjectPainter.h" | 14 #include "core/paint/ObjectPainter.h" |
15 #include "core/paint/PaintInfo.h" | 15 #include "core/paint/PaintInfo.h" |
16 #include "core/paint/ScopeRecorder.h" | 16 #include "core/paint/ScopeRecorder.h" |
| 17 #include "core/paint/TableSectionPainter.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 21 void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
21 { | 22 { |
22 PaintPhase paintPhase = paintInfo.phase; | 23 PaintPhase paintPhase = paintInfo.phase; |
23 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_layoutTable.hasBoxDecorationBackground() && m_layoutTable
.style()->visibility() == VISIBLE) | 24 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_layoutTable.hasBoxDecorationBackground() && m_layoutTable
.style()->visibility() == VISIBLE) |
24 paintBoxDecorationBackground(paintInfo, paintOffset); | 25 paintBoxDecorationBackground(paintInfo, paintOffset); |
25 | 26 |
26 if (paintPhase == PaintPhaseMask) { | 27 if (paintPhase == PaintPhaseMask) { |
(...skipping 16 matching lines...) Expand all Loading... |
43 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = child-
>nextSibling()) { | 44 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = child-
>nextSibling()) { |
44 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (ch
ild->isTableSection() || child->isTableCaption())) { | 45 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (ch
ild->isTableSection() || child->isTableCaption())) { |
45 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(to
LayoutBox(child), paintOffset); | 46 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(to
LayoutBox(child), paintOffset); |
46 child->paint(info, childPoint); | 47 child->paint(info, childPoint); |
47 } | 48 } |
48 } | 49 } |
49 | 50 |
50 if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseChildBlockBac
kground && m_layoutTable.style()->visibility() == VISIBLE) { | 51 if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseChildBlockBac
kground && m_layoutTable.style()->visibility() == VISIBLE) { |
51 // Using our cached sorted styles, we then do individual passes, | 52 // Using our cached sorted styles, we then do individual passes, |
52 // painting each style of border from lowest precedence to highest prece
dence. | 53 // painting each style of border from lowest precedence to highest prece
dence. |
53 info.phase = PaintPhaseCollapsedTableBorders; | |
54 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.coll
apsedBorders(); | 54 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.coll
apsedBorders(); |
55 size_t count = collapsedBorders.size(); | 55 size_t count = collapsedBorders.size(); |
56 for (size_t i = 0; i < count; ++i) { | 56 for (size_t i = 0; i < count; ++i) { |
57 // FIXME: pass this value into children rather than storing temporar
ily on the LayoutTable object. | |
58 m_layoutTable.setCurrentBorderValue(&collapsedBorders[i]); | |
59 for (LayoutTableSection* section = m_layoutTable.bottomSection(); se
ction; section = m_layoutTable.sectionAbove(section)) { | 57 for (LayoutTableSection* section = m_layoutTable.bottomSection(); se
ction; section = m_layoutTable.sectionAbove(section)) { |
60 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(section, paintOffset); | 58 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(section, paintOffset); |
61 section->paint(info, childPoint); | 59 TableSectionPainter(*section).paintCollapsedBorders(info, childP
oint, collapsedBorders[i]); |
62 } | 60 } |
63 } | 61 } |
64 m_layoutTable.setCurrentBorderValue(0); | |
65 } | 62 } |
66 | 63 |
67 // Paint outline. | 64 // Paint outline. |
68 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutTable.style()->hasOutline() && m_layoutTable.style()->visibility() =
= VISIBLE) | 65 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutTable.style()->hasOutline() && m_layoutTable.style()->visibility() =
= VISIBLE) |
69 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); | 66 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); |
70 } | 67 } |
71 | 68 |
72 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) | 69 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) |
73 { | 70 { |
74 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTable)) | 71 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTable)) |
(...skipping 13 matching lines...) Expand all Loading... |
88 return; | 85 return; |
89 | 86 |
90 LayoutRect rect(paintOffset, m_layoutTable.size()); | 87 LayoutRect rect(paintOffset, m_layoutTable.size()); |
91 m_layoutTable.subtractCaptionRect(rect); | 88 m_layoutTable.subtractCaptionRect(rect); |
92 | 89 |
93 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTable, pain
tInfo.phase, rect, paintOffset); | 90 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTable, pain
tInfo.phase, rect, paintOffset); |
94 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); | 91 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); |
95 } | 92 } |
96 | 93 |
97 } // namespace blink | 94 } // namespace blink |
OLD | NEW |