本文整理汇总了C++中RenderBoxModelObject::removeChild方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderBoxModelObject::removeChild方法的具体用法?C++ RenderBoxModelObject::removeChild怎么用?C++ RenderBoxModelObject::removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderBoxModelObject
的用法示例。
在下文中一共展示了RenderBoxModelObject::removeChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flowThreadDescendantInserted
void RenderMultiColumnFlowThread::flowThreadDescendantInserted(RenderObject* descendant)
{
if (gShiftingSpanner || m_beingEvacuated || descendant->isInFlowRenderFlowThread())
return;
RenderObject* subtreeRoot = descendant;
for (; descendant; descendant = (descendant ? descendant->nextInPreOrder(subtreeRoot) : nullptr)) {
if (descendant->isRenderMultiColumnSpannerPlaceholder()) {
// A spanner's placeholder has been inserted. The actual spanner renderer is moved from
// where it would otherwise occur (if it weren't a spanner) to becoming a sibling of the
// column sets.
RenderMultiColumnSpannerPlaceholder* placeholder = toRenderMultiColumnSpannerPlaceholder(descendant);
if (placeholder->flowThread() != this) {
// This isn't our spanner! It shifted here from an ancestor multicolumn block. It's going to end up
// becoming our spanner instead, but for it to do that we first have to nuke the original spanner,
// and get the spanner content back into this flow thread.
RenderBox* spanner = placeholder->spanner();
// Get info for the move of the original content back into our flow thread.
RenderBoxModelObject* placeholderParent = toRenderBoxModelObject(placeholder->parent());
// We have to nuke the placeholder, since the ancestor already lost the mapping to it when
// we shifted the placeholder down into this flow thread.
RenderObject* placeholderNextSibling = placeholderParent->removeChild(*placeholder);
// Get the ancestor multicolumn flow thread to clean up its mess.
RenderBlockFlow* ancestorBlock = toRenderBlockFlow(spanner->parent());
ancestorBlock->multiColumnFlowThread()->flowThreadRelativeWillBeRemoved(spanner);
// Now move the original content into our flow thread. It will end up calling flowThreadDescendantInserted
// on the new content only, and everything will get set up properly.
ancestorBlock->moveChildTo(placeholderParent, spanner, placeholderNextSibling, true);
// Advance descendant.
descendant = placeholderNextSibling;
// If the spanner was the subtree root, then we're done, since there is nothing else left to insert.
if (!descendant)
return;
// Now that we have done this, we can continue past the spanning content, since we advanced
// descendant already.
if (descendant)
descendant = descendant->previousInPreOrder(subtreeRoot);
continue;
}
ASSERT(!m_spannerMap.get(placeholder->spanner()));
m_spannerMap.add(placeholder->spanner(), placeholder);
ASSERT(!placeholder->firstChild()); // There should be no children here, but if there are, we ought to skip them.
continue;
}
RenderBlockFlow* multicolContainer = multiColumnBlockFlow();
RenderObject* nextRendererInFlowThread = descendant->nextInPreOrderAfterChildren(this);
RenderObject* insertBeforeMulticolChild = nullptr;
if (isValidColumnSpanner(this, descendant)) {
// This is a spanner (column-span:all). Such renderers are moved from where they would
// otherwise occur in the render tree to becoming a direct child of the multicol container,
// so that they live among the column sets. This simplifies the layout implementation, and
// basically just relies on regular block layout done by the RenderBlockFlow that
// establishes the multicol container.
RenderBlockFlow* container = toRenderBlockFlow(descendant->parent());
RenderMultiColumnSet* setToSplit = nullptr;
if (nextRendererInFlowThread) {
setToSplit = findSetRendering(descendant);
if (setToSplit) {
setToSplit->setNeedsLayout();
insertBeforeMulticolChild = setToSplit->nextSibling();
}
}
// Moving a spanner's renderer so that it becomes a sibling of the column sets requires us
// to insert an anonymous placeholder in the tree where the spanner's renderer otherwise
// would have been. This is needed for a two reasons: We need a way of separating inline
// content before and after the spanner, so that it becomes separate line boxes. Secondly,
// this placeholder serves as a break point for column sets, so that, when encountered, we
// end flowing one column set and move to the next one.
RenderMultiColumnSpannerPlaceholder* placeholder = RenderMultiColumnSpannerPlaceholder::createAnonymous(this, toRenderBox(descendant), &container->style());
container->addChild(placeholder, descendant->nextSibling());
container->removeChild(*descendant);
// This is a guard to stop an ancestor flow thread from processing the spanner.
gShiftingSpanner = true;
multicolContainer->RenderBlock::addChild(descendant, insertBeforeMulticolChild);
gShiftingSpanner = false;
// The spanner has now been moved out from the flow thread, but we don't want to
// examine its children anyway. They are all part of the spanner and shouldn't trigger
// creation of column sets or anything like that. Continue at its original position in
// the tree, i.e. where the placeholder was just put.
if (subtreeRoot == descendant)
subtreeRoot = placeholder;
descendant = placeholder;
} else {
// This is regular multicol content, i.e. not part of a spanner.
if (nextRendererInFlowThread && nextRendererInFlowThread->isRenderMultiColumnSpannerPlaceholder()) {
// Inserted right before a spanner. Is there a set for us there?
RenderMultiColumnSpannerPlaceholder* placeholder = toRenderMultiColumnSpannerPlaceholder(nextRendererInFlowThread);
if (RenderObject* previous = placeholder->spanner()->previousSibling()) {
if (previous->isRenderMultiColumnSet())
continue; // There's already a set there. Nothing to do.
//.........这里部分代码省略.........