Changeset 206240 in webkit


Ignore:
Timestamp:
Sep 21, 2016 3:52:42 PM (8 years ago)
Author:
Chris Dumez
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:

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:

No new tests, rebaselined existing test.

  • editing/MarkupAccumulator.h:

LayoutTests:

Rebaseline test to reflect behavior change.

  • editing/pasteboard/paste-noscript-expected.txt:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r206237 r206240  
     12016-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix serialization of HTML Element attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=162356
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline test to reflect behavior change.
     9
     10        * editing/pasteboard/paste-noscript-expected.txt:
     11
    1122016-09-21  Matt Baker  <mattbaker@apple.com>
    213
  • trunk/LayoutTests/editing/pasteboard/paste-noscript-expected.txt

    r147281 r206240  
    1616<iframe id="iframe1" src="javascript:var x = 1;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
    1717<iframe id="iframe1" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
    18 <iframe id="iframe2" srcdoc="&lt;script&gt;var x = 1;&lt;/script&gt;" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
     18<iframe id="iframe2" srcdoc="<script>var x = 1;</script>" style="width: 200px; height: 100px; background-color:#cee;"></iframe>
    1919<iframe id="iframe2" style="width: 200px; height: 100px; background-color: rgb(204, 238, 238);"></iframe>
    2020<form id="form1" action="javascript:sayHello()" formaction="javascript:sayHello()" style="width: 200px; height: 150px; background-color:#cee;">This is a form<br><img src="../resources/abe.png"><button formaction="javascript:sayHello()">Submit.</button></form>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r206233 r206240  
     12016-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix serialization of HTML Element attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=162356
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline W3C test now that more checks are passing.
     9
     10        * web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt:
     11        * web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt:
     12
    1132016-09-21  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/current-pixel-density/basic-expected.txt

    r205515 r206240  
    1111FAIL <img srcset="/images/green-256x256.png 256w" sizes="1px" data-expect="1"> assert_equals: naturalWidth expected 1 but got 256
    1212FAIL <img srcset="/images/green-256x256.png 256w" sizes="0px" data-expect="0"> assert_equals: naturalWidth expected 0 but got 256
    13 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">
    14 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">
    15 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">
     13PASS <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">
     14PASS <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">
     15PASS <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">
    1616             
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/syntax/serializing-html-fragments/serializing-expected.txt

    r206201 r206240  
    77PASS innerHTML 5 <a b="&nbsp;"></a>
    88PASS innerHTML 6 <a b="&quot;"></a>
    9 FAIL innerHTML 7 <a b="<"></a> assert_equals: expected "<a b=\"<\"></a>" but got "<a b=\"&lt;\"></a>"
    10 FAIL innerHTML 8 <a b=">"></a> assert_equals: expected "<a b=\">\"></a>" but got "<a b=\"&gt;\"></a>"
     9PASS innerHTML 7 <a b="<"></a>
     10PASS innerHTML 8 <a b=">"></a>
    1111PASS innerHTML 9 <svg xlink:href="a"></svg>
    1212PASS innerHTML 10 <svg xmlns:svg="test"></svg>
     
    3434PASS outerHTML 5 <span><a b="&nbsp;"></a></span>
    3535PASS outerHTML 6 <span><a b="&quot;"></a></span>
    36 FAIL outerHTML 7 <span><a b="<"></a></span> assert_equals: expected "<span><a b=\"<\"></a></span>" but got "<span><a b=\"&lt;\"></a></span>"
    37 FAIL outerHTML 8 <span><a b=">"></a></span> assert_equals: expected "<span><a b=\">\"></a></span>" but got "<span><a b=\"&gt;\"></a></span>"
     36PASS outerHTML 7 <span><a b="<"></a></span>
     37PASS outerHTML 8 <span><a b=">"></a></span>
    3838PASS outerHTML 9 <span><svg xlink:href="a"></svg></span>
    3939PASS outerHTML 10 <span><svg xmlns:svg="test"></svg></span>
  • trunk/Source/WebCore/ChangeLog

    r206238 r206240  
     12016-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Fix serialization of HTML Element attributes
     4        https://bugs.webkit.org/show_bug.cgi?id=162356
     5
     6        Reviewed by Alex Christensen.
     7
     8        Fix serialization of HTML Element attributes to align with:
     9        - https://html.spec.whatwg.org/#html-fragment-serialisation-algorithm
     10        - https://html.spec.whatwg.org/#escapingString
     11
     12        In particular, we should not escape '<' and '>'.
     13
     14        Firefox and Chrome both match the specification.
     15
     16        Note that we keep escaping '<' and '>' for Element attributes in the
     17        context of XML serialization, as per:
     18        - https://w3c.github.io/DOM-Parsing/#dfn-serializing-an-attribute-value
     19
     20        No new tests, rebaselined existing test.
     21
     22        * editing/MarkupAccumulator.h:
     23
    1242016-09-21  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/Source/WebCore/editing/MarkupAccumulator.h

    r191671 r206240  
    5555    EntityMaskInHTMLPCDATA = EntityMaskInPCDATA | EntityNbsp,
    5656    EntityMaskInAttributeValue = EntityAmp | EntityLt | EntityGt | EntityQuot,
    57     EntityMaskInHTMLAttributeValue = EntityMaskInAttributeValue | EntityNbsp,
     57    EntityMaskInHTMLAttributeValue = EntityAmp | EntityQuot | EntityNbsp,
    5858};
    5959
Note: See TracChangeset for help on using the changeset viewer.