Title: [206663] trunk
- Revision
- 206663
- Author
- [email protected]
- Date
- 2016-09-30 14:03:27 -0700 (Fri, 30 Sep 2016)
Log Message
Fragment serialization should always use 'xml:' prefix for attributes in XML namespace
https://bugs.webkit.org/show_bug.cgi?id=162803
Reviewed by Sam Weinig.
LayoutTests/imported/w3c:
Rebaseline W3C test now that more checks are passing.
* web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:
Source/WebCore:
Fragment serialization should always use 'xml:' prefix for attributes in XML namespace:
- https://html.spec.whatwg.org/#serialising-html-fragments
"""
If the attribute is in the XML namespace
-> The attribute's serialized name is the string "xml:" followed by the attribute's local name.
"""
- https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm
"""
If ns is the XML namespace, then let qualified name be the concatenation of the string "xml:"
and the value of node's localName.
"""
Firefox complies with the specification.
No new tests, rebaselined existing test.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendAttribute):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206662 => 206663)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-30 20:58:29 UTC (rev 206662)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2016-09-30 21:03:27 UTC (rev 206663)
@@ -1,3 +1,14 @@
+2016-09-30 Chris Dumez <[email protected]>
+
+ Fragment serialization should always use 'xml:' prefix for attributes in XML namespace
+ https://bugs.webkit.org/show_bug.cgi?id=162803
+
+ Reviewed by Sam Weinig.
+
+ Rebaseline W3C test now that more checks are passing.
+
+ * web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:
+
2016-09-30 Youenn Fablet <[email protected]>
FetchBody should use UTF8Encoding to encode text data
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt (206662 => 206663)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt 2016-09-30 20:58:29 UTC (rev 206662)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt 2016-09-30 21:03:27 UTC (rev 206663)
@@ -54,13 +54,13 @@
PASS outerHTML 25 <span><a><b><c></c></b><d>e</d><f><g>h</g></f></a></span>
PASS outerHTML 26 <span b="c"></span>
PASS innerHTML Attribute in the XML namespace
-FAIL innerHTML Attribute in the XML namespace with the prefix not set to xml: assert_equals: expected "<svg xml:foo=\"test\"></svg>" but got "<svg abc:foo=\"test\"></svg>"
+PASS innerHTML Attribute in the XML namespace with the prefix not set to xml:
PASS innerHTML Non-'xmlns' attribute in the xmlns namespace
PASS innerHTML 'xmlns' attribute in the xmlns namespace
FAIL innerHTML Attribute in non-standard namespace assert_equals: expected "<svg abc:def=\"test\"></svg>" but got "<svg def=\"test\"></svg>"
PASS innerHTML <span> starting with U+000A
PASS outerHTML Attribute in the XML namespace
-FAIL outerHTML Attribute in the XML namespace with the prefix not set to xml: assert_equals: expected "<span><svg xml:foo=\"test\"></svg></span>" but got "<span><svg abc:foo=\"test\"></svg></span>"
+PASS outerHTML Attribute in the XML namespace with the prefix not set to xml:
PASS outerHTML Non-'xmlns' attribute in the xmlns namespace
PASS outerHTML 'xmlns' attribute in the xmlns namespace
FAIL outerHTML Attribute in non-standard namespace assert_equals: expected "<span><svg abc:def=\"test\"></svg></span>" but got "<span><svg def=\"test\"></svg></span>"
Modified: trunk/Source/WebCore/ChangeLog (206662 => 206663)
--- trunk/Source/WebCore/ChangeLog 2016-09-30 20:58:29 UTC (rev 206662)
+++ trunk/Source/WebCore/ChangeLog 2016-09-30 21:03:27 UTC (rev 206663)
@@ -1,3 +1,30 @@
+2016-09-30 Chris Dumez <[email protected]>
+
+ Fragment serialization should always use 'xml:' prefix for attributes in XML namespace
+ https://bugs.webkit.org/show_bug.cgi?id=162803
+
+ Reviewed by Sam Weinig.
+
+ Fragment serialization should always use 'xml:' prefix for attributes in XML namespace:
+ - https://html.spec.whatwg.org/#serialising-html-fragments
+ """
+ If the attribute is in the XML namespace
+ -> The attribute's serialized name is the string "xml:" followed by the attribute's local name.
+ """
+
+ - https://www.w3.org/TR/DOM-Parsing/#dfn-concept-xml-serialization-algorithm
+ """
+ If ns is the XML namespace, then let qualified name be the concatenation of the string "xml:"
+ and the value of node's localName.
+ """
+
+ Firefox complies with the specification.
+
+ No new tests, rebaselined existing test.
+
+ * editing/MarkupAccumulator.cpp:
+ (WebCore::MarkupAccumulator::appendAttribute):
+
2016-09-30 Zalan Bujtas <[email protected]>
Unreviewed, rolling out r206611.
Modified: trunk/Source/WebCore/editing/MarkupAccumulator.cpp (206662 => 206663)
--- trunk/Source/WebCore/editing/MarkupAccumulator.cpp 2016-09-30 20:58:29 UTC (rev 206662)
+++ trunk/Source/WebCore/editing/MarkupAccumulator.cpp 2016-09-30 21:03:27 UTC (rev 206663)
@@ -498,15 +498,20 @@
result.append(attribute.name().localName());
else {
if (!attribute.namespaceURI().isEmpty()) {
- AtomicStringImpl* foundNS = namespaces && attribute.prefix().impl() ? namespaces->get(attribute.prefix().impl()) : 0;
- bool prefixIsAlreadyMappedToOtherNS = foundNS && foundNS != attribute.namespaceURI().impl();
- if (attribute.prefix().isEmpty() || !foundNS || prefixIsAlreadyMappedToOtherNS) {
- if (AtomicStringImpl* prefix = namespaces ? namespaces->get(attribute.namespaceURI().impl()) : 0)
- prefixedName.setPrefix(AtomicString(prefix));
- else {
- bool shouldBeDeclaredUsingAppendNamespace = !attribute.prefix().isEmpty() && !foundNS;
- if (!shouldBeDeclaredUsingAppendNamespace && attribute.localName() != xmlnsAtom && namespaces)
- generateUniquePrefix(prefixedName, *namespaces);
+ if (attribute.namespaceURI() == XMLNames::xmlNamespaceURI) {
+ // Always use xml as prefix if the namespace is the XML namespace.
+ prefixedName.setPrefix(xmlAtom);
+ } else {
+ AtomicStringImpl* foundNS = namespaces && attribute.prefix().impl() ? namespaces->get(attribute.prefix().impl()) : 0;
+ bool prefixIsAlreadyMappedToOtherNS = foundNS && foundNS != attribute.namespaceURI().impl();
+ if (attribute.prefix().isEmpty() || !foundNS || prefixIsAlreadyMappedToOtherNS) {
+ if (AtomicStringImpl* prefix = namespaces ? namespaces->get(attribute.namespaceURI().impl()) : 0)
+ prefixedName.setPrefix(AtomicString(prefix));
+ else {
+ bool shouldBeDeclaredUsingAppendNamespace = !attribute.prefix().isEmpty() && !foundNS;
+ if (!shouldBeDeclaredUsingAppendNamespace && attribute.localName() != xmlnsAtom && namespaces)
+ generateUniquePrefix(prefixedName, *namespaces);
+ }
}
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes