RenderTreeBuilderBlockFlow.cpp [plain text]
#include "config.h"
#include "RenderTreeBuilderBlockFlow.h"
#include "RenderMultiColumnFlow.h"
#include "RenderTreeBuilderBlock.h"
#include "RenderTreeBuilderMultiColumn.h"
namespace WebCore {
RenderTreeBuilder::BlockFlow::BlockFlow(RenderTreeBuilder& builder)
: m_builder(builder)
{
}
void RenderTreeBuilder::BlockFlow::attach(RenderBlockFlow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
{
if (parent.multiColumnFlow() && (!parent.isFieldset() || !child->isLegend())) {
if (parent.isFieldset() && beforeChild && beforeChild->isLegend())
return m_builder.blockBuilder().attach(*parent.multiColumnFlow(), WTFMove(child), nullptr);
return m_builder.attach(*parent.multiColumnFlow(), WTFMove(child), beforeChild);
}
auto* beforeChildOrPlaceholder = beforeChild;
if (auto* containingFragmentedFlow = parent.enclosingFragmentedFlow())
beforeChildOrPlaceholder = m_builder.multiColumnBuilder().resolveMovedChild(*containingFragmentedFlow, beforeChild);
m_builder.blockBuilder().attach(parent, WTFMove(child), beforeChildOrPlaceholder);
}
void RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloats(RenderBlockFlow& from, RenderBlock& to, RenderTreeBuilder::NormalizeAfterInsertion normalizeAfterInsertion)
{
m_builder.moveAllChildren(from, to, normalizeAfterInsertion);
from.addFloatsToNewParent(downcast<RenderBlockFlow>(to));
}
}