| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies) |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 { | 90 { |
| 91 UseCounter::count(document, UseCounter::DetailsElement); | 91 UseCounter::count(document, UseCounter::DetailsElement); |
| 92 } | 92 } |
| 93 | 93 |
| 94 HTMLDetailsElement::~HTMLDetailsElement() | 94 HTMLDetailsElement::~HTMLDetailsElement() |
| 95 { | 95 { |
| 96 } | 96 } |
| 97 | 97 |
| 98 void HTMLDetailsElement::dispatchPendingEvent(DetailsEventSender* eventSender) | 98 void HTMLDetailsElement::dispatchPendingEvent(DetailsEventSender* eventSender) |
| 99 { | 99 { |
| 100 ASSERT_UNUSED(eventSender, eventSender == &detailsToggleEventSender()); | 100 DCHECK_EQ(eventSender, &detailsToggleEventSender()); |
| 101 dispatchEvent(Event::create(EventTypeNames::toggle)); | 101 dispatchEvent(Event::create(EventTypeNames::toggle)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 LayoutObject* HTMLDetailsElement::createLayoutObject(const ComputedStyle&) | 105 LayoutObject* HTMLDetailsElement::createLayoutObject(const ComputedStyle&) |
| 106 { | 106 { |
| 107 return new LayoutBlockFlow(this); | 107 return new LayoutBlockFlow(this); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 110 void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 123 content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 123 content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 124 root.appendChild(content); | 124 root.appendChild(content); |
| 125 } | 125 } |
| 126 | 126 |
| 127 Element* HTMLDetailsElement::findMainSummary() const | 127 Element* HTMLDetailsElement::findMainSummary() const |
| 128 { | 128 { |
| 129 if (HTMLSummaryElement* summary = Traversal<HTMLSummaryElement>::firstChild(
*this)) | 129 if (HTMLSummaryElement* summary = Traversal<HTMLSummaryElement>::firstChild(
*this)) |
| 130 return summary; | 130 return summary; |
| 131 | 131 |
| 132 HTMLContentElement* content = toHTMLContentElement(userAgentShadowRoot()->fi
rstChild()); | 132 HTMLContentElement* content = toHTMLContentElement(userAgentShadowRoot()->fi
rstChild()); |
| 133 ASSERT(content->firstChild() && isHTMLSummaryElement(*content->firstChild())
); | 133 DCHECK(content->firstChild()); |
| 134 DCHECK(isHTMLSummaryElement(*content->firstChild())); |
| 134 return toElement(content->firstChild()); | 135 return toElement(content->firstChild()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& oldValue, const AtomicString& value) | 138 void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicS
tring& oldValue, const AtomicString& value) |
| 138 { | 139 { |
| 139 if (name == openAttr) { | 140 if (name == openAttr) { |
| 140 bool oldValue = m_isOpen; | 141 bool oldValue = m_isOpen; |
| 141 m_isOpen = !value.isNull(); | 142 m_isOpen = !value.isNull(); |
| 142 if (m_isOpen == oldValue) | 143 if (m_isOpen == oldValue) |
| 143 return; | 144 return; |
| 144 | 145 |
| 145 // Dispatch toggle event asynchronously. | 146 // Dispatch toggle event asynchronously. |
| 146 detailsToggleEventSender().cancelEvent(this); | 147 detailsToggleEventSender().cancelEvent(this); |
| 147 detailsToggleEventSender().dispatchEventSoon(this); | 148 detailsToggleEventSender().dispatchEventSoon(this); |
| 148 | 149 |
| 149 Element* content = ensureUserAgentShadowRoot().getElementById(ShadowElem
entNames::detailsContent()); | 150 Element* content = ensureUserAgentShadowRoot().getElementById(ShadowElem
entNames::detailsContent()); |
| 150 ASSERT(content); | 151 DCHECK(content); |
| 151 if (m_isOpen) | 152 if (m_isOpen) |
| 152 content->removeInlineStyleProperty(CSSPropertyDisplay); | 153 content->removeInlineStyleProperty(CSSPropertyDisplay); |
| 153 else | 154 else |
| 154 content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 155 content->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 155 | 156 |
| 156 // Invalidate the LayoutDetailsMarker in order to turn the arrow signify
ing if the | 157 // Invalidate the LayoutDetailsMarker in order to turn the arrow signify
ing if the |
| 157 // details element is open or closed. | 158 // details element is open or closed. |
| 158 Element* summary = findMainSummary(); | 159 Element* summary = findMainSummary(); |
| 159 ASSERT(summary); | 160 DCHECK(summary); |
| 160 | 161 |
| 161 Element* control = toHTMLSummaryElement(summary)->markerControl(); | 162 Element* control = toHTMLSummaryElement(summary)->markerControl(); |
| 162 if (control && control->layoutObject()) | 163 if (control && control->layoutObject()) |
| 163 control->layoutObject()->setShouldDoFullPaintInvalidation(); | 164 control->layoutObject()->setShouldDoFullPaintInvalidation(); |
| 164 | 165 |
| 165 return; | 166 return; |
| 166 } | 167 } |
| 167 HTMLElement::parseAttribute(name, oldValue, value); | 168 HTMLElement::parseAttribute(name, oldValue, value); |
| 168 } | 169 } |
| 169 | 170 |
| 170 void HTMLDetailsElement::toggleOpen() | 171 void HTMLDetailsElement::toggleOpen() |
| 171 { | 172 { |
| 172 setAttribute(openAttr, m_isOpen ? nullAtom : emptyAtom); | 173 setAttribute(openAttr, m_isOpen ? nullAtom : emptyAtom); |
| 173 } | 174 } |
| 174 | 175 |
| 175 bool HTMLDetailsElement::isInteractiveContent() const | 176 bool HTMLDetailsElement::isInteractiveContent() const |
| 176 { | 177 { |
| 177 return true; | 178 return true; |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace blink | 181 } // namespace blink |
| OLD | NEW |