| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 | 2301 |
| 2302 void LayoutBlockFlow::removeChild(LayoutObject* oldChild) | 2302 void LayoutBlockFlow::removeChild(LayoutObject* oldChild) |
| 2303 { | 2303 { |
| 2304 // No need to waste time in merging or removing empty anonymous blocks. | 2304 // No need to waste time in merging or removing empty anonymous blocks. |
| 2305 // We can just bail out if our document is getting destroyed. | 2305 // We can just bail out if our document is getting destroyed. |
| 2306 if (documentBeingDestroyed()) { | 2306 if (documentBeingDestroyed()) { |
| 2307 LayoutBox::removeChild(oldChild); | 2307 LayoutBox::removeChild(oldChild); |
| 2308 return; | 2308 return; |
| 2309 } | 2309 } |
| 2310 | 2310 |
| 2311 // If this child is a block, and if our previous and next siblings are |
| 2312 // both anonymous blocks with inline content, then we can go ahead and |
| 2313 // fold the inline content back together. |
| 2314 LayoutObject* prev = oldChild->previousSibling(); |
| 2315 LayoutObject* next = oldChild->nextSibling(); |
| 2316 bool mergedAnonymousBlocks = false; |
| 2317 if (prev && next && !oldChild->isInline() && !oldChild->virtualContinuation(
) && prev->isLayoutBlockFlow() && next->isLayoutBlockFlow()) { |
| 2318 if (toLayoutBlockFlow(prev)->mergeSiblingContiguousAnonymousBlock(toLayo
utBlockFlow(next))) { |
| 2319 mergedAnonymousBlocks = true; |
| 2320 next = nullptr; |
| 2321 } |
| 2322 } |
| 2323 |
| 2311 LayoutBlock::removeChild(oldChild); | 2324 LayoutBlock::removeChild(oldChild); |
| 2325 |
| 2326 LayoutObject* child = prev ? prev : next; |
| 2327 if (mergedAnonymousBlocks && child && !child->previousSibling() && !child->n
extSibling()) { |
| 2328 // The removal has knocked us down to containing only a single anonymous |
| 2329 // box. We can go ahead and pull the content right back up into our |
| 2330 // box. |
| 2331 collapseAnonymousBlockChild(this, toLayoutBlock(child)); |
| 2332 } |
| 2333 |
| 2312 if (!firstChild()) { | 2334 if (!firstChild()) { |
| 2313 // If this was our last child be sure to clear out our line boxes. | 2335 // If this was our last child be sure to clear out our line boxes. |
| 2314 if (childrenInline()) | 2336 if (childrenInline()) |
| 2315 deleteLineBoxTree(); | 2337 deleteLineBoxTree(); |
| 2316 | 2338 |
| 2317 // If we are an empty anonymous block in the continuation chain, | 2339 // If we are an empty anonymous block in the continuation chain, |
| 2318 // we need to remove ourself and fix the continuation chain. | 2340 // we need to remove ourself and fix the continuation chain. |
| 2319 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { | 2341 if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->is
ListMarker()) { |
| 2320 LayoutObject* containingBlockIgnoringAnonymous = containingBlock(); | 2342 LayoutObject* containingBlockIgnoringAnonymous = containingBlock(); |
| 2321 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymous()) | 2343 while (containingBlockIgnoringAnonymous && containingBlockIgnoringAn
onymous->isAnonymous()) |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3485 if (!rect.isEmpty()) | 3507 if (!rect.isEmpty()) |
| 3486 rects.append(rect); | 3508 rects.append(rect); |
| 3487 } | 3509 } |
| 3488 } | 3510 } |
| 3489 | 3511 |
| 3490 if (inlineElementContinuation) | 3512 if (inlineElementContinuation) |
| 3491 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in
lineElementContinuation->containingBlock()->location() - location()), includeBlo
ckOverflows); | 3513 inlineElementContinuation->addOutlineRects(rects, additionalOffset + (in
lineElementContinuation->containingBlock()->location() - location()), includeBlo
ckOverflows); |
| 3492 } | 3514 } |
| 3493 | 3515 |
| 3494 } // namespace blink | 3516 } // namespace blink |
| OLD | NEW |