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 16 matching lines...) Expand all Loading... |
27 #include "core/dom/shadow/ShadowRoot.h" | 27 #include "core/dom/shadow/ShadowRoot.h" |
28 #include "core/html/HTMLSummaryElement.h" | 28 #include "core/html/HTMLSummaryElement.h" |
29 #include "core/html/shadow/HTMLContentElement.h" | 29 #include "core/html/shadow/HTMLContentElement.h" |
30 #include "core/rendering/RenderBlockFlow.h" | 30 #include "core/rendering/RenderBlockFlow.h" |
31 #include "platform/text/PlatformLocale.h" | 31 #include "platform/text/PlatformLocale.h" |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
34 | 34 |
35 using namespace HTMLNames; | 35 using namespace HTMLNames; |
36 | 36 |
37 PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& t
agName, Document& document) | 37 PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(Document& document) |
38 { | 38 { |
39 RefPtr<HTMLDetailsElement> details = adoptRef(new HTMLDetailsElement(tagName
, document)); | 39 RefPtr<HTMLDetailsElement> details = adoptRef(new HTMLDetailsElement(documen
t)); |
40 details->ensureUserAgentShadowRoot(); | 40 details->ensureUserAgentShadowRoot(); |
41 return details.release(); | 41 return details.release(); |
42 } | 42 } |
43 | 43 |
44 HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document& d
ocument) | 44 HTMLDetailsElement::HTMLDetailsElement(Document& document) |
45 : HTMLElement(tagName, document) | 45 : HTMLElement(detailsTag, document) |
46 , m_isOpen(false) | 46 , m_isOpen(false) |
47 { | 47 { |
48 ASSERT(hasTagName(detailsTag)); | |
49 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
50 } | 49 } |
51 | 50 |
52 RenderObject* HTMLDetailsElement::createRenderer(RenderStyle*) | 51 RenderObject* HTMLDetailsElement::createRenderer(RenderStyle*) |
53 { | 52 { |
54 return new RenderBlockFlow(this); | 53 return new RenderBlockFlow(this); |
55 } | 54 } |
56 | 55 |
57 void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root) | 56 void HTMLDetailsElement::didAddUserAgentShadowRoot(ShadowRoot& root) |
58 { | 57 { |
59 DEFINE_STATIC_LOCAL(AtomicString, summarySelector, ("summary:first-of-type",
AtomicString::ConstructFromLiteral)); | 58 DEFINE_STATIC_LOCAL(AtomicString, summarySelector, ("summary:first-of-type",
AtomicString::ConstructFromLiteral)); |
60 | 59 |
61 RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summa
ryTag, document()); | 60 RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(docum
ent()); |
62 defaultSummary->appendChild(Text::create(document(), locale().queryString(bl
ink::WebLocalizedString::DetailsLabel))); | 61 defaultSummary->appendChild(Text::create(document(), locale().queryString(bl
ink::WebLocalizedString::DetailsLabel))); |
63 | 62 |
64 RefPtr<HTMLContentElement> content = HTMLContentElement::create(document()); | 63 RefPtr<HTMLContentElement> content = HTMLContentElement::create(document()); |
65 content->setAttribute(selectAttr, summarySelector); | 64 content->setAttribute(selectAttr, summarySelector); |
66 content->appendChild(defaultSummary); | 65 content->appendChild(defaultSummary); |
67 | 66 |
68 root.appendChild(content); | 67 root.appendChild(content); |
69 root.appendChild(HTMLContentElement::create(document())); | 68 root.appendChild(HTMLContentElement::create(document())); |
70 } | 69 } |
71 | 70 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 { | 105 { |
107 setAttribute(openAttr, m_isOpen ? nullAtom : emptyAtom); | 106 setAttribute(openAttr, m_isOpen ? nullAtom : emptyAtom); |
108 } | 107 } |
109 | 108 |
110 bool HTMLDetailsElement::isInteractiveContent() const | 109 bool HTMLDetailsElement::isInteractiveContent() const |
111 { | 110 { |
112 return true; | 111 return true; |
113 } | 112 } |
114 | 113 |
115 } | 114 } |
OLD | NEW |