Title: [206240] trunk
Revision
206240
Author
cdu...@apple.com
Date
2016-09-21 15:52:42 -0700 (Wed, 21 Sep 2016)

Log Message

Fix serialization of HTML Element attributes
https://bugs.webkit.org/show_bug.cgi?id=162356

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

* web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt:
* web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:

Source/WebCore:

Fix serialization of HTML Element attributes to align with:
- https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm
- https://html.spec.whatwg.org/#escapingString

In particular, we should not escape '<' and '>'.

Firefox and Chrome both match the specification.

Note that we keep escaping '<' and '>' for Element attributes in the
context of XML serialization, as per:
- https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value

No new tests, rebaselined existing test.

* editing/MarkupAccumulator.h:

LayoutTests:

Rebaseline test to reflect behavior change.

* editing/pasteboard/paste-noscript-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206239 => 206240)


--- trunk/LayoutTests/ChangeLog	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/LayoutTests/ChangeLog	2016-09-21 22:52:42 UTC (rev 206240)
@@ -1,3 +1,14 @@
+2016-09-21  Chris Dumez  <cdu...@apple.com>
+
+        Fix serialization of HTML Element attributes
+        https://bugs.webkit.org/show_bug.cgi?id=162356
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline test to reflect behavior change.
+
+        * editing/pasteboard/paste-noscript-expected.txt:
+
 2016-09-21  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: Improve output of TestHarness.expect* failures

Modified: trunk/LayoutTests/editing/pasteboard/paste-noscript-expected.txt (206239 => 206240)


--- trunk/LayoutTests/editing/pasteboard/paste-noscript-expected.txt	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/LayoutTests/editing/pasteboard/paste-noscript-expected.txt	2016-09-21 22:52:42 UTC (rev 206240)
@@ -15,7 +15,7 @@
 <a id="anchor2">Hello</a>
 <iframe id="iframe1" src="" x = 1;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
 <iframe id="iframe1" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
-<iframe id="iframe2" srcdoc="&lt;script&gt;var x = 1;&lt;/script&gt;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
+<iframe id="iframe2" srcdoc="<script>var x = 1;</script>" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
 <iframe id="iframe2" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
 <form id="form1" action="" formaction="_javascript_:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="" formaction="_javascript_:sayHello()">Submit.</button></form>
 <form id="form1" formaction="_javascript_:sayHello()" style="width: 200px; height: 150px; background-color: rgb(204, 238, 238);">This is a form<br><img src=""

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206239 => 206240)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-09-21 22:52:42 UTC (rev 206240)
@@ -1,5 +1,17 @@
 2016-09-21  Chris Dumez  <cdu...@apple.com>
 
+        Fix serialization of HTML Element attributes
+        https://bugs.webkit.org/show_bug.cgi?id=162356
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt:
+        * web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:
+
+2016-09-21  Chris Dumez  <cdu...@apple.com>
+
         Fix enumeration of properties cross origin
         https://bugs.webkit.org/show_bug.cgi?id=162328
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt (206239 => 206240)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt	2016-09-21 22:52:42 UTC (rev 206240)
@@ -10,7 +10,7 @@
 FAIL <img srcset="/images/green-256x256.png 256w" sizes="512px" data-expect="512"> assert_equals: naturalWidth expected 512 but got 256
 FAIL <img srcset="/images/green-256x256.png 256w" sizes="1px" data-expect="1"> assert_equals: naturalWidth expected 1 but got 256
 FAIL <img srcset="/images/green-256x256.png 256w" sizes="0px" data-expect="0"> assert_equals: naturalWidth expected 0 but got 256
-PASS <img srcset="data:image/svg+xml,&lt;svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20width='20'%20height='20'&gt;&lt;circle%20r='1'/&gt;&lt;/svg&gt; 2x" data-expect="10"> 
-PASS <img srcset="data:image/svg+xml,&lt;svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20width='20'&gt;&lt;circle%20r='1'/&gt;&lt;/svg&gt; 2x" data-expect="10"> 
-PASS <img srcset="data:image/svg+xml,&lt;svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20height='20'&gt;&lt;circle%20r='1'/&gt;&lt;/svg&gt; 2x" data-expect="10"> 
+PASS <img srcset="data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20width='20'%20height='20'><circle%20r='1'/></svg> 2x" data-expect="10"> 
+PASS <img srcset="data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20width='20'><circle%20r='1'/></svg> 2x" data-expect="10"> 
+PASS <img srcset="data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='-1%20-1%202%202'%20height='20'><circle%20r='1'/></svg> 2x" data-expect="10"> 
               

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt (206239 => 206240)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt	2016-09-21 22:52:42 UTC (rev 206240)
@@ -6,8 +6,8 @@
 PASS innerHTML 4 <a b="&amp;"></a> 
 PASS innerHTML 5 <a b="&nbsp;"></a> 
 PASS innerHTML 6 <a b="&quot;"></a> 
-FAIL innerHTML 7 <a b="<"></a> assert_equals: expected "<a b=\"<\"></a>" but got "<a b=\"&lt;\"></a>"
-FAIL innerHTML 8 <a b=">"></a> assert_equals: expected "<a b=\">\"></a>" but got "<a b=\"&gt;\"></a>"
+PASS innerHTML 7 <a b="<"></a> 
+PASS innerHTML 8 <a b=">"></a> 
 PASS innerHTML 9 <svg xlink:href="" 
 PASS innerHTML 10 <svg xmlns:svg="test"></svg> 
 PASS innerHTML 11 a 
@@ -33,8 +33,8 @@
 PASS outerHTML 4 <span><a b="&amp;"></a></span> 
 PASS outerHTML 5 <span><a b="&nbsp;"></a></span> 
 PASS outerHTML 6 <span><a b="&quot;"></a></span> 
-FAIL outerHTML 7 <span><a b="<"></a></span> assert_equals: expected "<span><a b=\"<\"></a></span>" but got "<span><a b=\"&lt;\"></a></span>"
-FAIL outerHTML 8 <span><a b=">"></a></span> assert_equals: expected "<span><a b=\">\"></a></span>" but got "<span><a b=\"&gt;\"></a></span>"
+PASS outerHTML 7 <span><a b="<"></a></span> 
+PASS outerHTML 8 <span><a b=">"></a></span> 
 PASS outerHTML 9 <span><svg xlink:href="" 
 PASS outerHTML 10 <span><svg xmlns:svg="test"></svg></span> 
 PASS outerHTML 11 <span>a</span> 

Modified: trunk/Source/WebCore/ChangeLog (206239 => 206240)


--- trunk/Source/WebCore/ChangeLog	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/Source/WebCore/ChangeLog	2016-09-21 22:52:42 UTC (rev 206240)
@@ -1,3 +1,26 @@
+2016-09-21  Chris Dumez  <cdu...@apple.com>
+
+        Fix serialization of HTML Element attributes
+        https://bugs.webkit.org/show_bug.cgi?id=162356
+
+        Reviewed by Alex Christensen.
+
+        Fix serialization of HTML Element attributes to align with:
+        - https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm
+        - https://html.spec.whatwg.org/#escapingString
+
+        In particular, we should not escape '<' and '>'.
+
+        Firefox and Chrome both match the specification.
+
+        Note that we keep escaping '<' and '>' for Element attributes in the
+        context of XML serialization, as per:
+        - https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
+
+        No new tests, rebaselined existing test.
+
+        * editing/MarkupAccumulator.h:
+
 2016-09-21  Anders Carlsson  <ander...@apple.com>
 
         support openPaymentSetup API on ApplePaySession object

Modified: trunk/Source/WebCore/editing/MarkupAccumulator.h (206239 => 206240)


--- trunk/Source/WebCore/editing/MarkupAccumulator.h	2016-09-21 22:52:37 UTC (rev 206239)
+++ trunk/Source/WebCore/editing/MarkupAccumulator.h	2016-09-21 22:52:42 UTC (rev 206240)
@@ -54,7 +54,7 @@
     EntityMaskInPCDATA = EntityAmp | EntityLt | EntityGt,
     EntityMaskInHTMLPCDATA = EntityMaskInPCDATA | EntityNbsp,
     EntityMaskInAttributeValue = EntityAmp | EntityLt | EntityGt | EntityQuot,
-    EntityMaskInHTMLAttributeValue = EntityMaskInAttributeValue | EntityNbsp,
+    EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp,
 };
 
 // FIXME: Noncopyable?
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to