Title: [136984] trunk
- Revision
- 136984
- Author
- [email protected]
- Date
- 2012-12-07 14:13:30 -0800 (Fri, 07 Dec 2012)
Log Message
XMLSerializer is too aggressive in adding prefixes
https://bugs.webkit.org/show_bug.cgi?id=104387
Reviewed by Ryosuke Niwa.
Source/WebCore:
We have been adding "xlink:" and "xmlns:" and "xml:" prefixes to any
attribute that is in one of those namespaces but which did not already
have the matching prefix. This appears to be in error, at least
compared to other browsers.
The correct behavior appears to be to add the prefix only if there is
no existing prefix. If there is an existing prefix, we now leave it alone.
No new tests. Existing test expanded.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendAttribute): Only replace the prefix
attribute name prefix if it is empty, and in one of the recognised
namespaces.
LayoutTests:
Add a test case for a prefix that is already set, but to a different name than the default.
* svg/custom/xlink-prefix-in-attributes.html:
* svg/custom/xlink-prefix-in-attributes-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (136983 => 136984)
--- trunk/LayoutTests/ChangeLog 2012-12-07 22:13:18 UTC (rev 136983)
+++ trunk/LayoutTests/ChangeLog 2012-12-07 22:13:30 UTC (rev 136984)
@@ -1,3 +1,15 @@
+2012-12-07 Stephen Chenney <[email protected]>
+
+ XMLSerializer is too aggressive in adding prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=104387
+
+ Reviewed by Ryosuke Niwa.
+
+ Add a test case for a prefix that is already set, but to a different name than the default.
+
+ * svg/custom/xlink-prefix-in-attributes.html:
+ * svg/custom/xlink-prefix-in-attributes-expected.txt:
+
2012-12-07 Eric Carlson <[email protected]>
Captions menu doesn't update to track changes
Modified: trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes-expected.txt (136983 => 136984)
--- trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes-expected.txt 2012-12-07 22:13:18 UTC (rev 136983)
+++ trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes-expected.txt 2012-12-07 22:13:30 UTC (rev 136984)
@@ -1,2 +1,2 @@
-<div id="target"> <div id="svgoutput"> </div><svg xmlns="http://www.w3.org/2000/svg" svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><image width="20" height="20" xlink:href="" x="0" y="30" width="20" height="20" xlink:href=""
+<div id="target"> <div id="svgoutput"> </div><svg xmlns="http://www.w3.org/2000/svg" svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><image width="20" height="20" xlink:href="" x="0" y="30" width="20" height="20" xlink:href="" <El xmlns:a="http://www.w3.org/1999/xlink" a:title="C" a:href=""
Modified: trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes.html (136983 => 136984)
--- trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes.html 2012-12-07 22:13:18 UTC (rev 136983)
+++ trunk/LayoutTests/svg/custom/xlink-prefix-in-attributes.html 2012-12-07 22:13:30 UTC (rev 136984)
@@ -41,8 +41,12 @@
var serializer = new XMLSerializer();
var xmlString = serializer.serializeToString(target);
+ var xlink_str = '<El a:title="C" a:href="" xmlns:a="http://www.w3.org/1999/xlink" />';
+ var xlink_dom = new DOMParser().parseFromString(xlink_str, 'text/xml');
+ var xlink_output = serializer.serializeToString(xlink_dom);
+
var svgText = document.getElementById("svgoutput");
- svgText.textContent = xmlString;
+ svgText.textContent = xmlString + "\n" + xlink_output;
}
</script>
</head>
Modified: trunk/Source/WebCore/ChangeLog (136983 => 136984)
--- trunk/Source/WebCore/ChangeLog 2012-12-07 22:13:18 UTC (rev 136983)
+++ trunk/Source/WebCore/ChangeLog 2012-12-07 22:13:30 UTC (rev 136984)
@@ -1,3 +1,25 @@
+2012-12-07 Stephen Chenney <[email protected]>
+
+ XMLSerializer is too aggressive in adding prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=104387
+
+ Reviewed by Ryosuke Niwa.
+
+ We have been adding "xlink:" and "xmlns:" and "xml:" prefixes to any
+ attribute that is in one of those namespaces but which did not already
+ have the matching prefix. This appears to be in error, at least
+ compared to other browsers.
+
+ The correct behavior appears to be to add the prefix only if there is
+ no existing prefix. If there is an existing prefix, we now leave it alone.
+
+ No new tests. Existing test expanded.
+
+ * editing/MarkupAccumulator.cpp:
+ (WebCore::MarkupAccumulator::appendAttribute): Only replace the prefix
+ attribute name prefix if it is empty, and in one of the recognised
+ namespaces.
+
2012-12-07 Jon Lee <[email protected]>
Display the auto-start label image after a delay
Modified: trunk/Source/WebCore/editing/MarkupAccumulator.cpp (136983 => 136984)
--- trunk/Source/WebCore/editing/MarkupAccumulator.cpp 2012-12-07 22:13:18 UTC (rev 136983)
+++ trunk/Source/WebCore/editing/MarkupAccumulator.cpp 2012-12-07 22:13:30 UTC (rev 136984)
@@ -455,13 +455,13 @@
else {
QualifiedName prefixedName = attribute.name();
if (attribute.namespaceURI() == XLinkNames::xlinkNamespaceURI) {
- if (attribute.prefix() != xlinkAtom)
+ if (!attribute.prefix())
prefixedName.setPrefix(xlinkAtom);
} else if (attribute.namespaceURI() == XMLNames::xmlNamespaceURI) {
- if (attribute.prefix() != xmlAtom)
+ if (!attribute.prefix())
prefixedName.setPrefix(xmlAtom);
} else if (attribute.namespaceURI() == XMLNSNames::xmlnsNamespaceURI) {
- if (attribute.name() != XMLNSNames::xmlnsAttr && attribute.prefix() != xmlnsAtom)
+ if (attribute.name() != XMLNSNames::xmlnsAttr && !attribute.prefix())
prefixedName.setPrefix(xmlnsAtom);
}
result.append(prefixedName.toString());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes