コード例 #1
0
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 = ensureClosedShadowRoot().getElementById(ShadowElementNames::detailsContent());
        ASSERT(content);
        if (m_isOpen)
            content->removeInlineStyleProperty(CSSPropertyDisplay);
        else
            content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);

        // Invalidate the LayoutDetailsMarker in order to turn the arrow signifying if the
        // details element is open or closed.
        Element* summary = findMainSummary();
        ASSERT(summary);

        Element* control = toHTMLSummaryElement(summary)->markerControl();
        if (control && control->layoutObject())
            control->layoutObject()->setShouldDoFullPaintInvalidation();

        return;
    }
    HTMLElement::parseAttribute(name, value);
}
コード例 #2
0
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);
}
コード例 #3
0
void HTMLDetailsElement::dispatchPendingEvent(DetailsEventSender* eventSender)
{
    ASSERT_UNUSED(eventSender, eventSender == &detailsToggleEventSender());
    dispatchEvent(Event::create(EventTypeNames::toggle));
}
コード例 #4
0
HTMLDetailsElement::~HTMLDetailsElement()
{
    detailsToggleEventSender().cancelEvent(this);
}