Title: [103199] trunk/Source/WebCore
Revision
103199
Author
[email protected]
Date
2011-12-18 17:40:15 -0800 (Sun, 18 Dec 2011)

Log Message

KURL::protocolIs() should handle 8-bit strings.
<http://webkit.org/b/74827>

Reviewed by Antti Koivisto.

* platform/KURL.cpp:
(WebCore::isLetterMatchIgnoringCase):

    Turned this into a template method so it can be used for both UChar and LChar.

(WebCore::charactersAreProtocol):
(WebCore::protocolIs):

    Handle 8/16 bit strings separately to avoid conversion.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103198 => 103199)


--- trunk/Source/WebCore/ChangeLog	2011-12-19 01:27:42 UTC (rev 103198)
+++ trunk/Source/WebCore/ChangeLog	2011-12-19 01:40:15 UTC (rev 103199)
@@ -1,3 +1,20 @@
+2011-12-18  Andreas Kling  <[email protected]>
+
+        KURL::protocolIs() should handle 8-bit strings.
+        <http://webkit.org/b/74827>
+
+        Reviewed by Antti Koivisto.
+
+        * platform/KURL.cpp:
+        (WebCore::isLetterMatchIgnoringCase):
+
+            Turned this into a template method so it can be used for both UChar and LChar.
+
+        (WebCore::charactersAreProtocol):
+        (WebCore::protocolIs):
+
+            Handle 8/16 bit strings separately to avoid conversion.
+
 2011-12-18  Alice Boxhall  <[email protected]>
 
         Make AccessibilityObject::lineForPosition return the correct value for cases where the position is not within the current object.

Modified: trunk/Source/WebCore/platform/KURL.cpp (103198 => 103199)


--- trunk/Source/WebCore/platform/KURL.cpp	2011-12-19 01:27:42 UTC (rev 103198)
+++ trunk/Source/WebCore/platform/KURL.cpp	2011-12-19 01:40:15 UTC (rev 103199)
@@ -60,7 +60,8 @@
 static const unsigned maximumValidPortNumber = 0xFFFE;
 static const unsigned invalidPortNumber = 0xFFFF;
 
-static inline bool isLetterMatchIgnoringCase(UChar character, char lowercaseLetter)
+template<typename CharType>
+static inline bool isLetterMatchIgnoringCase(CharType character, char lowercaseLetter)
 {
     ASSERT(isASCIILower(lowercaseLetter));
     return (character | 0x20) == lowercaseLetter;
@@ -68,12 +69,6 @@
 
 #if !USE(GOOGLEURL)
 
-static inline bool isLetterMatchIgnoringCase(char character, char lowercaseLetter)
-{
-    ASSERT(isASCIILower(lowercaseLetter));
-    return (character | 0x20) == lowercaseLetter;
-}
-
 enum URLCharacterClasses {
     // alpha 
     SchemeFirstChar = 1 << 0,
@@ -1719,10 +1714,9 @@
     copyASCII(m_string, buffer.data());
 }
 
-bool protocolIs(const String& url, const char* protocol)
+template<typename CharType>
+bool charactersAreProtocol(const CharType* url, const char* protocol)
 {
-    // Do the comparison without making a new string object.
-    assertProtocolIsGood(protocol);
     for (int i = 0; ; ++i) {
         if (!protocol[i])
             return url[i] == ':';
@@ -1731,6 +1725,16 @@
     }
 }
 
+bool protocolIs(const String& url, const char* protocol)
+{
+    assertProtocolIsGood(protocol);
+
+    // Do the comparison without making a new string object.
+    if (url.is8Bit())
+        return charactersAreProtocol(url.characters8(), protocol);
+    return charactersAreProtocol(url.characters16(), protocol);
+}
+
 bool isValidProtocol(const String& protocol)
 {
     // RFC3986: ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (103198 => 103199)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-12-19 01:27:42 UTC (rev 103198)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2011-12-19 01:40:15 UTC (rev 103199)
@@ -127,6 +127,7 @@
 
 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
 {
+    printf("scrollToOffsetWithoutAnimation: %g, %g\n", offset.x(), offset.y());
     scrollAnimator()->scrollToOffsetWithoutAnimation(offset);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to