void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
    if (name == openAttr) {
        bool oldValue = m_isOpen;
        m_isOpen = !value.isNull();
        if (m_isOpen == oldValue)
            return;

        // Dispatch toggle event asynchronously.
        detailsToggleEventSender().cancelEvent(this);
        detailsToggleEventSender().dispatchEventSoon(this);

        Element* content = ensureUserAgentShadowRoot().getElementById(ShadowElementNames::detailsContent());
        ASSERT(content);
        if (m_isOpen)
            content->removeInlineStyleProperty(CSSPropertyDisplay);
        else
            content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
        Element* summary = ensureUserAgentShadowRoot().getElementById(ShadowElementNames::detailsSummary());
        ASSERT(summary);
        // FIXME: DetailsMarkerControl's RenderDetailsMarker has no concept of being updated
        // without recreating it causing a repaint. Instead we should change it so we can tell
        // it to toggle the open/closed triangle state and avoid reattaching the entire summary.
        summary->lazyReattachIfAttached();
        return;
    }
    HTMLElement::parseAttribute(name, value);
}
Example #2
0
void HTMLPlugInElement::swapRendererTimerFired(Timer<HTMLPlugInElement>*)
{
    ASSERT(displayState() == PreparingPluginReplacement || displayState() == DisplayingSnapshot);
    if (userAgentShadowRoot())
        return;
    
    // Create a shadow root, which will trigger the code to add a snapshot container
    // and reattach, thus making a new Renderer.
    ensureUserAgentShadowRoot();
}