OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * version of this file under the LGPL, indicate your decision by | 47 * version of this file under the LGPL, indicate your decision by |
48 * deleting the provisions above and replace them with the notice and | 48 * deleting the provisions above and replace them with the notice and |
49 * other provisions required by the MPL or the GPL, as the case may be. | 49 * other provisions required by the MPL or the GPL, as the case may be. |
50 * If you do not delete the provisions above, a recipient may use your | 50 * If you do not delete the provisions above, a recipient may use your |
51 * version of this file under any of the LGPL, the MPL or the GPL. | 51 * version of this file under any of the LGPL, the MPL or the GPL. |
52 */ | 52 */ |
53 | 53 |
54 #include "core/html/HTMLDocument.h" | 54 #include "core/html/HTMLDocument.h" |
55 | 55 |
56 #include "bindings/core/v8/ScriptController.h" | 56 #include "bindings/core/v8/ScriptController.h" |
| 57 #include "bindings/core/v8/WindowProxy.h" |
57 #include "core/HTMLNames.h" | 58 #include "core/HTMLNames.h" |
58 #include "core/frame/LocalFrame.h" | 59 #include "core/frame/LocalFrame.h" |
59 #include "core/html/HTMLBodyElement.h" | 60 #include "core/html/HTMLBodyElement.h" |
60 | 61 |
61 namespace blink { | 62 namespace blink { |
62 | 63 |
63 using namespace HTMLNames; | 64 using namespace HTMLNames; |
64 | 65 |
65 HTMLDocument::HTMLDocument(const DocumentInit& initializer, | 66 HTMLDocument::HTMLDocument(const DocumentInit& initializer, |
66 DocumentClassFlags extendedDocumentClasses) | 67 DocumentClassFlags extendedDocumentClasses) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 146 |
146 // -------------------------------------------------------------------------- | 147 // -------------------------------------------------------------------------- |
147 // not part of the DOM | 148 // not part of the DOM |
148 // -------------------------------------------------------------------------- | 149 // -------------------------------------------------------------------------- |
149 | 150 |
150 void HTMLDocument::addItemToMap(HashCountedSet<AtomicString>& map, | 151 void HTMLDocument::addItemToMap(HashCountedSet<AtomicString>& map, |
151 const AtomicString& name) { | 152 const AtomicString& name) { |
152 if (name.isEmpty()) | 153 if (name.isEmpty()) |
153 return; | 154 return; |
154 map.add(name); | 155 map.add(name); |
155 if (LocalFrame* f = frame()) | 156 if (LocalFrame* f = frame()) { |
156 f->script().namedItemAdded(this, name); | 157 f->script() |
| 158 .windowProxy(DOMWrapperWorld::mainWorld()) |
| 159 ->namedItemAdded(this, name); |
| 160 } |
157 } | 161 } |
158 | 162 |
159 void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map, | 163 void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicString>& map, |
160 const AtomicString& name) { | 164 const AtomicString& name) { |
161 if (name.isEmpty()) | 165 if (name.isEmpty()) |
162 return; | 166 return; |
163 map.remove(name); | 167 map.remove(name); |
164 if (LocalFrame* f = frame()) | 168 if (LocalFrame* f = frame()) { |
165 f->script().namedItemRemoved(this, name); | 169 f->script() |
| 170 .windowProxy(DOMWrapperWorld::mainWorld()) |
| 171 ->namedItemRemoved(this, name); |
| 172 } |
166 } | 173 } |
167 | 174 |
168 void HTMLDocument::addNamedItem(const AtomicString& name) { | 175 void HTMLDocument::addNamedItem(const AtomicString& name) { |
169 addItemToMap(m_namedItemCounts, name); | 176 addItemToMap(m_namedItemCounts, name); |
170 } | 177 } |
171 | 178 |
172 void HTMLDocument::removeNamedItem(const AtomicString& name) { | 179 void HTMLDocument::removeNamedItem(const AtomicString& name) { |
173 removeItemFromMap(m_namedItemCounts, name); | 180 removeItemFromMap(m_namedItemCounts, name); |
174 } | 181 } |
175 | 182 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = | 220 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = |
214 createHtmlCaseInsensitiveAttributesSet(); | 221 createHtmlCaseInsensitiveAttributesSet(); |
215 bool isPossibleHTMLAttr = | 222 bool isPossibleHTMLAttr = |
216 !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom); | 223 !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom); |
217 return !isPossibleHTMLAttr || | 224 return !isPossibleHTMLAttr || |
218 !htmlCaseInsensitiveAttributesSet->contains( | 225 !htmlCaseInsensitiveAttributesSet->contains( |
219 attributeName.localName().impl()); | 226 attributeName.localName().impl()); |
220 } | 227 } |
221 | 228 |
222 } // namespace blink | 229 } // namespace blink |
OLD | NEW |