Changeset 159607 in webkit


Ignore:
Timestamp:
Nov 20, 2013 10:10:31 PM (10 years ago)
Author:
rniwa@webkit.org
Message:

[HTML parser] reset insertion mode appropriate must check for "in select in table" mode
https://bugs.webkit.org/show_bug.cgi?id=123850

Reviewed by Antti Koivisto.

Source/WebCore:

Merge https://chromium.googlesource.com/chromium/blink/+/2cb7523df57dfb48111f6aa16b7138cd54024ba7

The HTML specification has been updated to detect encountering a template element inside of a select element,
which in turn is inside of a table element. In this case, the select element will cause the parser to be in
"InSelectInTable" mode. Thus when the template element closes, it should return to that mode.

The fix here is that resetInsertionModeAppropriately must continue looking up the stack if the first node is
select element to see whether the select element is inside of a table element.

See also: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#reset-the-insertion-mode-appropriately

Test: html5lib/resources/template.dat

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):

LayoutTests:

  • html5lib/resources/template.dat:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r159596 r159607  
     12013-11-20  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        [HTML parser] reset insertion mode appropriate must check for "in select in table" mode
     4        https://bugs.webkit.org/show_bug.cgi?id=123850
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * html5lib/resources/template.dat:
     9
    1102013-11-20  Ryosuke Niwa  <rniwa@webkit.org>
    211
  • trunk/LayoutTests/html5lib/resources/template.dat

    r147185 r159607  
    12701270|         content
    12711271|           <span>
     1272
     1273#data
     1274<body><table><tr><td><select><template>Foo</template><caption>A</table>
     1275#errors
     1276#document
     1277| <html>
     1278|   <head>
     1279|   <body>
     1280|     <table>
     1281|       <tbody>
     1282|         <tr>
     1283|           <td>
     1284|             <select>
     1285|               <template>
     1286|                 content
     1287|                   "Foo"
     1288|       <caption>
     1289|         "A"
  • trunk/Source/WebCore/ChangeLog

    r159606 r159607  
     12013-11-20  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        [HTML parser] reset insertion mode appropriate must check for "in select in table" mode
     4        https://bugs.webkit.org/show_bug.cgi?id=123850
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Merge https://chromium.googlesource.com/chromium/blink/+/2cb7523df57dfb48111f6aa16b7138cd54024ba7
     9
     10        The HTML specification has been updated to detect encountering a template element inside of a select element,
     11        which in turn is inside of a table element. In this case, the select element will cause the parser to be in
     12        "InSelectInTable" mode. Thus when the template element closes, it should return to that mode.
     13
     14        The fix here is that resetInsertionModeAppropriately must continue looking up the stack if the first node is
     15        select element to see whether the select element is inside of a table element.
     16
     17        See also: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#reset-the-insertion-mode-appropriately
     18
     19        Test: html5lib/resources/template.dat
     20
     21        * html/parser/HTMLTreeBuilder.cpp:
     22        (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
     23
    1242013-11-20  Mark Lam  <mark.lam@apple.com>
    225
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r158650 r159607  
    16421642#endif
    16431643        if (item->hasTagName(selectTag)) {
     1644#if ENABLE(TEMPLATE_ELEMENT)
     1645            if (!last) {
     1646                while (item->node() != m_tree.openElements()->rootNode() && !item->hasTagName(templateTag)) {
     1647                    nodeRecord = nodeRecord->next();
     1648                    item = nodeRecord->stackItem();
     1649                    if (isHTMLTableElement(item->node()))
     1650                        return setInsertionMode(InSelectInTableMode);
     1651                }
     1652            }
     1653#endif
    16441654            return setInsertionMode(InSelectMode);
    16451655        }
Note: See TracChangeset for help on using the changeset viewer.