Changeset 140631 in webkit


Ignore:
Timestamp:
Jan 23, 2013 6:31:35 PM (11 years ago)
Author:
rafaelw@chromium.org
Message:

Template element should parse in XHTML just as it does in HTML
https://bugs.webkit.org/show_bug.cgi?id=106491

Reviewed by Ryosuke Niwa.

Source/WebCore:

https://dvcs.w3.org/hg/webcomponents/raw-file/f33622c39c5e/spec/templates/index.html#parsing-xhtml-documents.
https://dvcs.w3.org/hg/webcomponents/raw-file/f33622c39c5e/spec/templates/index.html#serializing-xhtml-documents.

This patch modifies the XML parser in two ways: (1) when nodes are created, their owner document is
the owner document of the current node, rather than the containing document, and (2) when an HTMLTemplateElement
is encountered, its content document fragment is pushed onto the stack, rather than the element itself, so that children
are appended to the template content. Also, because XSLT operates on the serialized input document, transforms consider
template contents to be descendants.

Tests: fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization.xml

fast/xpath/xpath-template-element.html
fast/xsl/xslt-processor-template.html
fast/xsl/xslt-xhtml-template.xml

  • xml/parser/XMLDocumentParser.cpp:

(WebCore::XMLDocumentParser::enterText):

  • xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::XMLDocumentParser::startElementNs):
(WebCore::XMLDocumentParser::processingInstruction):
(WebCore::XMLDocumentParser::cdataBlock):
(WebCore::XMLDocumentParser::comment):

LayoutTests:

  • fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization-expected.txt: Added.
  • fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization.xml: Added.
  • fast/xpath/xpath-template-element-expected.txt: Added.
  • fast/xpath/xpath-template-element.html: Added.
  • fast/xsl/resources/xhtml-template.xsl: Added.
  • fast/xsl/xslt-processor-template-expected.txt: Added.
  • fast/xsl/xslt-processor-template.html: Added.
  • fast/xsl/xslt-xhtml-template-expected.txt: Added.
  • fast/xsl/xslt-xhtml-template.xml: Added.
Location:
trunk
Files:
9 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140630 r140631  
     12013-01-23  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        Template element should parse in XHTML just as it does in HTML
     4        https://bugs.webkit.org/show_bug.cgi?id=106491
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization-expected.txt: Added.
     9        * fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization.xml: Added.
     10        * fast/xpath/xpath-template-element-expected.txt: Added.
     11        * fast/xpath/xpath-template-element.html: Added.
     12        * fast/xsl/resources/xhtml-template.xsl: Added.
     13        * fast/xsl/xslt-processor-template-expected.txt: Added.
     14        * fast/xsl/xslt-processor-template.html: Added.
     15        * fast/xsl/xslt-xhtml-template-expected.txt: Added.
     16        * fast/xsl/xslt-xhtml-template.xml: Added.
     17
    1182013-01-23  Yoshifumi Inoue  <yosin@chromium.org>
    219
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140493 r140631  
    9191# ENABLE(DRAGGABLE_REGION) is disabled
    9292fast/css/draggable-region-parser.html [ WontFix ]
     93
     94# ENABLE(TEMPLATE_ELEMENT) is disabled.
     95webkit.org/b/103547 fast/dom/HTMLTemplateElement [ Skip ]
     96webkit.org/b/103547 html5lib/run-template.html [ Skip ]
     97webkit.org/b/103547 fast/xsl/xslt-xhtml-template.xml [ Skip ]
     98webkit.org/b/103547 fast/xpath/xpath-template-element.html [ Skip ]
     99webkit.org/b/103547 fast/xsl/xslt-processor-template.html [ Skip ]
    93100
    94101# These test -apple- and -khtml- prefixed CSS properties, which we don't support.
  • trunk/LayoutTests/platform/mac/TestExpectations

    r140474 r140631  
    433433fast/dom/HTMLTemplateElement
    434434html5lib/run-template.html
     435fast/xsl/xslt-xhtml-template.xml
     436fast/xpath/xpath-template-element.html
     437fast/xsl/xslt-processor-template.html
    435438
    436439# JSC does not support setIsolatedWorldSecurityOrigin (http://webkit.org/b/61540)
  • trunk/LayoutTests/platform/qt/TestExpectations

    r140493 r140631  
    196196fast/dom/HTMLTemplateElement
    197197html5lib/run-template.html
     198fast/xsl/xslt-xhtml-template.xml
     199fast/xpath/xpath-template-element.html
     200fast/xsl/xslt-processor-template.html
    198201
    199202# Fail until SUBPIXEL_LAYOUT is enabled
  • trunk/LayoutTests/platform/win/TestExpectations

    r140493 r140631  
    15381538fast/dom/HTMLTemplateElement
    15391539html5lib/run-template.html
     1540fast/xsl/xslt-xhtml-template.xml
     1541fast/xpath/xpath-template-element.html
     1542fast/xsl/xslt-processor-template.html
    15401543
    15411544# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r140493 r140631  
    20672067fast/dom/HTMLTemplateElement
    20682068html5lib/run-template.html
     2069fast/xsl/xslt-xhtml-template.xml
     2070fast/xpath/xpath-template-element.html
     2071fast/xsl/xslt-processor-template.html
    20692072
    20702073# CSS Regions support not yet enabled. http://webkit.org/b/57312
  • trunk/Source/WebCore/ChangeLog

    r140628 r140631  
     12013-01-23  Rafael Weinstein  <rafaelw@chromium.org>
     2
     3        Template element should parse in XHTML just as it does in HTML
     4        https://bugs.webkit.org/show_bug.cgi?id=106491
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        https://dvcs.w3.org/hg/webcomponents/raw-file/f33622c39c5e/spec/templates/index.html#parsing-xhtml-documents.
     9        https://dvcs.w3.org/hg/webcomponents/raw-file/f33622c39c5e/spec/templates/index.html#serializing-xhtml-documents.
     10
     11        This patch modifies the XML parser in two ways: (1) when nodes are created, their owner document is
     12        the owner document of the current node, rather than the containing document, and (2) when an HTMLTemplateElement
     13        is encountered, its content document fragment is pushed onto the stack, rather than the element itself, so that children
     14        are appended to the template content. Also, because XSLT operates on the serialized input document, transforms consider
     15        template contents to be descendants.
     16
     17        Tests: fast/dom/HTMLTemplateElement/xhtml-parsing-and-serialization.xml
     18               fast/xpath/xpath-template-element.html
     19               fast/xsl/xslt-processor-template.html
     20               fast/xsl/xslt-xhtml-template.xml
     21
     22        * xml/parser/XMLDocumentParser.cpp:
     23        (WebCore::XMLDocumentParser::enterText):
     24        * xml/parser/XMLDocumentParserLibxml2.cpp:
     25        (WebCore::XMLDocumentParser::startElementNs):
     26        (WebCore::XMLDocumentParser::processingInstruction):
     27        (WebCore::XMLDocumentParser::cdataBlock):
     28        (WebCore::XMLDocumentParser::comment):
     29
    1302013-01-23  Tony Gentilcore  <tonyg@chromium.org>
    231
  • trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp

    r140036 r140631  
    147147#endif
    148148    ASSERT(!m_leafTextNode);
    149     m_leafTextNode = Text::create(document(), "");
     149    m_leafTextNode = Text::create(m_currentNode->document(), "");
    150150    m_currentNode->parserAppendChild(m_leafTextNode.get());
    151151}
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp

    r140610 r140631  
    4343#include "HTMLNames.h"
    4444#include "HTMLStyleElement.h"
     45#include "HTMLTemplateElement.h"
    4546#include "ProcessingInstruction.h"
    4647#include "ResourceError.h"
     
    790791
    791792    QualifiedName qName(prefix, localName, uri);
    792     RefPtr<Element> newElement = document()->createElement(qName, true);
     793    RefPtr<Element> newElement = m_currentNode->document()->createElement(qName, true);
    793794    if (!newElement) {
    794795        stopParsing();
     
    820821    m_currentNode->parserAppendChild(newElement.get());
    821822
     823#if ENABLE(TEMPLATE_ELEMENT)
     824    if (newElement->hasTagName(HTMLNames::templateTag))
     825        pushCurrentNode(toHTMLTemplateElement(newElement.get())->content());
     826    else
     827        pushCurrentNode(newElement.get());
     828#else
    822829    pushCurrentNode(newElement.get());
     830#endif
     831
    823832    if (m_view && !newElement->attached())
    824833        newElement->attach();
     
    963972    // ### handle exceptions
    964973    ExceptionCode ec = 0;
    965     RefPtr<ProcessingInstruction> pi = document()->createProcessingInstruction(
     974    RefPtr<ProcessingInstruction> pi = m_currentNode->document()->createProcessingInstruction(
    966975        toString(target), toString(data), ec);
    967976    if (ec)
     
    9971006    exitText();
    9981007
    999     RefPtr<CDATASection> newNode = CDATASection::create(document(), toString(s, len));
     1008    RefPtr<CDATASection> newNode = CDATASection::create(m_currentNode->document(), toString(s, len));
    10001009    m_currentNode->parserAppendChild(newNode.get());
    10011010    if (m_view && !newNode->attached())
     
    10151024    exitText();
    10161025
    1017     RefPtr<Comment> newNode = Comment::create(document(), toString(s));
     1026    RefPtr<Comment> newNode = Comment::create(m_currentNode->document(), toString(s));
    10181027    m_currentNode->parserAppendChild(newNode.get());
    10191028    if (m_view && !newNode->attached())
Note: See TracChangeset for help on using the changeset viewer.