[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 12:18:23 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2ad3f4af970a5aa9f2ee6c62e5ba619156ebff45
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 18 20:05:10 2010 +0000

    2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
    
            Reviewed by Darin Adler.
    
            CSS: Make rgb() and rgba() fast paths case-insensitive
            https://bugs.webkit.org/show_bug.cgi?id=44107
    
            Also inlined the string comparisons against "rgb(" and "rgba("
            which is faster and avoids creating a temporary String object.
    
            * css/CSSParser.cpp:
            (WebCore::mightBeRGBA):
            (WebCore::mightBeRGB):
            (WebCore::CSSParser::parseColor):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65626 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b990ac6..df00585 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-18  Andreas Kling  <andreas.kling at nokia.com>
+
+        Reviewed by Darin Adler.
+
+        CSS: Make rgb() and rgba() fast paths case-insensitive
+        https://bugs.webkit.org/show_bug.cgi?id=44107
+
+        Also inlined the string comparisons against "rgb(" and "rgba("
+        which is faster and avoids creating a temporary String object.
+
+        * css/CSSParser.cpp:
+        (WebCore::mightBeRGBA):
+        (WebCore::mightBeRGB):
+        (WebCore::CSSParser::parseColor):
+
 2010-08-18  Jian Li  <jianli at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index e5126a9..a059ffc 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -3796,6 +3796,27 @@ static inline bool parseAlphaValue(const UChar*& string, const UChar* end, UChar
     return *foundTerminator == terminator;
 }
 
+static inline bool mightBeRGBA(const UChar* characters, unsigned length)
+{
+    if (length < 5)
+        return false;
+    return characters[4] == '('
+        && (characters[0] | 0x20) == 'r'
+        && (characters[1] | 0x20) == 'g'
+        && (characters[2] | 0x20) == 'b'
+        && (characters[3] | 0x20) == 'a';
+}
+
+static inline bool mightBeRGB(const UChar* characters, unsigned length)
+{
+    if (length < 4)
+        return false;
+    return characters[3] == '('
+        && (characters[0] | 0x20) == 'r'
+        && (characters[1] | 0x20) == 'g'
+        && (characters[2] | 0x20) == 'b';
+}
+
 bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict)
 {
     const UChar* characters = name.characters();
@@ -3812,7 +3833,7 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict)
     }
 
     // Try rgba() syntax.
-    if (name.startsWith("rgba(")) {
+    if (mightBeRGBA(characters, length)) {
         const UChar* current = characters + 5;
         const UChar* end = characters + length;
         int red;
@@ -3834,7 +3855,7 @@ bool CSSParser::parseColor(const String &name, RGBA32& rgb, bool strict)
     }
 
     // Try rgb() syntax.
-    if (name.startsWith("rgb(")) {
+    if (mightBeRGB(characters, length)) {
         const UChar* current = characters + 4;
         const UChar* end = characters + length;
         int red;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list