OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA uto()) | 362 if (startOfContinuations && startOfContinuations->styleRef().outlineStyleIsA uto()) |
363 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations) ; | 363 startOfContinuations->invalidateDisplayItemClient(*startOfContinuations) ; |
364 } | 364 } |
365 | 365 |
366 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR ect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const | 366 void LayoutBlock::invalidateDisplayItemClients(const LayoutBoxModelObject& paint InvalidationContainer, PaintInvalidationReason invalidationReason, const LayoutR ect& previousPaintInvalidationRect, const LayoutRect& newPaintInvalidationRect) const |
367 { | 367 { |
368 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida tionReason, previousPaintInvalidationRect, newPaintInvalidationRect); | 368 LayoutBox::invalidateDisplayItemClients(paintInvalidationContainer, invalida tionReason, previousPaintInvalidationRect, newPaintInvalidationRect); |
369 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); | 369 invalidateDisplayItemClientForStartOfContinuationsIfNeeded(*this); |
370 } | 370 } |
371 | 371 |
372 static void addSubsequentFloatingSiblingsToBlock(LayoutBlock* block, LayoutBlock * container) | |
mstensho (USE GERRIT)
2015/10/29 20:00:26
FloatingOrOutOfFlowSiblings
| |
373 { | |
374 LayoutObject* child = block->nextSibling(); | |
375 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
376 LayoutObject* sibling = child->nextSibling(); | |
377 container->moveChildTo(block, child, nullptr, false); | |
378 child = sibling; | |
379 } | |
380 } | |
381 | |
372 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj ect* beforeChild) | 382 void LayoutBlock::addChildIgnoringContinuation(LayoutObject* newChild, LayoutObj ect* beforeChild) |
373 { | 383 { |
374 if (beforeChild && beforeChild->parent() != this) { | 384 if (beforeChild && beforeChild->parent() != this) { |
375 LayoutObject* beforeChildContainer = beforeChild->parent(); | 385 LayoutObject* beforeChildContainer = beforeChild->parent(); |
376 while (beforeChildContainer->parent() != this) | 386 while (beforeChildContainer->parent() != this) |
377 beforeChildContainer = beforeChildContainer->parent(); | 387 beforeChildContainer = beforeChildContainer->parent(); |
378 ASSERT(beforeChildContainer); | 388 ASSERT(beforeChildContainer); |
379 | 389 |
380 if (beforeChildContainer->isAnonymous()) { | 390 if (beforeChildContainer->isAnonymous()) { |
381 // If the requested beforeChild is not one of our children, then thi s is because | 391 // If the requested beforeChild is not one of our children, then thi s is because |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 ASSERT(beforeChild->parent() == this); | 438 ASSERT(beforeChild->parent() == this); |
429 } | 439 } |
430 } else if (!childrenInline() && (newChild->isFloatingOrOutOfFlowPositioned() || newChild->isInline())) { | 440 } else if (!childrenInline() && (newChild->isFloatingOrOutOfFlowPositioned() || newChild->isInline())) { |
431 // If we're inserting an inline child but all of our children are blocks , then we have to make sure | 441 // If we're inserting an inline child but all of our children are blocks , then we have to make sure |
432 // it is put into an anomyous block box. We try to use an existing anony mous box if possible, otherwise | 442 // it is put into an anomyous block box. We try to use an existing anony mous box if possible, otherwise |
433 // a new one is created and inserted into our list of children in the ap propriate position. | 443 // a new one is created and inserted into our list of children in the ap propriate position. |
434 LayoutObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); | 444 LayoutObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); |
435 | 445 |
436 if (afterChild && afterChild->isAnonymousBlock()) { | 446 if (afterChild && afterChild->isAnonymousBlock()) { |
437 afterChild->addChild(newChild); | 447 afterChild->addChild(newChild); |
448 addSubsequentFloatingSiblingsToBlock(toLayoutBlock(afterChild), this ); | |
mstensho (USE GERRIT)
2015/10/29 20:00:26
Why would there be subsequent floats or out-of-flo
| |
438 return; | 449 return; |
439 } | 450 } |
440 | 451 |
441 if (newChild->isInline()) { | 452 if (newChild->isInline()) { |
442 // No suitable existing anonymous box - create a new one. | 453 // No suitable existing anonymous box - create a new one. |
443 LayoutBlock* newBox = createAnonymousBlock(); | 454 LayoutBlock* newBox = createAnonymousBlock(); |
444 LayoutBox::addChild(newBox, beforeChild); | 455 LayoutBox::addChild(newBox, beforeChild); |
445 // Reparent adjacent floating or out-of-flow siblings to the new box . | 456 // Reparent adjacent floating or out-of-flow siblings to the new box . |
446 LayoutObject* child = newBox->previousSibling(); | 457 LayoutObject* child = newBox->previousSibling(); |
447 while (child && child->isFloatingOrOutOfFlowPositioned()) { | 458 while (child && child->isFloatingOrOutOfFlowPositioned()) { |
448 LayoutObject* sibling = child->previousSibling(); | 459 LayoutObject* sibling = child->previousSibling(); |
449 moveChildTo(newBox, child, newBox->firstChild(), false); | 460 moveChildTo(newBox, child, newBox->firstChild(), false); |
450 child = sibling; | 461 child = sibling; |
451 } | 462 } |
452 newBox->addChild(newChild); | 463 newBox->addChild(newChild); |
453 child = newBox->nextSibling(); | 464 addSubsequentFloatingSiblingsToBlock(newBox, this); |
454 while (child && child->isFloatingOrOutOfFlowPositioned()) { | |
455 LayoutObject* sibling = child->nextSibling(); | |
456 moveChildTo(newBox, child, nullptr, false); | |
457 child = sibling; | |
458 } | |
459 return; | 465 return; |
460 } | 466 } |
461 } | 467 } |
462 | 468 |
463 LayoutBox::addChild(newChild, beforeChild); | 469 LayoutBox::addChild(newChild, beforeChild); |
464 | 470 |
465 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) | 471 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isLayo utBlock()) |
466 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); | 472 toLayoutBlock(parent())->removeLeftoverAnonymousBlock(this); |
467 // this object may be dead here | 473 // this object may be dead here |
468 } | 474 } |
(...skipping 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2880 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const | 2886 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const |
2881 { | 2887 { |
2882 showLayoutObject(); | 2888 showLayoutObject(); |
2883 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 2889 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
2884 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 2890 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
2885 } | 2891 } |
2886 | 2892 |
2887 #endif | 2893 #endif |
2888 | 2894 |
2889 } // namespace blink | 2895 } // namespace blink |
OLD | NEW |