| 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/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/DrawingRecorder.h" | 9 #include "core/paint/DrawingRecorder.h" |
| 10 #include "core/paint/ObjectPainter.h" |
| 10 #include "core/rendering/GraphicsContextAnnotator.h" | 11 #include "core/rendering/GraphicsContextAnnotator.h" |
| 11 #include "core/rendering/PaintInfo.h" | 12 #include "core/rendering/PaintInfo.h" |
| 12 #include "core/rendering/RenderBoxClipper.h" | 13 #include "core/rendering/RenderBoxClipper.h" |
| 13 #include "core/rendering/RenderTable.h" | 14 #include "core/rendering/RenderTable.h" |
| 14 #include "core/rendering/RenderTableSection.h" | 15 #include "core/rendering/RenderTableSection.h" |
| 15 #include "core/rendering/style/CollapsedBorderValue.h" | 16 #include "core/rendering/style/CollapsedBorderValue.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 void TablePainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 20 void TablePainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 paintObject(paintInfo, adjustedPaintOffset); | 35 paintObject(paintInfo, adjustedPaintOffset); |
| 35 } | 36 } |
| 36 | 37 |
| 37 void TablePainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 38 void TablePainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
| 38 { | 39 { |
| 39 PaintPhase paintPhase = paintInfo.phase; | 40 PaintPhase paintPhase = paintInfo.phase; |
| 40 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderTable.hasBoxDecorationBackground() && m_renderTable
.style()->visibility() == VISIBLE) | 41 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && m_renderTable.hasBoxDecorationBackground() && m_renderTable
.style()->visibility() == VISIBLE) |
| 41 paintBoxDecorationBackground(paintInfo, paintOffset); | 42 paintBoxDecorationBackground(paintInfo, paintOffset); |
| 42 | 43 |
| 43 if (paintPhase == PaintPhaseMask) { | 44 if (paintPhase == PaintPhaseMask) { |
| 44 m_renderTable.paintMask(paintInfo, paintOffset); | 45 paintMask(paintInfo, paintOffset); |
| 45 return; | 46 return; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // We're done. We don't bother painting any children. | 49 // We're done. We don't bother painting any children. |
| 49 if (paintPhase == PaintPhaseBlockBackground) | 50 if (paintPhase == PaintPhaseBlockBackground) |
| 50 return; | 51 return; |
| 51 | 52 |
| 52 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. | 53 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. |
| 53 if (paintPhase == PaintPhaseChildBlockBackgrounds) | 54 if (paintPhase == PaintPhaseChildBlockBackgrounds) |
| 54 paintPhase = PaintPhaseChildBlockBackground; | 55 paintPhase = PaintPhaseChildBlockBackground; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 for (RenderTableSection* section = m_renderTable.bottomSection(); se
ction; section = m_renderTable.sectionAbove(section)) { | 78 for (RenderTableSection* section = m_renderTable.bottomSection(); se
ction; section = m_renderTable.sectionAbove(section)) { |
| 78 LayoutPoint childPoint = m_renderTable.flipForWritingModeForChil
d(section, paintOffset); | 79 LayoutPoint childPoint = m_renderTable.flipForWritingModeForChil
d(section, paintOffset); |
| 79 section->paint(info, childPoint); | 80 section->paint(info, childPoint); |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 m_renderTable.setCurrentBorderValue(0); | 83 m_renderTable.setCurrentBorderValue(0); |
| 83 } | 84 } |
| 84 | 85 |
| 85 // Paint outline. | 86 // Paint outline. |
| 86 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_renderTable.style()->hasOutline() && m_renderTable.style()->visibility() =
= VISIBLE) | 87 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_renderTable.style()->hasOutline() && m_renderTable.style()->visibility() =
= VISIBLE) |
| 87 m_renderTable.paintOutline(paintInfo, LayoutRect(paintOffset, m_renderTa
ble.size())); | 88 ObjectPainter(m_renderTable).paintOutline(paintInfo, LayoutRect(paintOff
set, m_renderTable.size())); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void TablePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layo
utPoint& paintOffset) | 91 void TablePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const Layo
utPoint& paintOffset) |
| 91 { | 92 { |
| 92 if (!paintInfo.shouldPaintWithinRoot(&m_renderTable)) | 93 if (!paintInfo.shouldPaintWithinRoot(&m_renderTable)) |
| 93 return; | 94 return; |
| 94 | 95 |
| 95 LayoutRect rect(paintOffset, m_renderTable.size()); | 96 LayoutRect rect(paintOffset, m_renderTable.size()); |
| 96 m_renderTable.subtractCaptionRect(rect); | 97 m_renderTable.subtractCaptionRect(rect); |
| 97 BoxPainter(m_renderTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa
intOffset, rect); | 98 BoxPainter(m_renderTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa
intOffset, rect); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void TablePainter::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) | 101 void TablePainter::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) |
| 101 { | 102 { |
| 102 if (m_renderTable.style()->visibility() != VISIBLE || paintInfo.phase != Pai
ntPhaseMask) | 103 if (m_renderTable.style()->visibility() != VISIBLE || paintInfo.phase != Pai
ntPhaseMask) |
| 103 return; | 104 return; |
| 104 | 105 |
| 105 LayoutRect rect(paintOffset, m_renderTable.size()); | 106 LayoutRect rect(paintOffset, m_renderTable.size()); |
| 106 m_renderTable.subtractCaptionRect(rect); | 107 m_renderTable.subtractCaptionRect(rect); |
| 107 DrawingRecorder recorder(paintInfo.context, &m_renderTable, paintInfo.phase,
pixelSnappedIntRect(rect)); | 108 DrawingRecorder recorder(paintInfo.context, &m_renderTable, paintInfo.phase,
pixelSnappedIntRect(rect)); |
| 108 BoxPainter(m_renderTable).paintMaskImages(paintInfo, rect); | 109 BoxPainter(m_renderTable).paintMaskImages(paintInfo, rect); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace blink | 112 } // namespace blink |
| OLD | NEW |