|
Lines 272-288
void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle& newSt
a/Source/WebCore/rendering/RenderBlock.cpp_sec1
|
| 272 |
else if (oldStyle->position() == StaticPosition) { |
272 |
else if (oldStyle->position() == StaticPosition) { |
| 273 |
// Remove our absolutely positioned descendants from their current containing block. |
273 |
// Remove our absolutely positioned descendants from their current containing block. |
| 274 |
// They will be inserted into our positioned objects list during layout. |
274 |
// They will be inserted into our positioned objects list during layout. |
| 275 |
auto cb = parent(); |
275 |
auto containingBlock = parent(); |
| 276 |
while (cb && (cb->style().position() == StaticPosition || (cb->isInline() && !cb->isReplaced())) && !cb->isRenderView()) { |
276 |
while (containingBlock && (containingBlock->style().position() == StaticPosition || (containingBlock->isInline() && !containingBlock->isReplaced())) && !containingBlock->isRenderView()) { |
| 277 |
if (cb->style().position() == RelativePosition && cb->isInline() && !cb->isReplaced()) { |
277 |
if (containingBlock->style().position() == RelativePosition && containingBlock->isInline() && !containingBlock->isReplaced()) { |
| 278 |
cb = cb->containingBlock(); |
278 |
containingBlock = containingBlock->containingBlock(); |
| 279 |
break; |
279 |
break; |
| 280 |
} |
280 |
} |
| 281 |
cb = cb->parent(); |
281 |
containingBlock = containingBlock->parent(); |
| 282 |
} |
282 |
} |
| 283 |
|
283 |
|
| 284 |
if (cb->isRenderBlock()) |
284 |
if (is<RenderBlock>(*containingBlock)) |
| 285 |
toRenderBlock(cb)->removePositionedObjects(this, NewContainingBlock); |
285 |
downcast<RenderBlock>(*containingBlock).removePositionedObjects(this, NewContainingBlock); |
| 286 |
} |
286 |
} |
| 287 |
} |
287 |
} |
| 288 |
|
288 |
|
|
Lines 332-350
RenderBlock* RenderBlock::continuationBefore(RenderObject* beforeChild)
a/Source/WebCore/rendering/RenderBlock.cpp_sec2
|
| 332 |
if (beforeChild && beforeChild->parent() == this) |
332 |
if (beforeChild && beforeChild->parent() == this) |
| 333 |
return this; |
333 |
return this; |
| 334 |
|
334 |
|
| 335 |
RenderBlock* curr = toRenderBlock(continuation()); |
|
|
| 336 |
RenderBlock* nextToLast = this; |
335 |
RenderBlock* nextToLast = this; |
| 337 |
RenderBlock* last = this; |
336 |
RenderBlock* last = this; |
| 338 |
while (curr) { |
337 |
for (auto* current = downcast<RenderBlock>(continuation()); current; current = downcast<RenderBlock>(current->continuation())) { |
| 339 |
if (beforeChild && beforeChild->parent() == curr) { |
338 |
if (beforeChild && beforeChild->parent() == current) { |
| 340 |
if (curr->firstChild() == beforeChild) |
339 |
if (current->firstChild() == beforeChild) |
| 341 |
return last; |
340 |
return last; |
| 342 |
return curr; |
341 |
return current; |
| 343 |
} |
342 |
} |
| 344 |
|
343 |
|
| 345 |
nextToLast = last; |
344 |
nextToLast = last; |
| 346 |
last = curr; |
345 |
last = current; |
| 347 |
curr = toRenderBlock(curr->continuation()); |
|
|
| 348 |
} |
346 |
} |
| 349 |
|
347 |
|
| 350 |
if (!beforeChild && !last->firstChild()) |
348 |
if (!beforeChild && !last->firstChild()) |
|
Lines 413-489
RenderPtr<RenderBlock> RenderBlock::clone() const
a/Source/WebCore/rendering/RenderBlock.cpp_sec3
|
| 413 |
return cloneBlock; |
411 |
return cloneBlock; |
| 414 |
} |
412 |
} |
| 415 |
|
413 |
|
| 416 |
void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, |
|
|
| 417 |
RenderBlock* middleBlock, |
| 418 |
RenderObject* beforeChild, RenderBoxModelObject* oldCont) |
| 419 |
{ |
| 420 |
// Create a clone of this inline. |
| 421 |
RenderPtr<RenderBlock> cloneBlock = clone(); |
| 422 |
if (!isAnonymousBlock()) |
| 423 |
cloneBlock->setContinuation(oldCont); |
| 424 |
|
| 425 |
if (!beforeChild && isAfterContent(lastChild())) |
| 426 |
beforeChild = lastChild(); |
| 427 |
|
| 428 |
// If we are moving inline children from |this| to cloneBlock, then we need |
| 429 |
// to clear our line box tree. |
| 430 |
if (beforeChild && childrenInline()) |
| 431 |
deleteLines(); |
| 432 |
|
| 433 |
// Now take all of the children from beforeChild to the end and remove |
| 434 |
// them from |this| and place them in the clone. |
| 435 |
moveChildrenTo(cloneBlock.get(), beforeChild, 0, true); |
| 436 |
|
| 437 |
// Hook |clone| up as the continuation of the middle block. |
| 438 |
if (!cloneBlock->isAnonymousBlock()) |
| 439 |
middleBlock->setContinuation(cloneBlock.get()); |
| 440 |
|
| 441 |
// We have been reparented and are now under the fromBlock. We need |
| 442 |
// to walk up our block parent chain until we hit the containing anonymous columns block. |
| 443 |
// Once we hit the anonymous columns block we're done. |
| 444 |
RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); |
| 445 |
RenderBoxModelObject* currChild = this; |
| 446 |
RenderObject* currChildNextSibling = currChild->nextSibling(); |
| 447 |
|
| 448 |
while (curr && curr->isDescendantOf(fromBlock) && curr != fromBlock) { |
| 449 |
RenderBlock* blockCurr = toRenderBlock(curr); |
| 450 |
|
| 451 |
// Create a new clone. |
| 452 |
RenderPtr<RenderBlock> cloneChild = WTF::move(cloneBlock); |
| 453 |
cloneBlock = blockCurr->clone(); |
| 454 |
|
| 455 |
// Insert our child clone as the first child. |
| 456 |
cloneBlock->addChildIgnoringContinuation(cloneChild.leakPtr(), 0); |
| 457 |
|
| 458 |
// Hook the clone up as a continuation of |curr|. Note we do encounter |
| 459 |
// anonymous blocks possibly as we walk up the block chain. When we split an |
| 460 |
// anonymous block, there's no need to do any continuation hookup, since we haven't |
| 461 |
// actually split a real element. |
| 462 |
if (!blockCurr->isAnonymousBlock()) { |
| 463 |
oldCont = blockCurr->continuation(); |
| 464 |
blockCurr->setContinuation(cloneBlock.get()); |
| 465 |
cloneBlock->setContinuation(oldCont); |
| 466 |
} |
| 467 |
|
| 468 |
// Now we need to take all of the children starting from the first child |
| 469 |
// *after* currChild and append them all to the clone. |
| 470 |
blockCurr->moveChildrenTo(cloneBlock.get(), currChildNextSibling, 0, true); |
| 471 |
|
| 472 |
// Keep walking up the chain. |
| 473 |
currChild = curr; |
| 474 |
currChildNextSibling = currChild->nextSibling(); |
| 475 |
curr = toRenderBoxModelObject(curr->parent()); |
| 476 |
} |
| 477 |
|
| 478 |
// Now we are at the columns block level. We need to put the clone into the toBlock. |
| 479 |
toBlock->insertChildInternal(cloneBlock.leakPtr(), nullptr, NotifyChildren); |
| 480 |
|
| 481 |
// Now take all the children after currChild and remove them from the fromBlock |
| 482 |
// and put them in the toBlock. |
| 483 |
if (currChildNextSibling && currChildNextSibling->parent() == fromBlock) |
| 484 |
fromBlock->moveChildrenTo(toBlock, currChildNextSibling, 0, true); |
| 485 |
} |
| 486 |
|
| 487 |
void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) |
414 |
void RenderBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) |
| 488 |
{ |
415 |
{ |
| 489 |
if (continuation() && !isAnonymousBlock()) |
416 |
if (continuation() && !isAnonymousBlock()) |
|
Lines 559-565
void RenderBlock::addChildIgnoringContinuation(RenderObject* newChild, RenderObj
a/Source/WebCore/rendering/RenderBlock.cpp_sec4
|
| 559 |
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); |
486 |
RenderObject* afterChild = beforeChild ? beforeChild->previousSibling() : lastChild(); |
| 560 |
|
487 |
|
| 561 |
if (afterChild && afterChild->isAnonymousBlock()) { |
488 |
if (afterChild && afterChild->isAnonymousBlock()) { |
| 562 |
toRenderBlock(afterChild)->addChild(newChild); |
489 |
downcast<RenderBlock>(*afterChild).addChild(newChild); |
| 563 |
return; |
490 |
return; |
| 564 |
} |
491 |
} |
| 565 |
|
492 |
|
|
Lines 576-583
void RenderBlock::addChildIgnoringContinuation(RenderObject* newChild, RenderObj
a/Source/WebCore/rendering/RenderBlock.cpp_sec5
|
| 576 |
|
503 |
|
| 577 |
RenderBox::addChild(newChild, beforeChild); |
504 |
RenderBox::addChild(newChild, beforeChild); |
| 578 |
|
505 |
|
| 579 |
if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRenderBlock()) |
506 |
if (madeBoxesNonInline && is<RenderBlock>(parent()) && isAnonymousBlock()) |
| 580 |
toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
507 |
downcast<RenderBlock>(*parent()).removeLeftoverAnonymousBlock(this); |
| 581 |
// this object may be dead here |
508 |
// this object may be dead here |
| 582 |
} |
509 |
} |
| 583 |
|
510 |
|
|
Lines 722-732
void RenderBlock::removeLeftoverAnonymousBlock(RenderBlock* child)
a/Source/WebCore/rendering/RenderBlock.cpp_sec6
|
| 722 |
child->destroy(); |
649 |
child->destroy(); |
| 723 |
} |
650 |
} |
| 724 |
|
651 |
|
| 725 |
static bool canMergeAnonymousBlock(RenderBlock* anonymousBlock) |
652 |
static bool canMergeAnonymousBlock(RenderBlock& anonymousBlock) |
| 726 |
{ |
653 |
{ |
| 727 |
if (anonymousBlock->beingDestroyed() || anonymousBlock->continuation()) |
654 |
if (anonymousBlock.beingDestroyed() || anonymousBlock.continuation()) |
| 728 |
return false; |
655 |
return false; |
| 729 |
if (anonymousBlock->isRubyRun() || anonymousBlock->isRubyBase()) |
656 |
if (anonymousBlock.isRubyRun() || anonymousBlock.isRubyBase()) |
| 730 |
return false; |
657 |
return false; |
| 731 |
return true; |
658 |
return true; |
| 732 |
} |
659 |
} |
|
Lines 739-762
static bool canMergeContiguousAnonymousBlocks(RenderObject& oldChild, RenderObje
a/Source/WebCore/rendering/RenderBlock.cpp_sec7
|
| 739 |
if (previous) { |
666 |
if (previous) { |
| 740 |
if (!previous->isAnonymousBlock()) |
667 |
if (!previous->isAnonymousBlock()) |
| 741 |
return false; |
668 |
return false; |
| 742 |
RenderBlock* previousAnonymousBlock = toRenderBlock(previous); |
669 |
RenderBlock& previousAnonymousBlock = downcast<RenderBlock>(*previous); |
| 743 |
if (!canMergeAnonymousBlock(previousAnonymousBlock)) |
670 |
if (!canMergeAnonymousBlock(previousAnonymousBlock)) |
| 744 |
return false; |
671 |
return false; |
| 745 |
} |
672 |
} |
| 746 |
if (next) { |
673 |
if (next) { |
| 747 |
if (!next->isAnonymousBlock()) |
674 |
if (!next->isAnonymousBlock()) |
| 748 |
return false; |
675 |
return false; |
| 749 |
RenderBlock* nextAnonymousBlock = toRenderBlock(next); |
676 |
RenderBlock& nextAnonymousBlock = downcast<RenderBlock>(*next); |
| 750 |
if (!canMergeAnonymousBlock(nextAnonymousBlock)) |
677 |
if (!canMergeAnonymousBlock(nextAnonymousBlock)) |
| 751 |
return false; |
678 |
return false; |
| 752 |
} |
679 |
} |
| 753 |
return true; |
680 |
return true; |
| 754 |
} |
681 |
} |
| 755 |
|
682 |
|
| 756 |
void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderBlock* child) |
683 |
void RenderBlock::collapseAnonymousBoxChild(RenderBlock& parent, RenderBlock* child) |
| 757 |
{ |
684 |
{ |
| 758 |
parent->setNeedsLayoutAndPrefWidthsRecalc(); |
685 |
parent.setNeedsLayoutAndPrefWidthsRecalc(); |
| 759 |
parent->setChildrenInline(child->childrenInline()); |
686 |
parent.setChildrenInline(child->childrenInline()); |
| 760 |
RenderObject* nextSibling = child->nextSibling(); |
687 |
RenderObject* nextSibling = child->nextSibling(); |
| 761 |
|
688 |
|
| 762 |
RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); |
689 |
RenderFlowThread* childFlowThread = child->flowThreadContainingBlock(); |
|
Lines 764-771
void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderBlock* ch
a/Source/WebCore/rendering/RenderBlock.cpp_sec8
|
| 764 |
if (childFlowThread && childFlowThread->isRenderNamedFlowThread()) |
691 |
if (childFlowThread && childFlowThread->isRenderNamedFlowThread()) |
| 765 |
toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(child); |
692 |
toRenderNamedFlowThread(childFlowThread)->removeFlowChildInfo(child); |
| 766 |
|
693 |
|
| 767 |
parent->removeChildInternal(*child, child->hasLayer() ? NotifyChildren : DontNotifyChildren); |
694 |
parent.removeChildInternal(*child, child->hasLayer() ? NotifyChildren : DontNotifyChildren); |
| 768 |
child->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); |
695 |
child->moveAllChildrenTo(&parent, nextSibling, child->hasLayer()); |
| 769 |
// Delete the now-empty block's lines and nuke it. |
696 |
// Delete the now-empty block's lines and nuke it. |
| 770 |
child->deleteLines(); |
697 |
child->deleteLines(); |
| 771 |
child->destroy(); |
698 |
child->destroy(); |
|
Lines 786-829
RenderObject* RenderBlock::removeChild(RenderObject& oldChild)
a/Source/WebCore/rendering/RenderBlock.cpp_sec9
|
| 786 |
bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, prev, next); |
713 |
bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, prev, next); |
| 787 |
if (canMergeAnonymousBlocks && prev && next) { |
714 |
if (canMergeAnonymousBlocks && prev && next) { |
| 788 |
prev->setNeedsLayoutAndPrefWidthsRecalc(); |
715 |
prev->setNeedsLayoutAndPrefWidthsRecalc(); |
| 789 |
RenderBlock* nextBlock = toRenderBlock(next); |
716 |
RenderBlock& nextBlock = downcast<RenderBlock>(*next); |
| 790 |
RenderBlock* prevBlock = toRenderBlock(prev); |
717 |
RenderBlock& prevBlock = downcast<RenderBlock>(*prev); |
| 791 |
|
718 |
|
| 792 |
if (prev->childrenInline() != next->childrenInline()) { |
719 |
if (prev->childrenInline() != next->childrenInline()) { |
| 793 |
RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBlock : nextBlock; |
720 |
RenderBlock& inlineChildrenBlock = prev->childrenInline() ? prevBlock : nextBlock; |
| 794 |
RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock : prevBlock; |
721 |
RenderBlock& blockChildrenBlock = prev->childrenInline() ? nextBlock : prevBlock; |
| 795 |
|
722 |
|
| 796 |
// Place the inline children block inside of the block children block instead of deleting it. |
723 |
// Place the inline children block inside of the block children block instead of deleting it. |
| 797 |
// In order to reuse it, we have to reset it to just be a generic anonymous block. Make sure |
724 |
// In order to reuse it, we have to reset it to just be a generic anonymous block. Make sure |
| 798 |
// to clear out inherited column properties by just making a new style, and to also clear the |
725 |
// to clear out inherited column properties by just making a new style, and to also clear the |
| 799 |
// column span flag if it is set. |
726 |
// column span flag if it is set. |
| 800 |
ASSERT(!inlineChildrenBlock->continuation()); |
727 |
ASSERT(!inlineChildrenBlock.continuation()); |
| 801 |
// Cache this value as it might get changed in setStyle() call. |
728 |
// Cache this value as it might get changed in setStyle() call. |
| 802 |
bool inlineChildrenBlockHasLayer = inlineChildrenBlock->hasLayer(); |
729 |
bool inlineChildrenBlockHasLayer = inlineChildrenBlock.hasLayer(); |
| 803 |
inlineChildrenBlock->setStyle(RenderStyle::createAnonymousStyleWithDisplay(&style(), BLOCK)); |
730 |
inlineChildrenBlock.setStyle(RenderStyle::createAnonymousStyleWithDisplay(&style(), BLOCK)); |
| 804 |
removeChildInternal(*inlineChildrenBlock, inlineChildrenBlockHasLayer ? NotifyChildren : DontNotifyChildren); |
731 |
removeChildInternal(inlineChildrenBlock, inlineChildrenBlockHasLayer ? NotifyChildren : DontNotifyChildren); |
| 805 |
|
732 |
|
| 806 |
// Now just put the inlineChildrenBlock inside the blockChildrenBlock. |
733 |
// Now just put the inlineChildrenBlock inside the blockChildrenBlock. |
| 807 |
RenderObject* beforeChild = prev == inlineChildrenBlock ? blockChildrenBlock->firstChild() : nullptr; |
734 |
RenderObject* beforeChild = prev == &inlineChildrenBlock ? blockChildrenBlock.firstChild() : nullptr; |
| 808 |
blockChildrenBlock->insertChildInternal(inlineChildrenBlock, beforeChild, |
735 |
blockChildrenBlock.insertChildInternal(&inlineChildrenBlock, beforeChild, |
| 809 |
(inlineChildrenBlockHasLayer || blockChildrenBlock->hasLayer()) ? NotifyChildren : DontNotifyChildren); |
736 |
(inlineChildrenBlockHasLayer || blockChildrenBlock.hasLayer()) ? NotifyChildren : DontNotifyChildren); |
| 810 |
next->setNeedsLayoutAndPrefWidthsRecalc(); |
737 |
next->setNeedsLayoutAndPrefWidthsRecalc(); |
| 811 |
|
738 |
|
| 812 |
// inlineChildrenBlock got reparented to blockChildrenBlock, so it is no longer a child |
739 |
// inlineChildrenBlock got reparented to blockChildrenBlock, so it is no longer a child |
| 813 |
// of "this". we null out prev or next so that is not used later in the function. |
740 |
// of "this". we null out prev or next so that is not used later in the function. |
| 814 |
if (inlineChildrenBlock == prevBlock) |
741 |
if (&inlineChildrenBlock == &prevBlock) |
| 815 |
prev = 0; |
742 |
prev = nullptr; |
| 816 |
else |
743 |
else |
| 817 |
next = 0; |
744 |
next = nullptr; |
| 818 |
} else { |
745 |
} else { |
| 819 |
// Take all the children out of the |next| block and put them in |
746 |
// Take all the children out of the |next| block and put them in |
| 820 |
// the |prev| block. |
747 |
// the |prev| block. |
| 821 |
nextBlock->moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock->hasLayer() || prevBlock->hasLayer()); |
748 |
nextBlock.moveAllChildrenIncludingFloatsTo(&prevBlock, nextBlock.hasLayer() || prevBlock.hasLayer()); |
| 822 |
|
749 |
|
| 823 |
// Delete the now-empty block's lines and nuke it. |
750 |
// Delete the now-empty block's lines and nuke it. |
| 824 |
nextBlock->deleteLines(); |
751 |
nextBlock.deleteLines(); |
| 825 |
nextBlock->destroy(); |
752 |
nextBlock.destroy(); |
| 826 |
next = 0; |
753 |
next = nullptr; |
| 827 |
} |
754 |
} |
| 828 |
} |
755 |
} |
| 829 |
|
756 |
|
|
Lines 836-852
RenderObject* RenderBlock::removeChild(RenderObject& oldChild)
a/Source/WebCore/rendering/RenderBlock.cpp_sec10
|
| 836 |
// The removal has knocked us down to containing only a single anonymous |
763 |
// The removal has knocked us down to containing only a single anonymous |
| 837 |
// box. We can go ahead and pull the content right back up into our |
764 |
// box. We can go ahead and pull the content right back up into our |
| 838 |
// box. |
765 |
// box. |
| 839 |
collapseAnonymousBoxChild(this, toRenderBlock(child)); |
766 |
collapseAnonymousBoxChild(*this, downcast<RenderBlock>(child)); |
| 840 |
nextSibling = nullptr; |
767 |
nextSibling = nullptr; |
| 841 |
} else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) && canCollapseAnonymousBlockChild()) { |
768 |
} else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) && canCollapseAnonymousBlockChild()) { |
| 842 |
// It's possible that the removal has knocked us down to a single anonymous |
769 |
// It's possible that the removal has knocked us down to a single anonymous |
| 843 |
// block with pseudo-style element siblings (e.g. first-letter). If these |
770 |
// block with pseudo-style element siblings (e.g. first-letter). If these |
| 844 |
// are floating, then we need to pull the content up also. |
771 |
// are floating, then we need to pull the content up also. |
| 845 |
RenderBlock* anonBlock = toRenderBlock((prev && prev->isAnonymousBlock()) ? prev : next); |
772 |
RenderBlock* anonBlock = downcast<RenderBlock>((prev && prev->isAnonymousBlock()) ? prev : next); |
| 846 |
if ((anonBlock->previousSibling() || anonBlock->nextSibling()) |
773 |
if ((anonBlock->previousSibling() || anonBlock->nextSibling()) |
| 847 |
&& (!anonBlock->previousSibling() || (anonBlock->previousSibling()->style().styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating() && !anonBlock->previousSibling()->previousSibling())) |
774 |
&& (!anonBlock->previousSibling() || (anonBlock->previousSibling()->style().styleType() != NOPSEUDO && anonBlock->previousSibling()->isFloating() && !anonBlock->previousSibling()->previousSibling())) |
| 848 |
&& (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style().styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating() && !anonBlock->nextSibling()->nextSibling()))) { |
775 |
&& (!anonBlock->nextSibling() || (anonBlock->nextSibling()->style().styleType() != NOPSEUDO && anonBlock->nextSibling()->isFloating() && !anonBlock->nextSibling()->nextSibling()))) { |
| 849 |
collapseAnonymousBoxChild(this, anonBlock); |
776 |
collapseAnonymousBoxChild(*this, anonBlock); |
| 850 |
nextSibling = nullptr; |
777 |
nextSibling = nullptr; |
| 851 |
} |
778 |
} |
| 852 |
} |
779 |
} |
|
Lines 864-886
RenderObject* RenderBlock::removeChild(RenderObject& oldChild)
a/Source/WebCore/rendering/RenderBlock.cpp_sec11
|
| 864 |
auto containingBlockIgnoringAnonymous = containingBlock(); |
791 |
auto containingBlockIgnoringAnonymous = containingBlock(); |
| 865 |
while (containingBlockIgnoringAnonymous && containingBlockIgnoringAnonymous->isAnonymousBlock()) |
792 |
while (containingBlockIgnoringAnonymous && containingBlockIgnoringAnonymous->isAnonymousBlock()) |
| 866 |
containingBlockIgnoringAnonymous = containingBlockIgnoringAnonymous->containingBlock(); |
793 |
containingBlockIgnoringAnonymous = containingBlockIgnoringAnonymous->containingBlock(); |
| 867 |
for (RenderObject* curr = this; curr; curr = curr->previousInPreOrder(containingBlockIgnoringAnonymous)) { |
794 |
for (RenderObject* current = this; current; current = current->previousInPreOrder(containingBlockIgnoringAnonymous)) { |
| 868 |
if (curr->virtualContinuation() != this) |
795 |
if (current->virtualContinuation() != this) |
| 869 |
continue; |
796 |
continue; |
| 870 |
|
797 |
|
| 871 |
// Found our previous continuation. We just need to point it to |
798 |
// Found our previous continuation. We just need to point it to |
| 872 |
// |this|'s next continuation. |
799 |
// |this|'s next continuation. |
| 873 |
RenderBoxModelObject* nextContinuation = continuation(); |
800 |
RenderBoxModelObject* nextContinuation = continuation(); |
| 874 |
if (curr->isRenderInline()) |
801 |
if (is<RenderInline>(*current)) |
| 875 |
toRenderInline(curr)->setContinuation(nextContinuation); |
802 |
downcast<RenderInline>(*current).setContinuation(nextContinuation); |
| 876 |
else if (curr->isRenderBlock()) |
803 |
else if (is<RenderBlock>(*current)) |
| 877 |
toRenderBlock(curr)->setContinuation(nextContinuation); |
804 |
downcast<RenderBlock>(*current).setContinuation(nextContinuation); |
| 878 |
else |
805 |
else |
| 879 |
ASSERT_NOT_REACHED(); |
806 |
ASSERT_NOT_REACHED(); |
| 880 |
|
807 |
|
| 881 |
break; |
808 |
break; |
| 882 |
} |
809 |
} |
| 883 |
setContinuation(0); |
810 |
setContinuation(nullptr); |
| 884 |
destroy(); |
811 |
destroy(); |
| 885 |
} |
812 |
} |
| 886 |
} |
813 |
} |
|
Lines 1741-1751
RenderBlock* RenderBlock::blockElementContinuation() const
a/Source/WebCore/rendering/RenderBlock.cpp_sec12
|
| 1741 |
{ |
1668 |
{ |
| 1742 |
RenderBoxModelObject* currentContinuation = continuation(); |
1669 |
RenderBoxModelObject* currentContinuation = continuation(); |
| 1743 |
if (!currentContinuation || currentContinuation->isInline()) |
1670 |
if (!currentContinuation || currentContinuation->isInline()) |
| 1744 |
return 0; |
1671 |
return nullptr; |
| 1745 |
RenderBlock* nextContinuation = toRenderBlock(currentContinuation); |
1672 |
RenderBlock& nextContinuation = downcast<RenderBlock>(*currentContinuation); |
| 1746 |
if (nextContinuation->isAnonymousBlock()) |
1673 |
if (nextContinuation.isAnonymousBlock()) |
| 1747 |
return nextContinuation->blockElementContinuation(); |
1674 |
return nextContinuation.blockElementContinuation(); |
| 1748 |
return nextContinuation; |
1675 |
return &nextContinuation; |
| 1749 |
} |
1676 |
} |
| 1750 |
|
1677 |
|
| 1751 |
static ContinuationOutlineTableMap* continuationOutlineTable() |
1678 |
static ContinuationOutlineTableMap* continuationOutlineTable() |
|
Lines 2042-2048
GapRects RenderBlock::blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoi
a/Source/WebCore/rendering/RenderBlock.cpp_sec13
|
| 2042 |
lastLogicalRight = logicalRightSelectionOffset(rootBlock, curr->logicalBottom(), cache); |
1969 |
lastLogicalRight = logicalRightSelectionOffset(rootBlock, curr->logicalBottom(), cache); |
| 2043 |
} else if (childState != SelectionNone) { |
1970 |
} else if (childState != SelectionNone) { |
| 2044 |
// We must be a block that has some selected object inside it. Go ahead and recur. |
1971 |
// We must be a block that has some selected object inside it. Go ahead and recur. |
| 2045 |
result.unite(toRenderBlock(curr)->selectionGaps(rootBlock, rootBlockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()), |
1972 |
result.unite(downcast<RenderBlock>(*curr).selectionGaps(rootBlock, rootBlockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()), |
| 2046 |
lastLogicalTop, lastLogicalLeft, lastLogicalRight, childCache, paintInfo)); |
1973 |
lastLogicalTop, lastLogicalLeft, lastLogicalRight, childCache, paintInfo)); |
| 2047 |
} |
1974 |
} |
| 2048 |
} |
1975 |
} |
|
Lines 2162-2190
LayoutUnit RenderBlock::logicalRightSelectionOffset(RenderBlock& rootBlock, Layo
a/Source/WebCore/rendering/RenderBlock.cpp_sec14
|
| 2162 |
RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) const |
2089 |
RenderBlock* RenderBlock::blockBeforeWithinSelectionRoot(LayoutSize& offset) const |
| 2163 |
{ |
2090 |
{ |
| 2164 |
if (isSelectionRoot()) |
2091 |
if (isSelectionRoot()) |
| 2165 |
return 0; |
2092 |
return nullptr; |
| 2166 |
|
2093 |
|
| 2167 |
const RenderElement* object = this; |
2094 |
const RenderElement* object = this; |
| 2168 |
RenderObject* sibling; |
2095 |
RenderObject* sibling; |
| 2169 |
do { |
2096 |
do { |
| 2170 |
sibling = object->previousSibling(); |
2097 |
sibling = object->previousSibling(); |
| 2171 |
while (sibling && (!sibling->isRenderBlock() || toRenderBlock(sibling)->isSelectionRoot())) |
2098 |
while (sibling && (!is<RenderBlock>(*sibling) || downcast<RenderBlock>(*sibling).isSelectionRoot())) |
| 2172 |
sibling = sibling->previousSibling(); |
2099 |
sibling = sibling->previousSibling(); |
| 2173 |
|
2100 |
|
| 2174 |
offset -= LayoutSize(toRenderBlock(object)->logicalLeft(), toRenderBlock(object)->logicalTop()); |
2101 |
offset -= LayoutSize(downcast<RenderBlock>(*object).logicalLeft(), downcast<RenderBlock>(*object).logicalTop()); |
| 2175 |
object = object->parent(); |
2102 |
object = object->parent(); |
| 2176 |
} while (!sibling && object && object->isRenderBlock() && !toRenderBlock(object)->isSelectionRoot()); |
2103 |
} while (!sibling && is<RenderBlock>(object) && !downcast<RenderBlock>(*object).isSelectionRoot()); |
| 2177 |
|
2104 |
|
| 2178 |
if (!sibling) |
2105 |
if (!sibling) |
| 2179 |
return 0; |
2106 |
return nullptr; |
| 2180 |
|
2107 |
|
| 2181 |
RenderBlock* beforeBlock = toRenderBlock(sibling); |
2108 |
RenderBlock* beforeBlock = downcast<RenderBlock>(sibling); |
| 2182 |
|
2109 |
|
| 2183 |
offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); |
2110 |
offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); |
| 2184 |
|
2111 |
|
| 2185 |
RenderObject* child = beforeBlock->lastChild(); |
2112 |
RenderObject* child = beforeBlock->lastChild(); |
| 2186 |
while (child && child->isRenderBlock()) { |
2113 |
while (is<RenderBlock>(child)) { |
| 2187 |
beforeBlock = toRenderBlock(child); |
2114 |
beforeBlock = downcast<RenderBlock>(child); |
| 2188 |
offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); |
2115 |
offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop()); |
| 2189 |
child = beforeBlock->lastChild(); |
2116 |
child = beforeBlock->lastChild(); |
| 2190 |
} |
2117 |
} |
|
Lines 2682-2688
static inline bool isChildHitTestCandidate(const RenderBox& box, const RenderReg
a/Source/WebCore/rendering/RenderBlock.cpp_sec15
|
| 2682 |
return false; |
2609 |
return false; |
| 2683 |
if (!region) |
2610 |
if (!region) |
| 2684 |
return true; |
2611 |
return true; |
| 2685 |
const RenderBlock& block = box.isRenderBlock() ? toRenderBlock(box) : *box.containingBlock(); |
2612 |
const RenderBlock& block = is<RenderBlock>(box) ? downcast<RenderBlock>(box) : *box.containingBlock(); |
| 2686 |
return block.regionAtBlockOffset(point.y()) == region; |
2613 |
return block.regionAtBlockOffset(point.y()) == region; |
| 2687 |
} |
2614 |
} |
| 2688 |
|
2615 |
|
|
Lines 3042-3052
RenderBlock* RenderBlock::firstLineBlock() const
a/Source/WebCore/rendering/RenderBlock.cpp_sec16
|
| 3042 |
if (firstLineBlock->isReplaced() || firstLineBlock->isFloating() |
2969 |
if (firstLineBlock->isReplaced() || firstLineBlock->isFloating() |
| 3043 |
|| !parentBlock || parentBlock->firstChild() != firstLineBlock || !isRenderBlockFlowOrRenderButton(*parentBlock)) |
2970 |
|| !parentBlock || parentBlock->firstChild() != firstLineBlock || !isRenderBlockFlowOrRenderButton(*parentBlock)) |
| 3044 |
break; |
2971 |
break; |
| 3045 |
firstLineBlock = toRenderBlock(parentBlock); |
2972 |
firstLineBlock = downcast<RenderBlock>(parentBlock); |
| 3046 |
} |
2973 |
} |
| 3047 |
|
2974 |
|
| 3048 |
if (!hasPseudo) |
2975 |
if (!hasPseudo) |
| 3049 |
return 0; |
2976 |
return nullptr; |
| 3050 |
|
2977 |
|
| 3051 |
return firstLineBlock; |
2978 |
return firstLineBlock; |
| 3052 |
} |
2979 |
} |
|
Lines 3125-3135
static inline RenderBlock* findFirstLetterBlock(RenderBlock* start)
a/Source/WebCore/rendering/RenderBlock.cpp_sec17
|
| 3125 |
RenderElement* parentBlock = firstLetterBlock->parent(); |
3052 |
RenderElement* parentBlock = firstLetterBlock->parent(); |
| 3126 |
if (firstLetterBlock->isReplaced() || !parentBlock || parentBlock->firstChild() != firstLetterBlock |
3053 |
if (firstLetterBlock->isReplaced() || !parentBlock || parentBlock->firstChild() != firstLetterBlock |
| 3127 |
|| !isRenderBlockFlowOrRenderButton(*parentBlock)) |
3054 |
|| !isRenderBlockFlowOrRenderButton(*parentBlock)) |
| 3128 |
return 0; |
3055 |
return nullptr; |
| 3129 |
firstLetterBlock = toRenderBlock(parentBlock); |
3056 |
firstLetterBlock = downcast<RenderBlock>(parentBlock); |
| 3130 |
} |
3057 |
} |
| 3131 |
|
3058 |
|
| 3132 |
return 0; |
3059 |
return nullptr; |
| 3133 |
} |
3060 |
} |
| 3134 |
|
3061 |
|
| 3135 |
void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderObject* currentChild) |
3062 |
void RenderBlock::updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderObject* currentChild) |
|
Lines 3421-3428
const RenderStyle& RenderBlock::outlineStyleForRepaint() const
a/Source/WebCore/rendering/RenderBlock.cpp_sec18
|
| 3421 |
void RenderBlock::childBecameNonInline(RenderObject*) |
3348 |
void RenderBlock::childBecameNonInline(RenderObject*) |
| 3422 |
{ |
3349 |
{ |
| 3423 |
makeChildrenNonInline(); |
3350 |
makeChildrenNonInline(); |
| 3424 |
if (isAnonymousBlock() && parent() && parent()->isRenderBlock()) |
3351 |
if (isAnonymousBlock() && is<RenderBlock>(parent())) |
| 3425 |
toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
3352 |
downcast<RenderBlock>(*parent()).removeLeftoverAnonymousBlock(this); |
| 3426 |
// |this| may be dead here |
3353 |
// |this| may be dead here |
| 3427 |
} |
3354 |
} |
| 3428 |
|
3355 |
|
|
Lines 3671-3682
bool RenderBlock::hasMarginBeforeQuirk(const RenderBox& child) const
a/Source/WebCore/rendering/RenderBlock.cpp_sec19
|
| 3671 |
// If the child has the same directionality as we do, then we can just return its |
3598 |
// If the child has the same directionality as we do, then we can just return its |
| 3672 |
// margin quirk. |
3599 |
// margin quirk. |
| 3673 |
if (!child.isWritingModeRoot()) |
3600 |
if (!child.isWritingModeRoot()) |
| 3674 |
return child.isRenderBlock() ? toRenderBlock(child).hasMarginBeforeQuirk() : child.style().hasMarginBeforeQuirk(); |
3601 |
return is<RenderBlock>(child) ? downcast<RenderBlock>(child).hasMarginBeforeQuirk() : child.style().hasMarginBeforeQuirk(); |
| 3675 |
|
3602 |
|
| 3676 |
// The child has a different directionality. If the child is parallel, then it's just |
3603 |
// The child has a different directionality. If the child is parallel, then it's just |
| 3677 |
// flipped relative to us. We can use the opposite edge. |
3604 |
// flipped relative to us. We can use the opposite edge. |
| 3678 |
if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
3605 |
if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
| 3679 |
return child.isRenderBlock() ? toRenderBlock(child).hasMarginAfterQuirk() : child.style().hasMarginAfterQuirk(); |
3606 |
return is<RenderBlock>(child) ? downcast<RenderBlock>(child).hasMarginAfterQuirk() : child.style().hasMarginAfterQuirk(); |
| 3680 |
|
3607 |
|
| 3681 |
// The child is perpendicular to us and box sides are never quirky in html.css, and we don't really care about |
3608 |
// The child is perpendicular to us and box sides are never quirky in html.css, and we don't really care about |
| 3682 |
// whether or not authors specified quirky ems, since they're an implementation detail. |
3609 |
// whether or not authors specified quirky ems, since they're an implementation detail. |
|
Lines 3688-3699
bool RenderBlock::hasMarginAfterQuirk(const RenderBox& child) const
a/Source/WebCore/rendering/RenderBlock.cpp_sec20
|
| 3688 |
// If the child has the same directionality as we do, then we can just return its |
3615 |
// If the child has the same directionality as we do, then we can just return its |
| 3689 |
// margin quirk. |
3616 |
// margin quirk. |
| 3690 |
if (!child.isWritingModeRoot()) |
3617 |
if (!child.isWritingModeRoot()) |
| 3691 |
return child.isRenderBlock() ? toRenderBlock(child).hasMarginAfterQuirk() : child.style().hasMarginAfterQuirk(); |
3618 |
return is<RenderBlock>(child) ? downcast<RenderBlock>(child).hasMarginAfterQuirk() : child.style().hasMarginAfterQuirk(); |
| 3692 |
|
3619 |
|
| 3693 |
// The child has a different directionality. If the child is parallel, then it's just |
3620 |
// The child has a different directionality. If the child is parallel, then it's just |
| 3694 |
// flipped relative to us. We can use the opposite edge. |
3621 |
// flipped relative to us. We can use the opposite edge. |
| 3695 |
if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
3622 |
if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
| 3696 |
return child.isRenderBlock() ? toRenderBlock(child).hasMarginBeforeQuirk() : child.style().hasMarginBeforeQuirk(); |
3623 |
return is<RenderBlock>(child) ? downcast<RenderBlock>(child).hasMarginBeforeQuirk() : child.style().hasMarginBeforeQuirk(); |
| 3697 |
|
3624 |
|
| 3698 |
// The child is perpendicular to us and box sides are never quirky in html.css, and we don't really care about |
3625 |
// The child is perpendicular to us and box sides are never quirky in html.css, and we don't really care about |
| 3699 |
// whether or not authors specified quirky ems, since they're an implementation detail. |
3626 |
// whether or not authors specified quirky ems, since they're an implementation detail. |