| 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" |
| 11 #include "core/paint/BoxPainter.h" | 11 #include "core/paint/BoxPainter.h" |
| 12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 13 #include "core/paint/ObjectPainter.h" | 13 #include "core/paint/ObjectPainter.h" |
| 14 #include "core/paint/PaintInfo.h" | 14 #include "core/paint/PaintInfo.h" |
| 15 #include "core/paint/ScopeRecorder.h" | 15 #include "core/paint/ScopeRecorder.h" |
| 16 #include "core/paint/TableCollapsedBorderPainter.h" |
| 16 #include "core/paint/TableSectionPainter.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 | 24 |
| 24 if (shouldPaintSelfBlockBackground(paintPhase)) { | 25 if (shouldPaintSelfBlockBackground(paintPhase)) { |
| 25 paintBoxDecorationBackground(paintInfo, paintOffset); | 26 paintBoxDecorationBackground(paintInfo, paintOffset); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); | 37 PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
| 37 | 38 |
| 38 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = ch
ild->nextSibling()) { | 39 for (LayoutObject* child = m_layoutTable.firstChild(); child; child = ch
ild->nextSibling()) { |
| 39 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() &&
(child->isTableSection() || child->isTableCaption())) { | 40 if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() &&
(child->isTableSection() || child->isTableCaption())) { |
| 40 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(toLayoutBox(child), paintOffset); | 41 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChil
d(toLayoutBox(child), paintOffset); |
| 41 child->paint(paintInfoForDescendants, childPoint); | 42 child->paint(paintInfoForDescendants, childPoint); |
| 42 } | 43 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgro
unds(paintPhase) && m_layoutTable.style()->visibility() == VISIBLE) { | 46 if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgro
unds(paintPhase) && m_layoutTable.style()->visibility() == VISIBLE) { |
| 47 if (RuntimeEnabledFeatures::newTableCollapsedBordersEnabled()) { |
| 48 // New collapsed border painter |
| 49 TableCollapsedBorderPainter oldPainter(m_layoutTable.bottomSecti
on()); |
| 50 for (LayoutTableSection* section = m_layoutTable.bottomSection()
; section; section = m_layoutTable.sectionAbove(section, SkipEmptySections)) { |
| 51 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor
Child(section, paintOffset); |
| 52 TableSectionPainter(*section).paintCollapsedBorders2(paintIn
foForDescendants, childPoint, oldPainter); |
| 53 } |
| 54 |
| 55 } else { |
| 46 // Using our cached sorted styles, we then do individual passes, | 56 // Using our cached sorted styles, we then do individual passes, |
| 47 // painting each style of border from lowest precedence to highest p
recedence. | 57 // painting each style of border from lowest precedence to highest p
recedence. |
| 48 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.
collapsedBorders(); | 58 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTa
ble.collapsedBorders(); |
| 49 size_t count = collapsedBorders.size(); | 59 size_t count = collapsedBorders.size(); |
| 50 for (size_t i = 0; i < count; ++i) { | 60 for (size_t i = 0; i < count; ++i) { |
| 51 for (LayoutTableSection* section = m_layoutTable.bottomSection()
; section; section = m_layoutTable.sectionAbove(section)) { | 61 for (LayoutTableSection* section = m_layoutTable.bottomSecti
on(); section; section = m_layoutTable.sectionAbove(section)) { |
| 52 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor
Child(section, paintOffset); | 62 LayoutPoint childPoint = m_layoutTable.flipForWritingMod
eForChild(section, paintOffset); |
| 53 TableSectionPainter(*section).paintCollapsedBorders(paintInf
oForDescendants, childPoint, collapsedBorders[i]); | 63 TableSectionPainter(*section).paintCollapsedBorders(pain
tInfoForDescendants, childPoint, collapsedBorders[i]); |
| 64 } |
| 54 } | 65 } |
| 55 } | 66 } |
| 56 } | 67 } |
| 57 } | 68 } |
| 58 | 69 |
| 59 if (shouldPaintSelfOutline(paintPhase)) | 70 if (shouldPaintSelfOutline(paintPhase)) |
| 60 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); | 71 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); |
| 61 } | 72 } |
| 62 | 73 |
| 63 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) | 74 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons
t LayoutPoint& paintOffset) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 return; | 90 return; |
| 80 | 91 |
| 81 LayoutRect rect(paintOffset, m_layoutTable.size()); | 92 LayoutRect rect(paintOffset, m_layoutTable.size()); |
| 82 m_layoutTable.subtractCaptionRect(rect); | 93 m_layoutTable.subtractCaptionRect(rect); |
| 83 | 94 |
| 84 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint
Info.phase, rect); | 95 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint
Info.phase, rect); |
| 85 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); | 96 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); |
| 86 } | 97 } |
| 87 | 98 |
| 88 } // namespace blink | 99 } // namespace blink |
| OLD | NEW |