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 reserv
ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // don't want to incur a style update each time. | 237 // don't want to incur a style update each time. |
238 if (bodyElement->vLink() != value) | 238 if (bodyElement->vLink() != value) |
239 bodyElement->setVLink(value); | 239 bodyElement->setVLink(value); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 // -------------------------------------------------------------------------- | 243 // -------------------------------------------------------------------------- |
244 // not part of the DOM | 244 // not part of the DOM |
245 // -------------------------------------------------------------------------- | 245 // -------------------------------------------------------------------------- |
246 | 246 |
247 void HTMLDocument::addItemToMap(HashCountedSet<AtomicStringImpl*>& map, const At
omicString& name) | 247 void HTMLDocument::addItemToMap(HashCountedSet<StringImpl*>& map, const AtomicSt
ring& name) |
248 { | 248 { |
249 if (name.isEmpty()) | 249 if (name.isEmpty()) |
250 return; | 250 return; |
251 map.add(name.impl()); | 251 map.add(name.impl()); |
252 if (Frame* f = frame()) | 252 if (Frame* f = frame()) |
253 f->script()->namedItemAdded(this, name); | 253 f->script()->namedItemAdded(this, name); |
254 } | 254 } |
255 | 255 |
256 void HTMLDocument::removeItemFromMap(HashCountedSet<AtomicStringImpl*>& map, con
st AtomicString& name) | 256 void HTMLDocument::removeItemFromMap(HashCountedSet<StringImpl*>& map, const Ato
micString& name) |
257 { | 257 { |
258 if (name.isEmpty()) | 258 if (name.isEmpty()) |
259 return; | 259 return; |
260 map.remove(name.impl()); | 260 map.remove(name.impl()); |
261 if (Frame* f = frame()) | 261 if (Frame* f = frame()) |
262 f->script()->namedItemRemoved(this, name); | 262 f->script()->namedItemRemoved(this, name); |
263 } | 263 } |
264 | 264 |
265 void HTMLDocument::addNamedItem(const AtomicString& name) | 265 void HTMLDocument::addNamedItem(const AtomicString& name) |
266 { | 266 { |
267 addItemToMap(m_namedItemCounts, name); | 267 addItemToMap(m_namedItemCounts, name); |
268 } | 268 } |
269 | 269 |
270 void HTMLDocument::removeNamedItem(const AtomicString& name) | 270 void HTMLDocument::removeNamedItem(const AtomicString& name) |
271 { | 271 { |
272 removeItemFromMap(m_namedItemCounts, name); | 272 removeItemFromMap(m_namedItemCounts, name); |
273 } | 273 } |
274 | 274 |
275 void HTMLDocument::addExtraNamedItem(const AtomicString& name) | 275 void HTMLDocument::addExtraNamedItem(const AtomicString& name) |
276 { | 276 { |
277 addItemToMap(m_extraNamedItemCounts, name); | 277 addItemToMap(m_extraNamedItemCounts, name); |
278 } | 278 } |
279 | 279 |
280 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) | 280 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) |
281 { | 281 { |
282 removeItemFromMap(m_extraNamedItemCounts, name); | 282 removeItemFromMap(m_extraNamedItemCounts, name); |
283 } | 283 } |
284 | 284 |
285 static void addLocalNameToSet(HashSet<AtomicStringImpl*>* set, const QualifiedNa
me& qName) | 285 static void addLocalNameToSet(HashSet<StringImpl*>* set, const QualifiedName& qN
ame) |
286 { | 286 { |
287 set->add(qName.localName().impl()); | 287 set->add(qName.localName().impl()); |
288 } | 288 } |
289 | 289 |
290 static HashSet<AtomicStringImpl*>* createHtmlCaseInsensitiveAttributesSet() | 290 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet() |
291 { | 291 { |
292 // This is the list of attributes in HTML 4.01 with values marked as "[CI]"
or case-insensitive | 292 // This is the list of attributes in HTML 4.01 with values marked as "[CI]"
or case-insensitive |
293 // Mozilla treats all other values as case-sensitive, thus so do we. | 293 // Mozilla treats all other values as case-sensitive, thus so do we. |
294 HashSet<AtomicStringImpl*>* attrSet = new HashSet<AtomicStringImpl*>; | 294 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>; |
295 | 295 |
296 addLocalNameToSet(attrSet, accept_charsetAttr); | 296 addLocalNameToSet(attrSet, accept_charsetAttr); |
297 addLocalNameToSet(attrSet, acceptAttr); | 297 addLocalNameToSet(attrSet, acceptAttr); |
298 addLocalNameToSet(attrSet, alignAttr); | 298 addLocalNameToSet(attrSet, alignAttr); |
299 addLocalNameToSet(attrSet, alinkAttr); | 299 addLocalNameToSet(attrSet, alinkAttr); |
300 addLocalNameToSet(attrSet, axisAttr); | 300 addLocalNameToSet(attrSet, axisAttr); |
301 addLocalNameToSet(attrSet, bgcolorAttr); | 301 addLocalNameToSet(attrSet, bgcolorAttr); |
302 addLocalNameToSet(attrSet, charsetAttr); | 302 addLocalNameToSet(attrSet, charsetAttr); |
303 addLocalNameToSet(attrSet, checkedAttr); | 303 addLocalNameToSet(attrSet, checkedAttr); |
304 addLocalNameToSet(attrSet, clearAttr); | 304 addLocalNameToSet(attrSet, clearAttr); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 addLocalNameToSet(attrSet, typeAttr); | 337 addLocalNameToSet(attrSet, typeAttr); |
338 addLocalNameToSet(attrSet, valignAttr); | 338 addLocalNameToSet(attrSet, valignAttr); |
339 addLocalNameToSet(attrSet, valuetypeAttr); | 339 addLocalNameToSet(attrSet, valuetypeAttr); |
340 addLocalNameToSet(attrSet, vlinkAttr); | 340 addLocalNameToSet(attrSet, vlinkAttr); |
341 | 341 |
342 return attrSet; | 342 return attrSet; |
343 } | 343 } |
344 | 344 |
345 bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName) | 345 bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName) |
346 { | 346 { |
347 static HashSet<AtomicStringImpl*>* htmlCaseInsensitiveAttributesSet = create
HtmlCaseInsensitiveAttributesSet(); | 347 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCa
seInsensitiveAttributesSet(); |
348 bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.names
paceURI() == nullAtom); | 348 bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.names
paceURI() == nullAtom); |
349 return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(at
tributeName.localName().impl()); | 349 return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(at
tributeName.localName().impl()); |
350 } | 350 } |
351 | 351 |
352 void HTMLDocument::clear() | 352 void HTMLDocument::clear() |
353 { | 353 { |
354 // FIXME: This does nothing, and that seems unlikely to be correct. | 354 // FIXME: This does nothing, and that seems unlikely to be correct. |
355 // We've long had a comment saying that IE doesn't support this. | 355 // We've long had a comment saying that IE doesn't support this. |
356 // But I do see it in the documentation for Mozilla. | 356 // But I do see it in the documentation for Mozilla. |
357 } | 357 } |
358 | 358 |
359 } | 359 } |
OLD | NEW |