CSSMutableStyleDeclaration: Unnecessary double hash lookup in construction.
authorkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 20:04:25 +0000 (20:04 +0000)
committerkling@webkit.org <kling@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Dec 2011 20:04:25 +0000 (20:04 +0000)
<http://webkit.org/b/73564>

Reviewed by Antti Koivisto.

Use HashMap::find() instead of contains() followed by get() on
successful lookup.

* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):

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

Source/WebCore/ChangeLog
Source/WebCore/css/CSSMutableStyleDeclaration.cpp

index a867074cce781f71204ec797cfb86c6172ca72c4..ad5b3037d49771150851f4b458d11f68f2bb6b1c 100644 (file)
@@ -1,3 +1,16 @@
+2011-12-01  Andreas Kling  <kling@webkit.org>
+
+        CSSMutableStyleDeclaration: Unnecessary double hash lookup in construction.
+        <http://webkit.org/b/73564>
+
+        Reviewed by Antti Koivisto.
+
+        Use HashMap::find() instead of contains() followed by get() on
+        successful lookup.
+
+        * css/CSSMutableStyleDeclaration.cpp:
+        (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
+
 2011-11-30  Benjamin Poulain  <benjamin@webkit.org>
 
         URLs are encoded in UTF-8, then decoded as if they are Latin1
 2011-11-30  Benjamin Poulain  <benjamin@webkit.org>
 
         URLs are encoded in UTF-8, then decoded as if they are Latin1
index 46509a0934be51a8b6d69947f3d57610fc72bed3..9feb97415ceff70284a91b15e7de62e4b8fab4fd 100644 (file)
@@ -137,11 +137,14 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS
         const CSSProperty *property = properties[i];
         ASSERT(property);
         bool important = property->isImportant();
         const CSSProperty *property = properties[i];
         ASSERT(property);
         bool important = property->isImportant();
-        if (candidates.contains(property->id())) {
-            if (!important && candidates.get(property->id()))
+
+        HashMap<int, bool>::iterator it = candidates.find(property->id());
+        if (it != candidates.end()) {
+            if (!important && it->second)
                 continue;
             removeProperty(property->id(), false, false);
         }
                 continue;
             removeProperty(property->id(), false, false);
         }
+
         m_properties.append(*property);
         candidates.set(property->id(), important);
     }
         m_properties.append(*property);
         candidates.set(property->id(), important);
     }