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