| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV
alue) | 261 HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV
alue) |
| 262 { | 262 { |
| 263 if (forAttributeValue.isEmpty()) | 263 if (forAttributeValue.isEmpty()) |
| 264 return 0; | 264 return 0; |
| 265 | 265 |
| 266 if (!m_labelsByForAttribute) { | 266 if (!m_labelsByForAttribute) { |
| 267 // Populate the map on first access. | 267 // Populate the map on first access. |
| 268 m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap); | 268 m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap); |
| 269 for (Element* element = ElementTraversal::firstWithin(rootNode()); eleme
nt; element = ElementTraversal::next(element)) { | 269 for (Element* element = ElementTraversal::firstWithin(rootNode()); eleme
nt; element = ElementTraversal::next(element)) { |
| 270 if (element->hasTagName(labelTag)) { | 270 if (isHTMLLabelElement(element)) { |
| 271 HTMLLabelElement* label = static_cast<HTMLLabelElement*>(element
); | 271 HTMLLabelElement* label = toHTMLLabelElement(element); |
| 272 const AtomicString& forValue = label->fastGetAttribute(forAttr); | 272 const AtomicString& forValue = label->fastGetAttribute(forAttr); |
| 273 if (!forValue.isEmpty()) | 273 if (!forValue.isEmpty()) |
| 274 addLabel(forValue, label); | 274 addLabel(forValue, label); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 | 278 |
| 279 return static_cast<HTMLLabelElement*>(m_labelsByForAttribute->getElementByLa
belForAttribute(forAttributeValue.impl(), this)); | 279 return toHTMLLabelElement(m_labelsByForAttribute->getElementByLabelForAttrib
ute(forAttributeValue.impl(), this)); |
| 280 } | 280 } |
| 281 | 281 |
| 282 DOMSelection* TreeScope::getSelection() const | 282 DOMSelection* TreeScope::getSelection() const |
| 283 { | 283 { |
| 284 if (!rootNode()->document()->frame()) | 284 if (!rootNode()->document()->frame()) |
| 285 return 0; | 285 return 0; |
| 286 | 286 |
| 287 if (m_selection) | 287 if (m_selection) |
| 288 return m_selection.get(); | 288 return m_selection.get(); |
| 289 | 289 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 { | 488 { |
| 489 ASSERT(scope); | 489 ASSERT(scope); |
| 490 for (; scope; scope = scope->parentTreeScope()) { | 490 for (; scope; scope = scope->parentTreeScope()) { |
| 491 if (scope == this) | 491 if (scope == this) |
| 492 return true; | 492 return true; |
| 493 } | 493 } |
| 494 return false; | 494 return false; |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace WebCore | 497 } // namespace WebCore |
| OLD | NEW |