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

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

Issue 1379213002: Remove LayoutTable::m_currentBorder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 5 years, 2 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 "config.h" 5 #include "config.h"
6 #include "core/paint/TableCellPainter.h" 6 #include "core/paint/TableCellPainter.h"
7 7
8 #include "core/layout/LayoutTableCell.h" 8 #include "core/layout/LayoutTableCell.h"
9 #include "core/paint/BlockPainter.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/paint/BoxPainter.h" 10 #include "core/paint/BoxPainter.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 if (styleForCellFlow.isHorizontalWritingMode()) { 46 if (styleForCellFlow.isHorizontalWritingMode()) {
47 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore) 47 return styleForCellFlow.isFlippedBlocksWritingMode() ? m_layoutTableCel l.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSBefore)
48 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC ell, CBSAfter); 48 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableC ell, CBSAfter);
49 } 49 }
50 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio n()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd) 50 return styleForCellFlow.isLeftToRightDirection() ? m_layoutTableCell.sectio n()->cachedCollapsedBorder(&m_layoutTableCell, CBSEnd)
51 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart); 51 : m_layoutTableCell.section()->cachedCollapsedBorder(&m_layoutTableCell, CBSStart);
52 } 52 }
53 53
54 void TableCellPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset) 54 void TableCellPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pain tOffset)
55 { 55 {
56 ASSERT(paintInfo.phase != PaintPhaseCollapsedTableBorders);
57 BlockPainter(m_layoutTableCell).paint(paintInfo, paintOffset); 56 BlockPainter(m_layoutTableCell).paint(paintInfo, paintOffset);
58 } 57 }
59 58
60 static EBorderStyle collapsedBorderStyle(EBorderStyle style) 59 static EBorderStyle collapsedBorderStyle(EBorderStyle style)
61 { 60 {
62 if (style == OUTSET) 61 if (style == OUTSET)
63 return GROOVE; 62 return GROOVE;
64 if (style == INSET) 63 if (style == INSET)
65 return RIDGE; 64 return RIDGE;
66 return style; 65 return style;
67 } 66 }
68 67
69 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset) 68 void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const L ayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
70 { 69 {
71 ASSERT(paintInfo.phase == PaintPhaseCollapsedTableBorders);
72
73 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell) || m_layoutTableCel l.style()->visibility() != VISIBLE) 70 if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell) || m_layoutTableCel l.style()->visibility() != VISIBLE)
74 return; 71 return;
75 72
76 const CollapsedBorderValue* tableCurrentBorderValue = m_layoutTableCell.tabl e()->currentBorderValue();
77 if (!tableCurrentBorderValue)
78 return;
79
80 const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow() ; 73 const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow() ;
81 const CollapsedBorderValue& leftBorderValue = cachedCollapsedLeftBorder(styl eForCellFlow); 74 const CollapsedBorderValue& leftBorderValue = cachedCollapsedLeftBorder(styl eForCellFlow);
82 const CollapsedBorderValue& rightBorderValue = cachedCollapsedRightBorder(st yleForCellFlow); 75 const CollapsedBorderValue& rightBorderValue = cachedCollapsedRightBorder(st yleForCellFlow);
83 const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleF orCellFlow); 76 const CollapsedBorderValue& topBorderValue = cachedCollapsedTopBorder(styleF orCellFlow);
84 const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder( styleForCellFlow); 77 const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder( styleForCellFlow);
85 78
86 int displayItemType = DisplayItem::TableCollapsedBorderBase; 79 int displayItemType = DisplayItem::TableCollapsedBorderBase;
87 if (topBorderValue.shouldPaint(*tableCurrentBorderValue)) 80 if (topBorderValue.shouldPaint(currentBorderValue))
88 displayItemType |= DisplayItem::TableCollapsedBorderTop; 81 displayItemType |= DisplayItem::TableCollapsedBorderTop;
89 if (bottomBorderValue.shouldPaint(*tableCurrentBorderValue)) 82 if (bottomBorderValue.shouldPaint(currentBorderValue))
90 displayItemType |= DisplayItem::TableCollapsedBorderBottom; 83 displayItemType |= DisplayItem::TableCollapsedBorderBottom;
91 if (leftBorderValue.shouldPaint(*tableCurrentBorderValue)) 84 if (leftBorderValue.shouldPaint(currentBorderValue))
92 displayItemType |= DisplayItem::TableCollapsedBorderLeft; 85 displayItemType |= DisplayItem::TableCollapsedBorderLeft;
93 if (rightBorderValue.shouldPaint(*tableCurrentBorderValue)) 86 if (rightBorderValue.shouldPaint(currentBorderValue))
94 displayItemType |= DisplayItem::TableCollapsedBorderRight; 87 displayItemType |= DisplayItem::TableCollapsedBorderRight;
95 88
96 if (displayItemType == DisplayItem::TableCollapsedBorderBase) 89 if (displayItemType == DisplayItem::TableCollapsedBorderBase)
97 return; 90 return;
98 91
99 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. 92 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
100 int topWidth = topBorderValue.width(); 93 int topWidth = topBorderValue.width();
101 int bottomWidth = bottomBorderValue.width(); 94 int bottomWidth = bottomBorderValue.width();
102 int leftWidth = leftBorderValue.width(); 95 int leftWidth = leftBorderValue.width();
103 int rightWidth = rightBorderValue.width(); 96 int rightWidth = rightBorderValue.width();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior) 221 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior)
229 { 222 {
230 LayoutPoint adjustedPaintOffset = paintOffset; 223 LayoutPoint adjustedPaintOffset = paintOffset;
231 if (paintBoundOffsetBehavior == AddOffsetFromParent) 224 if (paintBoundOffsetBehavior == AddOffsetFromParent)
232 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); 225 adjustedPaintOffset.moveBy(m_layoutTableCell.location());
233 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize())); 226 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna ppedSize()));
234 } 227 }
235 228
236 } // namespace blink 229 } // namespace blink
237 230
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.h ('k') | third_party/WebKit/Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698