| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 void LineBoxList::deleteLineBoxTree() | 65 void LineBoxList::deleteLineBoxTree() |
| 66 { | 66 { |
| 67 InlineFlowBox* line = m_firstLineBox; | 67 InlineFlowBox* line = m_firstLineBox; |
| 68 InlineFlowBox* nextLine; | 68 InlineFlowBox* nextLine; |
| 69 while (line) { | 69 while (line) { |
| 70 nextLine = line->nextLineBox(); | 70 nextLine = line->nextLineBox(); |
| 71 line->deleteLine(); | 71 line->deleteLine(); |
| 72 line = nextLine; | 72 line = nextLine; |
| 73 } | 73 } |
| 74 m_firstLineBox = m_lastLineBox = 0; | 74 m_firstLineBox = m_lastLineBox = nullptr; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void LineBoxList::extractLineBox(InlineFlowBox* box) | 77 void LineBoxList::extractLineBox(InlineFlowBox* box) |
| 78 { | 78 { |
| 79 checkConsistency(); | 79 checkConsistency(); |
| 80 | 80 |
| 81 m_lastLineBox = box->prevLineBox(); | 81 m_lastLineBox = box->prevLineBox(); |
| 82 if (box == m_firstLineBox) | 82 if (box == m_firstLineBox) |
| 83 m_firstLineBox = 0; | 83 m_firstLineBox = nullptr; |
| 84 if (box->prevLineBox()) | 84 if (box->prevLineBox()) |
| 85 box->prevLineBox()->setNextLineBox(0); | 85 box->prevLineBox()->setNextLineBox(nullptr); |
| 86 box->setPreviousLineBox(0); | 86 box->setPreviousLineBox(nullptr); |
| 87 for (InlineFlowBox* curr = box; curr; curr = curr->nextLineBox()) | 87 for (InlineFlowBox* curr = box; curr; curr = curr->nextLineBox()) |
| 88 curr->setExtracted(); | 88 curr->setExtracted(); |
| 89 | 89 |
| 90 checkConsistency(); | 90 checkConsistency(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void LineBoxList::attachLineBox(InlineFlowBox* box) | 93 void LineBoxList::attachLineBox(InlineFlowBox* box) |
| 94 { | 94 { |
| 95 checkConsistency(); | 95 checkConsistency(); |
| 96 | 96 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 void LineBoxList::deleteLineBoxes() | 129 void LineBoxList::deleteLineBoxes() |
| 130 { | 130 { |
| 131 if (m_firstLineBox) { | 131 if (m_firstLineBox) { |
| 132 InlineFlowBox* next; | 132 InlineFlowBox* next; |
| 133 for (InlineFlowBox* curr = m_firstLineBox; curr; curr = next) { | 133 for (InlineFlowBox* curr = m_firstLineBox; curr; curr = next) { |
| 134 next = curr->nextLineBox(); | 134 next = curr->nextLineBox(); |
| 135 curr->destroy(); | 135 curr->destroy(); |
| 136 } | 136 } |
| 137 m_firstLineBox = 0; | 137 m_firstLineBox = nullptr; |
| 138 m_lastLineBox = 0; | 138 m_lastLineBox = nullptr; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void LineBoxList::dirtyLineBoxes() | 142 void LineBoxList::dirtyLineBoxes() |
| 143 { | 143 { |
| 144 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) | 144 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) |
| 145 curr->dirtyLineBoxes(); | 145 curr->dirtyLineBoxes(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 bool LineBoxList::rangeIntersectsRect(LayoutBoxModelObject* layoutObject, Layout
Unit logicalTop, LayoutUnit logicalBottom, const LayoutRect& rect, const LayoutP
oint& offset) const | 148 bool LineBoxList::rangeIntersectsRect(LayoutBoxModelObject* layoutObject, Layout
Unit logicalTop, LayoutUnit logicalBottom, const LayoutRect& rect, const LayoutP
oint& offset) const |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (container->isInline() && !container->ancestorLineBoxDirty()) { | 244 if (container->isInline() && !container->ancestorLineBoxDirty()) { |
| 245 container->parent()->dirtyLinesFromChangedChild(container); | 245 container->parent()->dirtyLinesFromChangedChild(container); |
| 246 container->setAncestorLineBoxDirty(); // Mark the container to avoid
dirtying the same lines again across multiple destroy() calls of the same subtr
ee. | 246 container->setAncestorLineBoxDirty(); // Mark the container to avoid
dirtying the same lines again across multiple destroy() calls of the same subtr
ee. |
| 247 } | 247 } |
| 248 return; | 248 return; |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Try to figure out which line box we belong in. First try to find a previ
ous | 251 // Try to figure out which line box we belong in. First try to find a previ
ous |
| 252 // line box by examining our siblings. If we didn't find a line box, then u
se our | 252 // line box by examining our siblings. If we didn't find a line box, then u
se our |
| 253 // parent's first line box. | 253 // parent's first line box. |
| 254 RootInlineBox* box = 0; | 254 RootInlineBox* box = nullptr; |
| 255 LayoutObject* curr = 0; | 255 LayoutObject* curr = nullptr; |
| 256 for (curr = child->previousSibling(); curr; curr = curr->previousSibling())
{ | 256 for (curr = child->previousSibling(); curr; curr = curr->previousSibling())
{ |
| 257 if (curr->isFloatingOrOutOfFlowPositioned()) | 257 if (curr->isFloatingOrOutOfFlowPositioned()) |
| 258 continue; | 258 continue; |
| 259 | 259 |
| 260 if (curr->isReplaced()) { | 260 if (curr->isReplaced()) { |
| 261 InlineBox* wrapper = toLayoutBox(curr)->inlineBoxWrapper(); | 261 InlineBox* wrapper = toLayoutBox(curr)->inlineBoxWrapper(); |
| 262 if (wrapper) | 262 if (wrapper) |
| 263 box = &wrapper->root(); | 263 box = &wrapper->root(); |
| 264 } else if (curr->isText()) { | 264 } else if (curr->isText()) { |
| 265 InlineTextBox* textBox = toLayoutText(curr)->lastTextBox(); | 265 InlineTextBox* textBox = toLayoutText(curr)->lastTextBox(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (RootInlineBox* nextRootBox = box->nextRootBox()) | 308 if (RootInlineBox* nextRootBox = box->nextRootBox()) |
| 309 nextRootBox->markDirty(); | 309 nextRootBox->markDirty(); |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 | 312 |
| 313 #if ENABLE(ASSERT) | 313 #if ENABLE(ASSERT) |
| 314 | 314 |
| 315 void LineBoxList::checkConsistency() const | 315 void LineBoxList::checkConsistency() const |
| 316 { | 316 { |
| 317 #ifdef CHECK_CONSISTENCY | 317 #ifdef CHECK_CONSISTENCY |
| 318 const InlineFlowBox* prev = 0; | 318 const InlineFlowBox* prev = nullptr; |
| 319 for (const InlineFlowBox* child = m_firstLineBox; child != 0; child = child-
>nextLineBox()) { | 319 for (const InlineFlowBox* child = m_firstLineBox; child; child = child->next
LineBox()) { |
| 320 ASSERT(child->prevLineBox() == prev); | 320 ASSERT(child->prevLineBox() == prev); |
| 321 prev = child; | 321 prev = child; |
| 322 } | 322 } |
| 323 ASSERT(prev == m_lastLineBox); | 323 ASSERT(prev == m_lastLineBox); |
| 324 #endif | 324 #endif |
| 325 } | 325 } |
| 326 | 326 |
| 327 #endif | 327 #endif |
| 328 | 328 |
| 329 } | 329 } |
| OLD | NEW |