Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: third_party/WebKit/Source/core/paint/TablePainter.cpp

Issue 1610063002: Revert of Remove PaintInfo's paintingRoot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
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) {
46 // Using our cached sorted styles, we then do individual passes, 47 // Using our cached sorted styles, we then do individual passes,
47 // painting each style of border from lowest precedence to highest p recedence. 48 // painting each style of border from lowest precedence to highest p recedence.
48 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable. collapsedBorders(); 49 LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable. collapsedBorders();
49 size_t count = collapsedBorders.size(); 50 size_t count = collapsedBorders.size();
50 for (size_t i = 0; i < count; ++i) { 51 for (size_t i = 0; i < count; ++i) {
51 for (LayoutTableSection* section = m_layoutTable.bottomSection() ; section; section = m_layoutTable.sectionAbove(section)) { 52 for (LayoutTableSection* section = m_layoutTable.bottomSection() ; section; section = m_layoutTable.sectionAbove(section)) {
52 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor Child(section, paintOffset); 53 LayoutPoint childPoint = m_layoutTable.flipForWritingModeFor Child(section, paintOffset);
53 TableSectionPainter(*section).paintCollapsedBorders(paintInf oForDescendants, childPoint, collapsedBorders[i]); 54 TableSectionPainter(*section).paintCollapsedBorders(paintInf oForDescendants, childPoint, collapsedBorders[i]);
54 } 55 }
55 } 56 }
56 } 57 }
57 } 58 }
58 59
59 if (shouldPaintSelfOutline(paintPhase)) 60 if (shouldPaintSelfOutline(paintPhase))
60 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); 61 ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset);
61 } 62 }
62 63
63 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons t LayoutPoint& paintOffset) 64 void TablePainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, cons t LayoutPoint& paintOffset)
64 { 65 {
65 if (!m_layoutTable.hasBoxDecorationBackground() || m_layoutTable.style()->vi sibility() != VISIBLE) 66 if (!m_layoutTable.hasBoxDecorationBackground() || m_layoutTable.style()->vi sibility() != VISIBLE || !paintInfo.shouldPaintWithinRoot(&m_layoutTable))
66 return; 67 return;
67 68
68 LayoutRect rect(paintOffset, m_layoutTable.size()); 69 LayoutRect rect(paintOffset, m_layoutTable.size());
69 m_layoutTable.subtractCaptionRect(rect); 70 m_layoutTable.subtractCaptionRect(rect);
70 BoxPainter(m_layoutTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa intOffset, rect); 71 BoxPainter(m_layoutTable).paintBoxDecorationBackgroundWithRect(paintInfo, pa intOffset, rect);
71 } 72 }
72 73
73 void TablePainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset) 74 void TablePainter::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset)
74 { 75 {
75 if (m_layoutTable.style()->visibility() != VISIBLE || paintInfo.phase != Pai ntPhaseMask) 76 if (m_layoutTable.style()->visibility() != VISIBLE || paintInfo.phase != Pai ntPhaseMask)
76 return; 77 return;
77 78
78 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTable, paintInfo.phase, paintOffset)) 79 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex t, m_layoutTable, paintInfo.phase, paintOffset))
79 return; 80 return;
80 81
81 LayoutRect rect(paintOffset, m_layoutTable.size()); 82 LayoutRect rect(paintOffset, m_layoutTable.size());
82 m_layoutTable.subtractCaptionRect(rect); 83 m_layoutTable.subtractCaptionRect(rect);
83 84
84 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint Info.phase, rect, paintOffset); 85 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTable, paint Info.phase, rect, paintOffset);
85 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect); 86 BoxPainter(m_layoutTable).paintMaskImages(paintInfo, rect);
86 } 87 }
87 88
88 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.cpp ('k') | third_party/WebKit/Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698