[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric at webkit.org eric at webkit.org
Wed Dec 22 12:27:08 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bf260d336e45a15db7a83b018dffcaa7e4ef921b
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 23 23:52:34 2010 +0000

    2010-08-23  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            editing/pasteboard/bad-placeholder.html fails with --html5-treebuilder
            https://bugs.webkit.org/show_bug.cgi?id=44463
    
            The problem here is that using the documentElement as the context puts
            the tree builder into the BeforeHead insertion mode, which strips
            leading spaces.  This code is confused about what it wants, but it
            certainly doesn't want to be in that insertion mode.  Looking through
            the callers, they'd much rather be in the InBody insertion mode.  We
            can get them there by creating a fake body element as the context
            element.
    
            In the long term, all this code needs to be changed to move away from
            deprecatedCreateContextualFragment, which does a bunch of nasty stuff
            like removing certain kinds of elements.  However, that's a battle for
            another day.
    
            * editing/markup.cpp:
            (WebCore::createFragmentFromMarkup):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65845 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6127caf..d947f96 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,29 @@
 
         Reviewed by Eric Seidel.
 
+        editing/pasteboard/bad-placeholder.html fails with --html5-treebuilder
+        https://bugs.webkit.org/show_bug.cgi?id=44463
+
+        The problem here is that using the documentElement as the context puts
+        the tree builder into the BeforeHead insertion mode, which strips
+        leading spaces.  This code is confused about what it wants, but it
+        certainly doesn't want to be in that insertion mode.  Looking through
+        the callers, they'd much rather be in the InBody insertion mode.  We
+        can get them there by creating a fake body element as the context
+        element.
+
+        In the long term, all this code needs to be changed to move away from
+        deprecatedCreateContextualFragment, which does a bunch of nasty stuff
+        like removing certain kinds of elements.  However, that's a battle for
+        another day.
+
+        * editing/markup.cpp:
+        (WebCore::createFragmentFromMarkup):
+
+2010-08-23  Adam Barth  <abarth at 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
 
diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp
index 6b59311..f2bc276 100644
--- a/WebCore/editing/markup.cpp
+++ b/WebCore/editing/markup.cpp
@@ -46,6 +46,7 @@
 #include "DocumentType.h"
 #include "Editor.h"
 #include "Frame.h"
+#include "HTMLBodyElement.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
 #include "InlineTextBox.h"
@@ -1072,8 +1073,12 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc
 
 PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, FragmentScriptingPermission scriptingPermission)
 {
+    // We use a fake body element here to trick the HTML parser to using the
+    // InBody insertion mode.  Really, all this code is wrong and need to be
+    // changed not to use deprecatedCreateContextualFragment.
+    RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(document);
     // FIXME: This should not use deprecatedCreateContextualFragment
-    RefPtr<DocumentFragment> fragment = document->documentElement()->deprecatedCreateContextualFragment(markup, scriptingPermission);
+    RefPtr<DocumentFragment> fragment = fakeBody->deprecatedCreateContextualFragment(markup, scriptingPermission);
 
     if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL())
         completeURLs(fragment.get(), baseURL);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list