Title: [92786] trunk/Source/WebCore
Revision
92786
Author
[email protected]
Date
2011-08-10 12:45:49 -0700 (Wed, 10 Aug 2011)

Log Message

MarkupAccumulator: make resolution of URLs implicit to appendQuotedURLAttributeValue()
https://bugs.webkit.org/show_bug.cgi?id=65990

Patch by Benjamin Poulain <[email protected]> on 2011-08-10
Reviewed by Ryosuke Niwa.

Instead of resolving the URLs in the call site of appendQuotedURLAttributeValue(),
the URL is now resolved if necessary in appendQuotedURLAttributeValue().

* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendQuotedURLAttributeValue):
(WebCore::MarkupAccumulator::appendAttribute):
* editing/MarkupAccumulator.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92785 => 92786)


--- trunk/Source/WebCore/ChangeLog	2011-08-10 19:42:17 UTC (rev 92785)
+++ trunk/Source/WebCore/ChangeLog	2011-08-10 19:45:49 UTC (rev 92786)
@@ -1,3 +1,18 @@
+2011-08-10  Benjamin Poulain  <[email protected]>
+
+        MarkupAccumulator: make resolution of URLs implicit to appendQuotedURLAttributeValue()
+        https://bugs.webkit.org/show_bug.cgi?id=65990
+
+        Reviewed by Ryosuke Niwa.
+
+        Instead of resolving the URLs in the call site of appendQuotedURLAttributeValue(),
+        the URL is now resolved if necessary in appendQuotedURLAttributeValue().
+
+        * editing/MarkupAccumulator.cpp:
+        (WebCore::MarkupAccumulator::appendQuotedURLAttributeValue):
+        (WebCore::MarkupAccumulator::appendAttribute):
+        * editing/MarkupAccumulator.h:
+
 2011-08-10  Kenichi Ishibashi  <[email protected]>
 
         [Chromium] Implement text shaping with font-feature-settings on Linux

Modified: trunk/Source/WebCore/editing/MarkupAccumulator.cpp (92785 => 92786)


--- trunk/Source/WebCore/editing/MarkupAccumulator.cpp	2011-08-10 19:42:17 UTC (rev 92785)
+++ trunk/Source/WebCore/editing/MarkupAccumulator.cpp	2011-08-10 19:45:49 UTC (rev 92786)
@@ -179,10 +179,12 @@
 {
 }
 
-void MarkupAccumulator::appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString)
+void MarkupAccumulator::appendQuotedURLAttributeValue(Vector<UChar>& result, const Element* element, const Attribute& attribute)
 {
+    ASSERT(element->isURLAttribute(const_cast<Attribute*>(&attribute)));
+    const String resolvedURLString = resolveURLIfNeeded(element, attribute.value());
     UChar quoteChar = '\"';
-    String strippedURLString = urlString.stripWhiteSpace();
+    String strippedURLString = resolvedURLString.stripWhiteSpace();
     if (protocolIsJavaScript(strippedURLString)) {
         // minimal escaping for _javascript_ urls
         if (strippedURLString.contains('"')) {
@@ -199,7 +201,7 @@
 
     // FIXME: This does not fully match other browsers. Firefox percent-escapes non-ASCII characters for innerHTML.
     result.append(quoteChar);
-    appendAttributeValue(result, urlString, false);
+    appendAttributeValue(result, resolvedURLString, false);
     result.append(quoteChar);
 }
 
@@ -389,7 +391,7 @@
     out.append('=');
 
     if (element->isURLAttribute(const_cast<Attribute*>(&attribute)))
-        appendQuotedURLAttributeValue(out, resolveURLIfNeeded(element, attribute.value()));
+        appendQuotedURLAttributeValue(out, element, attribute);
     else {
         out.append('\"');
         appendAttributeValue(out, attribute.value(), documentIsHTML);

Modified: trunk/Source/WebCore/editing/MarkupAccumulator.h (92785 => 92786)


--- trunk/Source/WebCore/editing/MarkupAccumulator.h	2011-08-10 19:42:17 UTC (rev 92785)
+++ trunk/Source/WebCore/editing/MarkupAccumulator.h	2011-08-10 19:45:49 UTC (rev 92786)
@@ -80,7 +80,6 @@
     void concatenateMarkup(Vector<UChar>& out);
     void appendAttributeValue(Vector<UChar>& result, const String& attribute, bool documentIsHTML);
     virtual void appendCustomAttributes(Vector<UChar>&, Element*, Namespaces*);
-    void appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString);
     void appendNodeValue(Vector<UChar>& out, const Node*, const Range*, EntityMask);
     bool shouldAddNamespaceElement(const Element*);
     bool shouldAddNamespaceAttribute(const Attribute&, Namespaces&);
@@ -105,6 +104,7 @@
 
 private:
     String resolveURLIfNeeded(const Element*, const String& urlString) const;
+    void appendQuotedURLAttributeValue(Vector<UChar>& result, const Element*, const Attribute&);
     void serializeNodesWithNamespaces(Node*, Node* nodeToSkip, EChildrenOnly, const Namespaces*);
 
     Vector<String> m_succeedingMarkup;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to