OLD | NEW |
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 parent_style.LineHeight() == child_style.LineHeight() && | 88 parent_style.LineHeight() == child_style.LineHeight() && |
89 (parent_style.VerticalAlign() == EVerticalAlign::kBaseline || | 89 (parent_style.VerticalAlign() == EVerticalAlign::kBaseline || |
90 is_root) && | 90 is_root) && |
91 child_style.VerticalAlign() == EVerticalAlign::kBaseline; | 91 child_style.VerticalAlign() == EVerticalAlign::kBaseline; |
92 } | 92 } |
93 | 93 |
94 void InlineFlowBox::AddToLine(InlineBox* child) { | 94 void InlineFlowBox::AddToLine(InlineBox* child) { |
95 DCHECK(!child->Parent()); | 95 DCHECK(!child->Parent()); |
96 DCHECK(!child->NextOnLine()); | 96 DCHECK(!child->NextOnLine()); |
97 DCHECK(!child->PrevOnLine()); | 97 DCHECK(!child->PrevOnLine()); |
98 CheckConsistency(); | |
99 | 98 |
100 child->SetParent(this); | 99 child->SetParent(this); |
101 if (!first_child_) { | 100 if (!first_child_) { |
102 first_child_ = child; | 101 first_child_ = child; |
103 last_child_ = child; | 102 last_child_ = child; |
104 } else { | 103 } else { |
105 last_child_->SetNextOnLine(child); | 104 last_child_->SetNextOnLine(child); |
106 child->SetPrevOnLine(last_child_); | 105 child->SetPrevOnLine(last_child_); |
107 last_child_ = child; | 106 last_child_ = child; |
108 } | 107 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 child->GetLineLayoutItem() | 187 child->GetLineLayoutItem() |
189 .Style(IsFirstLineStyle()) | 188 .Style(IsFirstLineStyle()) |
190 ->HasOutline())) { | 189 ->HasOutline())) { |
191 child->ClearKnownToHaveNoOverflow(); | 190 child->ClearKnownToHaveNoOverflow(); |
192 } | 191 } |
193 | 192 |
194 if (KnownToHaveNoOverflow() && child->IsInlineFlowBox() && | 193 if (KnownToHaveNoOverflow() && child->IsInlineFlowBox() && |
195 !ToInlineFlowBox(child)->KnownToHaveNoOverflow()) | 194 !ToInlineFlowBox(child)->KnownToHaveNoOverflow()) |
196 ClearKnownToHaveNoOverflow(); | 195 ClearKnownToHaveNoOverflow(); |
197 } | 196 } |
198 | |
199 CheckConsistency(); | |
200 } | 197 } |
201 | 198 |
202 void InlineFlowBox::RemoveChild(InlineBox* child, MarkLineBoxes mark_dirty) { | 199 void InlineFlowBox::RemoveChild(InlineBox* child, MarkLineBoxes mark_dirty) { |
203 CheckConsistency(); | |
204 | |
205 if (mark_dirty == kMarkLineBoxesDirty && !IsDirty()) | 200 if (mark_dirty == kMarkLineBoxesDirty && !IsDirty()) |
206 DirtyLineBoxes(); | 201 DirtyLineBoxes(); |
207 | 202 |
208 Root().ChildRemoved(child); | 203 Root().ChildRemoved(child); |
209 | 204 |
210 if (child == first_child_) | 205 if (child == first_child_) |
211 first_child_ = child->NextOnLine(); | 206 first_child_ = child->NextOnLine(); |
212 if (child == last_child_) | 207 if (child == last_child_) |
213 last_child_ = child->PrevOnLine(); | 208 last_child_ = child->PrevOnLine(); |
214 if (child->NextOnLine()) | 209 if (child->NextOnLine()) |
215 child->NextOnLine()->SetPrevOnLine(child->PrevOnLine()); | 210 child->NextOnLine()->SetPrevOnLine(child->PrevOnLine()); |
216 if (child->PrevOnLine()) | 211 if (child->PrevOnLine()) |
217 child->PrevOnLine()->SetNextOnLine(child->NextOnLine()); | 212 child->PrevOnLine()->SetNextOnLine(child->NextOnLine()); |
218 | 213 |
219 child->SetParent(nullptr); | 214 child->SetParent(nullptr); |
220 | |
221 CheckConsistency(); | |
222 } | 215 } |
223 | 216 |
224 void InlineFlowBox::DeleteLine() { | 217 void InlineFlowBox::DeleteLine() { |
225 InlineBox* child = FirstChild(); | 218 InlineBox* child = FirstChild(); |
226 InlineBox* next = nullptr; | 219 InlineBox* next = nullptr; |
227 while (child) { | 220 while (child) { |
228 DCHECK_EQ(this, child->Parent()); | 221 DCHECK_EQ(this, child->Parent()); |
229 next = child->NextOnLine(); | 222 next = child->NextOnLine(); |
230 #if DCHECK_IS_ON() | 223 #if DCHECK_IS_ON() |
231 child->SetParent(nullptr); | 224 child->SetParent(nullptr); |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 int depth) const { | 1706 int depth) const { |
1714 InlineBox::ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, | 1707 InlineBox::ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, |
1715 marked_label2, obj, depth); | 1708 marked_label2, obj, depth); |
1716 for (const InlineBox* box = FirstChild(); box; box = box->NextOnLine()) | 1709 for (const InlineBox* box = FirstChild(); box; box = box->NextOnLine()) |
1717 box->ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, | 1710 box->ShowLineTreeAndMark(marked_box1, marked_label1, marked_box2, |
1718 marked_label2, obj, depth + 1); | 1711 marked_label2, obj, depth + 1); |
1719 } | 1712 } |
1720 | 1713 |
1721 #endif | 1714 #endif |
1722 | 1715 |
1723 #if DCHECK_IS_ON() | |
1724 void InlineFlowBox::CheckConsistency() const { | |
1725 #ifdef CHECK_CONSISTENCY | |
1726 DCHECK(!m_hasBadChildList); | |
1727 const InlineBox* prev = nullptr; | |
1728 for (const InlineBox* child = m_firstChild; child; | |
1729 child = child->nextOnLine()) { | |
1730 DCHECK_EQ(child->parent(), this); | |
1731 DCHECK_EQ(child->prevOnLine(), prev); | |
1732 prev = child; | |
1733 } | |
1734 DCHECK_EQ(prev, m_lastChild); | |
1735 #endif | |
1736 } | |
1737 | |
1738 #endif | |
1739 | |
1740 } // namespace blink | 1716 } // namespace blink |
OLD | NEW |