Title: [134116] trunk/Source/WebCore
Revision
134116
Author
[email protected]
Date
2012-11-09 14:32:49 -0800 (Fri, 09 Nov 2012)

Log Message

HTML Attributes names and values should be created as 8 bit string where possible
https://bugs.webkit.org/show_bug.cgi?id=101781

Reviewed by Filip Pizlo.

Given that almost all attribute names and values are lower case ASCII, we should try to
create 8 bit strings to process them.  Creating an AtomicString already tries to make
an 8 bit string, so that didn't need to change.

No new tests, functionality covered by existing tests.

* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::processTagToken):
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::processMeta):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::PreloadTask::processAttributes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134115 => 134116)


--- trunk/Source/WebCore/ChangeLog	2012-11-09 22:31:11 UTC (rev 134115)
+++ trunk/Source/WebCore/ChangeLog	2012-11-09 22:32:49 UTC (rev 134116)
@@ -1,3 +1,23 @@
+2012-11-09  Michael Saboff  <[email protected]>
+
+        HTML Attributes names and values should be created as 8 bit string where possible
+        https://bugs.webkit.org/show_bug.cgi?id=101781
+
+        Reviewed by Filip Pizlo.
+
+        Given that almost all attribute names and values are lower case ASCII, we should try to
+        create 8 bit strings to process them.  Creating an AtomicString already tries to make
+        an 8 bit string, so that didn't need to change.
+
+        No new tests, functionality covered by existing tests.
+
+        * html/HTMLViewSourceDocument.cpp:
+        (WebCore::HTMLViewSourceDocument::processTagToken):
+        * html/parser/HTMLMetaCharsetParser.cpp:
+        (WebCore::HTMLMetaCharsetParser::processMeta):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::PreloadTask::processAttributes):
+
 2012-11-09  Dana Jansens  <[email protected]>
 
         [chromium] Define WEBKIT_IMPLEMENTATION everywhere inside WebCore

Modified: trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp (134115 => 134116)


--- trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp	2012-11-09 22:31:11 UTC (rev 134115)
+++ trunk/Source/WebCore/html/HTMLViewSourceDocument.cpp	2012-11-09 22:32:49 UTC (rev 134116)
@@ -148,7 +148,7 @@
         }
 
         AtomicString name(iter->m_name.data(), iter->m_name.size());
-        String value(iter->m_value.data(), iter->m_value.size()); 
+        String value = StringImpl::create8BitIfPossible(iter->m_value.data(), iter->m_value.size()); 
 
         index = addRange(source, index, iter->m_nameRange.m_start - token.startIndex(), "");
         index = addRange(source, index, iter->m_nameRange.m_end - token.startIndex(), "webkit-html-attribute-name");

Modified: trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp (134115 => 134116)


--- trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp	2012-11-09 22:31:11 UTC (rev 134115)
+++ trunk/Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp	2012-11-09 22:32:49 UTC (rev 134116)
@@ -105,8 +105,8 @@
     const HTMLToken::AttributeList& tokenAttributes = m_token.attributes();
     AttributeList attributes;
     for (HTMLToken::AttributeList::const_iterator iter = tokenAttributes.begin(); iter != tokenAttributes.end(); ++iter) {
-        String attributeName(iter->m_name.data(), iter->m_name.size());
-        String attributeValue(iter->m_value.data(), iter->m_value.size());
+        String attributeName = StringImpl::create8BitIfPossible(iter->m_name.data(), iter->m_name.size());
+        String attributeValue = StringImpl::create8BitIfPossible(iter->m_value.data(), iter->m_value.size());
         attributes.append(std::make_pair(attributeName, attributeValue));
     }
 

Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (134115 => 134116)


--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2012-11-09 22:31:11 UTC (rev 134115)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2012-11-09 22:32:49 UTC (rev 134116)
@@ -66,7 +66,7 @@
         for (HTMLToken::AttributeList::const_iterator iter = attributes.begin();
              iter != attributes.end(); ++iter) {
             AtomicString attributeName(iter->m_name.data(), iter->m_name.size());
-            String attributeValue(iter->m_value.data(), iter->m_value.size());
+            String attributeValue = StringImpl::create8BitIfPossible(iter->m_value.data(), iter->m_value.size());
 
             if (attributeName == charsetAttr)
                 m_charset = attributeValue;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to