Changeset 65844 in webkit


Ignore:
Timestamp:
Aug 23, 2010 4:49:09 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-08-23 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

fast/xsl/default-html.html fails with HTML5 fragment parsing
https://bugs.webkit.org/show_bug.cgi?id=44450

This patch is a step down a trail of tears. As far as I can tell,
there's no spec for XSLTProcessor.transformToFragment. This patch
attempts to infer the proper behavior from test cases and the Mozilla
wiki.

  • xml/XSLTProcessor.cpp: (WebCore::createFragmentFromSource):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65843 r65844  
     12010-08-23  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        fast/xsl/default-html.html fails with HTML5 fragment parsing
     6        https://bugs.webkit.org/show_bug.cgi?id=44450
     7
     8        This patch is a step down a trail of tears.  As far as I can tell,
     9        there's no spec for XSLTProcessor.transformToFragment.  This patch
     10        attempts to infer the proper behavior from test cases and the Mozilla
     11        wiki.
     12
     13        * xml/XSLTProcessor.cpp:
     14        (WebCore::createFragmentFromSource):
     15
    1162010-08-23  Adam Barth  <abarth@webkit.org>
    217
  • trunk/WebCore/xml/XSLTProcessor.cpp

    r65375 r65844  
    3333#include "FrameLoader.h"
    3434#include "FrameView.h"
     35#include "HTMLBodyElement.h"
    3536#include "HTMLDocument.h"
    3637#include "Page.h"
     
    100101    RefPtr<DocumentFragment> fragment = outputDoc->createDocumentFragment();
    101102
    102     if (sourceMIMEType == "text/html")
    103         fragment->parseHTML(sourceString, 0);
    104     else if (sourceMIMEType == "text/plain")
     103    if (sourceMIMEType == "text/html") {
     104        // As far as I can tell, there isn't a spec for how transformToFragment
     105        // is supposed to work.  Based on the documentation I can find, it looks
     106        // like we want to start parsing the fragment in the InBody insertion
     107        // mode.  Unfortunately, that's an implementation detail of the parser.
     108        // We achieve that effect here by passing in a fake body element as
     109        // context for the fragment.
     110        RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(outputDoc);
     111        fragment->parseHTML(sourceString, fakeBody.get());
     112    } else if (sourceMIMEType == "text/plain")
    105113        fragment->parserAddChild(Text::create(outputDoc, sourceString));
    106114    else {
Note: See TracChangeset for help on using the changeset viewer.