Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: Source/core/dom/TreeScope.cpp

Issue 18259016: Introduce isHTMLLabelElement and toHTMLLabelElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Took tkent's comment into consideration Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLLabelElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScope.cpp
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 4112bab5ee1987a5020da806983933e9a45dfa37..7d506d44655e391e95802bfc3d1e643add31dbf7 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -267,8 +267,8 @@ HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV
// Populate the map on first access.
m_labelsByForAttribute = adoptPtr(new DocumentOrderedMap);
for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) {
- if (element->hasTagName(labelTag)) {
- HTMLLabelElement* label = static_cast<HTMLLabelElement*>(element);
+ if (isHTMLLabelElement(element)) {
+ HTMLLabelElement* label = toHTMLLabelElement(element);
const AtomicString& forValue = label->fastGetAttribute(forAttr);
if (!forValue.isEmpty())
addLabel(forValue, label);
@@ -276,7 +276,7 @@ HTMLLabelElement* TreeScope::labelElementForId(const AtomicString& forAttributeV
}
}
- return static_cast<HTMLLabelElement*>(m_labelsByForAttribute->getElementByLabelForAttribute(forAttributeValue.impl(), this));
+ return toHTMLLabelElement(m_labelsByForAttribute->getElementByLabelForAttribute(forAttributeValue.impl(), this));
}
DOMSelection* TreeScope::getSelection() const
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/html/HTMLLabelElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698