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 23 matching lines...) Expand all Loading... |
34 if (paintPhase != PaintPhaseSelfOutlineOnly) { | 34 if (paintPhase != PaintPhaseSelfOutlineOnly) { |
35 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 35 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
36 | 36 |
37 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = ch
ild->nextSibling()) { | 37 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = ch
ild->nextSibling()) { |
38 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() &&
(child->isTableSection() || child->isTableCaption())) { | 38 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() &&
(child->isTableSection() || child->isTableCaption())) { |
39 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(toLayoutBox(child), paintOffset); | 39 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(toLayoutBox(child), paintOffset); |
40 child->paint(paintInfoForDescendants, childPoint); | 40 child->paint(paintInfoForDescendants, childPoint); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgro
unds(paintPhase) && m_layoutTable.style()->visibility() == VISIBLE) { | 44 if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgro
unds(paintPhase) && m_layoutTable.style()->visibility() == EVisibility::Visible)
{ |
45 // Using our cached sorted styles, we then do individual passes, | 45 // Using our cached sorted styles, we then do individual passes, |
46 // painting each style of border from lowest precedence to highest p
recedence. | 46 // painting each style of border from lowest precedence to highest p
recedence. |
47 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.
collapsedBorders(); | 47 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.
collapsedBorders(); |
48 size_t count = collapsedBorders.size(); | 48 size_t count = collapsedBorders.size(); |
49 for (size_t i = 0; i < count; ++i) { | 49 for (size_t i = 0; i < count; ++i) { |
50 for (LayoutTableSection* section = m_layoutTable.bottomSection()
; section; section = m_layoutTable.sectionAbove(section)) { | 50 for (LayoutTableSection* section = m_layoutTable.bottomSection()
; section; section = m_layoutTable.sectionAbove(section)) { |
51 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor
Child(section, paintOffset); | 51 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor
Child(section, paintOffset); |
52 TableSectionPainter(*section).paintCollapsedBorders(paintInf
oForDescendants, childPoint, collapsedBorders[i]); | 52 TableSectionPainter(*section).paintCollapsedBorders(paintInf
oForDescendants, childPoint, collapsedBorders[i]); |
53 } | 53 } |
54 } | 54 } |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 if (shouldPaintSelfOutline(paintPhase)) | 58 if (shouldPaintSelfOutline(paintPhase)) |
59 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); | 59 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); |
60 } | 60 } |
61 | 61 |
62 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) | 62 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) |
63 { | 63 { |
64 if (!m_layoutTable.hasBoxDecorationBackground() || m_layoutTable.style()->vi
sibility() != VISIBLE) | 64 if (!m_layoutTable.hasBoxDecorationBackground() || m_layoutTable.style()->vi
sibility() != EVisibility::Visible) |
65 return; | 65 return; |
66 | 66 |
67 LayoutRect rect(paintOffset, m_layoutTable.size()); | 67 LayoutRect rect(paintOffset, m_layoutTable.size()); |
68 m_layoutTable.subtractCaptionRect(rect); | 68 m_layoutTable.subtractCaptionRect(rect); |
69 BoxPainter(m_layoutTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa
intOffset, rect); | 69 BoxPainter(m_layoutTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa
intOffset, rect); |
70 } | 70 } |
71 | 71 |
72 void TablePainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) | 72 void TablePainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) |
73 { | 73 { |
74 if (m_layoutTable.style()->visibility() != VISIBLE || paintInfo.phase != Pai
ntPhaseMask) | 74 if (m_layoutTable.style()->visibility() != EVisibility::Visible || paintInfo
.phase != PaintPhaseMask) |
75 return; | 75 return; |
76 | 76 |
77 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTable, paintInfo.phase)) | 77 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTable, paintInfo.phase)) |
78 return; | 78 return; |
79 | 79 |
80 LayoutRect rect(paintOffset, m_layoutTable.size()); | 80 LayoutRect rect(paintOffset, m_layoutTable.size()); |
81 m_layoutTable.subtractCaptionRect(rect); | 81 m_layoutTable.subtractCaptionRect(rect); |
82 | 82 |
83 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint
Info.phase, rect); | 83 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint
Info.phase, rect); |
84 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); | 84 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); |
85 } | 85 } |
86 | 86 |
87 } // namespace blink | 87 } // namespace blink |
OLD | NEW |