void Element::attach()
{
    createRendererIfNeeded();
    ContainerNode::attach();
    if (hasRareData()) {   
        ElementRareData* data = rareData();
        if (data->needsFocusAppearanceUpdateSoonAfterAttach()) {
            if (isFocusable() && document()->focusedNode() == this)
                document()->updateFocusAppearanceSoon();
            data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false);
        }
    }
}
Пример #2
0
void attachRenderTree(Element* current, const AttachContext& context)
{
    PostAttachCallbackDisabler callbackDisabler(current);
    WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;

    if (current->hasCustomStyleResolveCallbacks())
        current->willAttachRenderers();

    createRendererIfNeeded(current, context);

    if (current->parentElement() && current->parentElement()->isInCanvasSubtree())
        current->setIsInCanvasSubtree(true);

    current->updateBeforePseudoElement(NoChange);

    StyleResolverParentPusher parentPusher(current);

    // When a shadow root exists, it does the work of attaching the children.
    if (ShadowRoot* shadowRoot = current->shadowRoot()) {
        parentPusher.push();
        attachShadowRoot(shadowRoot, context);
    } else if (current->firstChild())
        parentPusher.push();

    attachChildren(current, context);

    Node* sibling = current->nextSibling();
    if (current->renderer() && sibling && !sibling->renderer() && sibling->attached())
        Text::createTextRenderersForSiblingsAfterAttachIfNeeded(sibling);

    current->setAttached(true);
    current->clearNeedsStyleRecalc();

    if (Document* document = current->document()) {
        if (AXObjectCache* cache = document->axObjectCache())
            cache->updateCacheAfterNodeIsAttached(current);
    }

    current->updateAfterPseudoElement(NoChange);

    current->updateFocusAppearanceAfterAttachIfNeeded();
    
    if (current->hasCustomStyleResolveCallbacks())
        current->didAttachRenderers();
}
Пример #3
0
void Text::attach()
{
#if ENABLE(WML)
    if (document()->isWMLDocument() && !containsOnlyWhitespace()) {
        String text = data();
        ASSERT(!text.isEmpty());

        text = substituteVariableReferences(text, document());

        ExceptionCode code = 0;
        setData(text, code);
        ASSERT(!code);
    }
#endif

    createRendererIfNeeded();
    CharacterData::attach();
}
Пример #4
0
void Text::attach()
{
    createRendererIfNeeded();
    CharacterData::attach();
}