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 "core/paint/TablePainter.h" | 5 #include "core/paint/TablePainter.h" |
6 | 6 |
7 #include "core/layout/LayoutTable.h" | 7 #include "core/layout/LayoutTable.h" |
8 #include "core/layout/LayoutTableSection.h" | 8 #include "core/layout/LayoutTableSection.h" |
9 #include "core/style/CollapsedBorderValue.h" | 9 #include "core/style/CollapsedBorderValue.h" |
10 #include "core/paint/BoxClipper.h" | 10 #include "core/paint/BoxClipper.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && | 39 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && |
40 (child->isTableSection() || child->isTableCaption())) { | 40 (child->isTableSection() || child->isTableCaption())) { |
41 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild( | 41 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild( |
42 toLayoutBox(child), paintOffset); | 42 toLayoutBox(child), paintOffset); |
43 child->paint(paintInfoForDescendants, childPoint); | 43 child->paint(paintInfoForDescendants, childPoint); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 if (m_layoutTable.collapseBorders() && | 47 if (m_layoutTable.collapseBorders() && |
48 shouldPaintDescendantBlockBackgrounds(paintPhase) && | 48 shouldPaintDescendantBlockBackgrounds(paintPhase) && |
49 m_layoutTable.style()->visibility() == EVisibility::Visible) { | 49 m_layoutTable.style()->visibility() == EVisibility::kVisible) { |
50 // Using our cached sorted styles, we then do individual passes, | 50 // Using our cached sorted styles, we then do individual passes, |
51 // painting each style of border from lowest precedence to highest | 51 // painting each style of border from lowest precedence to highest |
52 // precedence. | 52 // precedence. |
53 LayoutTable::CollapsedBorderValues collapsedBorders = | 53 LayoutTable::CollapsedBorderValues collapsedBorders = |
54 m_layoutTable.collapsedBorders(); | 54 m_layoutTable.collapsedBorders(); |
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 for (LayoutTableSection* section = m_layoutTable.bottomSection(); | 57 for (LayoutTableSection* section = m_layoutTable.bottomSection(); |
58 section; section = m_layoutTable.sectionAbove(section)) { | 58 section; section = m_layoutTable.sectionAbove(section)) { |
59 LayoutPoint childPoint = | 59 LayoutPoint childPoint = |
60 m_layoutTable.flipForWritingModeForChild(section, paintOffset); | 60 m_layoutTable.flipForWritingModeForChild(section, paintOffset); |
61 TableSectionPainter(*section).paintCollapsedBorders( | 61 TableSectionPainter(*section).paintCollapsedBorders( |
62 paintInfoForDescendants, childPoint, collapsedBorders[i]); | 62 paintInfoForDescendants, childPoint, collapsedBorders[i]); |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 if (shouldPaintSelfOutline(paintPhase)) | 68 if (shouldPaintSelfOutline(paintPhase)) |
69 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); | 69 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); |
70 } | 70 } |
71 | 71 |
72 void TablePainter::paintBoxDecorationBackground( | 72 void TablePainter::paintBoxDecorationBackground( |
73 const PaintInfo& paintInfo, | 73 const PaintInfo& paintInfo, |
74 const LayoutPoint& paintOffset) { | 74 const LayoutPoint& paintOffset) { |
75 if (!m_layoutTable.hasBoxDecorationBackground() || | 75 if (!m_layoutTable.hasBoxDecorationBackground() || |
76 m_layoutTable.style()->visibility() != EVisibility::Visible) | 76 m_layoutTable.style()->visibility() != EVisibility::kVisible) |
77 return; | 77 return; |
78 | 78 |
79 LayoutRect rect(paintOffset, m_layoutTable.size()); | 79 LayoutRect rect(paintOffset, m_layoutTable.size()); |
80 m_layoutTable.subtractCaptionRect(rect); | 80 m_layoutTable.subtractCaptionRect(rect); |
81 BoxPainter(m_layoutTable) | 81 BoxPainter(m_layoutTable) |
82 .paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, rect); | 82 .paintBoxDecorationBackgroundWithRect(paintInfo, paintOffset, rect); |
83 } | 83 } |
84 | 84 |
85 void TablePainter::paintMask(const PaintInfo& paintInfo, | 85 void TablePainter::paintMask(const PaintInfo& paintInfo, |
86 const LayoutPoint& paintOffset) { | 86 const LayoutPoint& paintOffset) { |
87 if (m_layoutTable.style()->visibility() != EVisibility::Visible || | 87 if (m_layoutTable.style()->visibility() != EVisibility::kVisible || |
88 paintInfo.phase != PaintPhaseMask) | 88 paintInfo.phase != PaintPhaseMask) |
89 return; | 89 return; |
90 | 90 |
91 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 91 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
92 paintInfo.context, m_layoutTable, paintInfo.phase)) | 92 paintInfo.context, m_layoutTable, paintInfo.phase)) |
93 return; | 93 return; |
94 | 94 |
95 LayoutRect rect(paintOffset, m_layoutTable.size()); | 95 LayoutRect rect(paintOffset, m_layoutTable.size()); |
96 m_layoutTable.subtractCaptionRect(rect); | 96 m_layoutTable.subtractCaptionRect(rect); |
97 | 97 |
98 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, | 98 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, |
99 paintInfo.phase, rect); | 99 paintInfo.phase, rect); |
100 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); | 100 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
OLD | NEW |