HTMLElement: Clean up tabindex attribute parsing.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 20:57:08 +0000 (20:57 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Feb 2012 20:57:08 +0000 (20:57 +0000)
<http://webkit.org/b/77763>

Reviewed by Antti Koivisto.

Remove an unnecessary getAttribute() call when parsing tabindexAttr.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseMappedAttribute):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106685 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLElement.cpp

index 2c4a6fa..7696406 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-03  Andreas Kling  <awesomekling@apple.com>
+
+        HTMLElement: Clean up tabindex attribute parsing.
+        <http://webkit.org/b/77763>
+
+        Reviewed by Antti Koivisto.
+
+        Remove an unnecessary getAttribute() call when parsing tabindexAttr.
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::parseMappedAttribute):
+
 2012-02-03  Anders Carlsson  <andersca@apple.com>
 
         ScrollingTreeState should keep track of the scroll layer
index 680c23b..8ecbc46 100644 (file)
@@ -189,7 +189,6 @@ void HTMLElement::parseMappedAttribute(Attribute* attr)
     if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
         return StyledElement::parseMappedAttribute(attr);
 
-    String indexstring;
     if (attr->name() == alignAttr) {
         if (equalIgnoringCase(attr->value(), "middle"))
             addCSSProperty(attr, CSSPropertyTextAlign, "center");
@@ -200,11 +199,10 @@ void HTMLElement::parseMappedAttribute(Attribute* attr)
     } else if (attr->name() == hiddenAttr) {
         addCSSProperty(attr, CSSPropertyDisplay, CSSValueNone);
     } else if (attr->name() == tabindexAttr) {
-        indexstring = getAttribute(tabindexAttr);
         int tabindex = 0;
-        if (!indexstring.length()) {
+        if (attr->isEmpty())
             clearTabIndexExplicitly();
-        } else if (parseHTMLInteger(indexstring, tabindex)) {
+        else if (parseHTMLInteger(attr->value(), tabindex)) {
             // Clamp tabindex to the range of 'short' to match Firefox's behavior.
             setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
         }