Exemplo n.º 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);
}
Exemplo n.º 2
0
void Text::reattachIfNeeded(const AttachContext& context)
{
    bool rendererIsNeeded = false;
    ContainerNode* renderingParent = NodeRenderingTraversal::parent(*this);
    if (renderingParent) {
        if (RenderObject* parentRenderer = renderingParent->renderer()) {
            if (textRendererIsNeeded(*parentRenderer->style(), *parentRenderer))
                rendererIsNeeded = true;
        }
    }

    if (rendererIsNeeded == !!renderer())
        return;

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

    if (styleChangeType() < NeedsReattachStyleChange)
        detach(reattachContext);
    if (rendererIsNeeded)
        RenderTreeBuilderForText(*this, renderingParent->renderer()).createRenderer();
    CharacterData::attach(reattachContext);
}
Exemplo n.º 3
0
void reattachRenderTree(Element* current, const AttachContext& context)
{
    AttachContext reattachContext(context);
    reattachContext.performingReattach = true;

    if (current->attached())
        detachRenderTree(current, reattachContext);

    attachRenderTree(current, reattachContext);
}