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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.h

Issue 2770123003: Replace ASSERT with DCHECK in core/layout/ excluding subdirs (Closed)
Patch Set: Split some DCHECKs and add DCHECK_ops wherever possible Created 3 years, 8 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 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 CRASH(); 107 CRASH();
108 108
109 m_absoluteColumnIndex = column; 109 m_absoluteColumnIndex = column;
110 } 110 }
111 111
112 bool hasSetAbsoluteColumnIndex() const { 112 bool hasSetAbsoluteColumnIndex() const {
113 return m_absoluteColumnIndex != unsetColumnIndex; 113 return m_absoluteColumnIndex != unsetColumnIndex;
114 } 114 }
115 115
116 unsigned absoluteColumnIndex() const { 116 unsigned absoluteColumnIndex() const {
117 ASSERT(hasSetAbsoluteColumnIndex()); 117 DCHECK(hasSetAbsoluteColumnIndex());
118 return m_absoluteColumnIndex; 118 return m_absoluteColumnIndex;
119 } 119 }
120 120
121 LayoutTableRow* row() const { return toLayoutTableRow(parent()); } 121 LayoutTableRow* row() const { return toLayoutTableRow(parent()); }
122 LayoutTableSection* section() const { 122 LayoutTableSection* section() const {
123 return toLayoutTableSection(parent()->parent()); 123 return toLayoutTableSection(parent()->parent());
124 } 124 }
125 LayoutTable* table() const { 125 LayoutTable* table() const {
126 return toLayoutTable(parent()->parent()->parent()); 126 return toLayoutTable(parent()->parent()->parent());
127 } 127 }
128 128
129 LayoutTableCell* previousCell() const; 129 LayoutTableCell* previousCell() const;
130 LayoutTableCell* nextCell() const; 130 LayoutTableCell* nextCell() const;
131 131
132 unsigned rowIndex() const { 132 unsigned rowIndex() const {
133 // This function shouldn't be called on a detached cell. 133 // This function shouldn't be called on a detached cell.
134 ASSERT(row()); 134 DCHECK(row());
135 return row()->rowIndex(); 135 return row()->rowIndex();
136 } 136 }
137 137
138 Length styleOrColLogicalWidth() const { 138 Length styleOrColLogicalWidth() const {
139 Length styleWidth = style()->logicalWidth(); 139 Length styleWidth = style()->logicalWidth();
140 if (!styleWidth.isAuto()) 140 if (!styleWidth.isAuto())
141 return styleWidth; 141 return styleWidth;
142 if (LayoutTableCol* firstColumn = 142 if (LayoutTableCol* firstColumn =
143 table() 143 table()
144 ->colElementAtAbsoluteColumn(absoluteColumnIndex()) 144 ->colElementAtAbsoluteColumn(absoluteColumnIndex())
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 // This function is used to unify which table part's style we use for 245 // This function is used to unify which table part's style we use for
246 // computing direction and writing mode. Writing modes are not allowed on row 246 // computing direction and writing mode. Writing modes are not allowed on row
247 // group and row but direction is. This means we can safely use the same style 247 // group and row but direction is. This means we can safely use the same style
248 // in all cases to simplify our code. 248 // in all cases to simplify our code.
249 // FIXME: Eventually this function should replaced by style() once we support 249 // FIXME: Eventually this function should replaced by style() once we support
250 // direction on all table parts and writing-mode on cells. 250 // direction on all table parts and writing-mode on cells.
251 const ComputedStyle& styleForCellFlow() const { return row()->styleRef(); } 251 const ComputedStyle& styleForCellFlow() const { return row()->styleRef(); }
252 252
253 const BorderValue& borderAdjoiningTableStart() const { 253 const BorderValue& borderAdjoiningTableStart() const {
254 ASSERT(isFirstOrLastCellInRow()); 254 #if DCHECK_IS_ON()
255 DCHECK(isFirstOrLastCellInRow());
256 #endif
255 if (section()->hasSameDirectionAs(table())) 257 if (section()->hasSameDirectionAs(table()))
256 return style()->borderStart(); 258 return style()->borderStart();
257 259
258 return style()->borderEnd(); 260 return style()->borderEnd();
259 } 261 }
260 262
261 const BorderValue& borderAdjoiningTableEnd() const { 263 const BorderValue& borderAdjoiningTableEnd() const {
262 ASSERT(isFirstOrLastCellInRow()); 264 #if DCHECK_IS_ON()
265 DCHECK(isFirstOrLastCellInRow());
266 #endif
263 if (section()->hasSameDirectionAs(table())) 267 if (section()->hasSameDirectionAs(table()))
264 return style()->borderEnd(); 268 return style()->borderEnd();
265 269
266 return style()->borderStart(); 270 return style()->borderStart();
267 } 271 }
268 272
269 const BorderValue& borderAdjoiningCellBefore(const LayoutTableCell* cell) { 273 const BorderValue& borderAdjoiningCellBefore(const LayoutTableCell* cell) {
270 DCHECK_EQ(table()->cellAfter(cell), this); 274 DCHECK_EQ(table()->cellAfter(cell), this);
271 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality 275 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality
272 // at the cell level. 276 // at the cell level.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 return toLayoutTableCell(firstChild()); 476 return toLayoutTableCell(firstChild());
473 } 477 }
474 478
475 inline LayoutTableCell* LayoutTableRow::lastCell() const { 479 inline LayoutTableCell* LayoutTableRow::lastCell() const {
476 return toLayoutTableCell(lastChild()); 480 return toLayoutTableCell(lastChild());
477 } 481 }
478 482
479 } // namespace blink 483 } // namespace blink
480 484
481 #endif // LayoutTableCell_h 485 #endif // LayoutTableCell_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698