예제 #1
0
void Text::reattachIfNeeded(const AttachContext& context)
{
    bool layoutObjectIsNeeded = false;
    ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this);
    if (layoutParent) {
        if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) {
            if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLayoutObject))
                layoutObjectIsNeeded = true;
        }
    }

    if (layoutObjectIsNeeded == !!layoutObject())
        return;

    // The following is almost the same as Node::reattach() except that we create a layoutObject only if needed.
    // Not calling reattach() to avoid repeated calls to Text::textLayoutObjectIsNeeded().
    AttachContext reattachContext(context);
    reattachContext.performingReattach = true;

    if (getStyleChangeType() < NeedsReattachStyleChange)
        detach(reattachContext);
    if (layoutObjectIsNeeded)
        LayoutTreeBuilderForText(*this, layoutParent->layoutObject()).createLayoutObject();
    CharacterData::attach(reattachContext);
}
예제 #2
0
void Text::attach(const AttachContext& context)
{
    if (ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this)) {
        if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) {
            if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), *parentLayoutObject))
                LayoutTreeBuilderForText(*this, parentLayoutObject).createLayoutObject();
        }
    }
    CharacterData::attach(context);
}
예제 #3
0
void Text::attach(const AttachContext& context)
{
    if (ContainerNode* renderingParent = NodeRenderingTraversal::parent(*this)) {
        if (LayoutObject* parentRenderer = renderingParent->layoutObject()) {
            if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer))
                LayoutTreeBuilderForText(*this, parentRenderer).createLayoutObject();
        }
    }
    CharacterData::attach(context);
}