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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp

Issue 2640163004: Replace ENABLE(ASSERT) with DCHECK_IS_ON(). (Closed)
Patch Set: Created 3 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 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 namespace blink { 44 namespace blink {
45 45
46 struct SameSizeAsInlineFlowBox : public InlineBox { 46 struct SameSizeAsInlineFlowBox : public InlineBox {
47 void* pointers[5]; 47 void* pointers[5];
48 uint32_t bitfields : 23; 48 uint32_t bitfields : 23;
49 }; 49 };
50 50
51 static_assert(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), 51 static_assert(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox),
52 "InlineFlowBox should stay small"); 52 "InlineFlowBox should stay small");
53 53
54 #if ENABLE(ASSERT) 54 #if DCHECK_IS_ON()
55
56 InlineFlowBox::~InlineFlowBox() { 55 InlineFlowBox::~InlineFlowBox() {
57 if (!m_hasBadChildList) 56 if (!m_hasBadChildList)
58 for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) 57 for (InlineBox* child = firstChild(); child; child = child->nextOnLine())
59 child->setHasBadParent(); 58 child->setHasBadParent();
60 } 59 }
61
62 #endif 60 #endif
63 61
64 LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth() { 62 LayoutUnit InlineFlowBox::getFlowSpacingLogicalWidth() {
65 LayoutUnit totWidth = 63 LayoutUnit totWidth =
66 marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight(); 64 marginBorderPaddingLogicalLeft() + marginBorderPaddingLogicalRight();
67 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 65 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
68 if (curr->isInlineFlowBox()) 66 if (curr->isInlineFlowBox())
69 totWidth += toInlineFlowBox(curr)->getFlowSpacingLogicalWidth(); 67 totWidth += toInlineFlowBox(curr)->getFlowSpacingLogicalWidth();
70 } 68 }
71 return totWidth; 69 return totWidth;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 218
221 checkConsistency(); 219 checkConsistency();
222 } 220 }
223 221
224 void InlineFlowBox::deleteLine() { 222 void InlineFlowBox::deleteLine() {
225 InlineBox* child = firstChild(); 223 InlineBox* child = firstChild();
226 InlineBox* next = nullptr; 224 InlineBox* next = nullptr;
227 while (child) { 225 while (child) {
228 ASSERT(this == child->parent()); 226 ASSERT(this == child->parent());
229 next = child->nextOnLine(); 227 next = child->nextOnLine();
230 #if ENABLE(ASSERT) 228 #if DCHECK_IS_ON()
231 child->setParent(nullptr); 229 child->setParent(nullptr);
232 #endif 230 #endif
233 child->deleteLine(); 231 child->deleteLine();
234 child = next; 232 child = next;
235 } 233 }
236 #if ENABLE(ASSERT) 234 #if DCHECK_IS_ON()
237 m_firstChild = nullptr; 235 m_firstChild = nullptr;
238 m_lastChild = nullptr; 236 m_lastChild = nullptr;
239 #endif 237 #endif
240 238
241 removeLineBoxFromLayoutObject(); 239 removeLineBoxFromLayoutObject();
242 destroy(); 240 destroy();
243 } 241 }
244 242
245 void InlineFlowBox::removeLineBoxFromLayoutObject() { 243 void InlineFlowBox::removeLineBoxFromLayoutObject() {
246 lineBoxes()->removeLineBox(this); 244 lineBoxes()->removeLineBox(this);
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 int depth) const { 1628 int depth) const {
1631 InlineBox::showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, 1629 InlineBox::showLineTreeAndMark(markedBox1, markedLabel1, markedBox2,
1632 markedLabel2, obj, depth); 1630 markedLabel2, obj, depth);
1633 for (const InlineBox* box = firstChild(); box; box = box->nextOnLine()) 1631 for (const InlineBox* box = firstChild(); box; box = box->nextOnLine())
1634 box->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLabel2, 1632 box->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLabel2,
1635 obj, depth + 1); 1633 obj, depth + 1);
1636 } 1634 }
1637 1635
1638 #endif 1636 #endif
1639 1637
1640 #if ENABLE(ASSERT) 1638 #if DCHECK_IS_ON()
1641 void InlineFlowBox::checkConsistency() const { 1639 void InlineFlowBox::checkConsistency() const {
1642 #ifdef CHECK_CONSISTENCY 1640 #ifdef CHECK_CONSISTENCY
1643 ASSERT(!m_hasBadChildList); 1641 ASSERT(!m_hasBadChildList);
1644 const InlineBox* prev = nullptr; 1642 const InlineBox* prev = nullptr;
1645 for (const InlineBox* child = m_firstChild; child; 1643 for (const InlineBox* child = m_firstChild; child;
1646 child = child->nextOnLine()) { 1644 child = child->nextOnLine()) {
1647 ASSERT(child->parent() == this); 1645 ASSERT(child->parent() == this);
1648 ASSERT(child->prevOnLine() == prev); 1646 ASSERT(child->prevOnLine() == prev);
1649 prev = child; 1647 prev = child;
1650 } 1648 }
1651 ASSERT(prev == m_lastChild); 1649 ASSERT(prev == m_lastChild);
1652 #endif 1650 #endif
1653 } 1651 }
1654 1652
1655 #endif 1653 #endif
1656 1654
1657 } // namespace blink 1655 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698