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

aestes at apple.com aestes at apple.com
Wed Dec 22 13:35:09 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7fb43f6fda469c02ff0d5d62733a6ae9ac32c4f9
Author: aestes at apple.com <aestes at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 23:01:12 2010 +0000

    2010-09-20  Andy Estes  <aestes at apple.com>
    
            Reviewed by Adam Barth.
    
            REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
            https://bugs.webkit.org/show_bug.cgi?id=40961
    
            Implement WebKitUsePreHTML5ParserQuirks preference.
    
            * WebView/WebPreferenceKeysPrivate.h:
            * WebView/WebPreferences.mm:
            (+[WebPreferences initialize]): Default WebKitUsePreHTML5ParserQuirks to
            false.
            (-[WebPreferences usePreHTML5ParserQuirks]):
            (-[WebPreferences setUsePreHTML5ParserQuirks:]):
            * WebView/WebPreferencesPrivate.h:
            * WebView/WebView.mm:
            (-[WebView _preferencesChangedNotification:]): Update WebCore::Settings
            with the value of WebKitUsePreHTML5ParserQuirks when a preference
            changes.
    2010-09-20  Andy Estes  <aestes at apple.com>
    
            Reviewed by Adam Barth.
    
            REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
            https://bugs.webkit.org/show_bug.cgi?id=40961
    
            Add an optional quirk to the HTML5 tokenizer that reverts it to WebKit's
            legacy behavior when the start of a new token is encountered before the
            current token is finished parsing. The legacy behavior is to emit the
            current token as if it were properly closed and being parsing the new
            token.
    
            Test: fast/parser/pre-html5-parser-quirks.html
    
            * html/parser/HTMLDocumentParser.cpp:
            (WebCore::HTMLDocumentParser::HTMLDocumentParser): Instantiate
            m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
            (WebCore::usePreHTMLParserQuirks): Add a helper function to return the
            value of Settings::usePreHTML5ParserQuirks() if Settings is non-NULL.
            * html/parser/HTMLPreloadScanner.cpp:
            (WebCore::HTMLPreloadScanner::HTMLPreloadScanner): Instantiate
            m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
            * html/parser/HTMLTokenizer.cpp:
            (WebCore::HTMLTokenizer::HTMLTokenizer):
            (WebCore::HTMLTokenizer::nextToken): If the quirk is enabled and an
            unexpected '<' is encountered in certain states, emit the current token
            and reprocess the '<' as the start of a new token.
            * html/parser/HTMLTokenizer.h:
            (WebCore::HTMLTokenizer::create):
            * html/parser/HTMLViewSourceParser.cpp:
            (WebCore::HTMLViewSourceParser::HTMLViewSourceParser): Instantiate
            m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
            * page/Settings.cpp:
            (WebCore::Settings::Settings):
            * page/Settings.h:
            (WebCore::Settings::setUsePreHTML5ParserQuirks):
            (WebCore::Settings::usePreHTML5ParserQuirks):
    2010-09-20  Andy Estes  <aestes at apple.com>
    
            Reviewed by Adam Barth.
    
            REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
            https://bugs.webkit.org/show_bug.cgi?id=40961
    
            * fast/parser/pre-html5-parser-quirks-expected.txt: Added.
            * fast/parser/pre-html5-parser-quirks.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-after-attribute-name-state.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-attribute-name-state.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-before-attribute-name-state.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-document-fragment.html: Added.
            * fast/parser/resources/pre-html5-parser-quirk-tag-name-state.html: Added.
            * platform/chromium/test_expectations.txt: Skip pre-html5-parser-quirks.html.
            * platform/gtk/Skipped: Skip pre-html5-parser-quirks.html.
            * platform/mac-wk2/Skipped: Skip pre-html5-parser-quirks.html.
            * platform/qt/Skipped: Skip pre-html5-parser-quirks.html.
            * platform/win/Skipped: Skip pre-html5-parser-quirks.html.
    2010-09-20  Andy Estes  <aestes at apple.com>
    
            Reviewed by Adam Barth.
    
            REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
            https://bugs.webkit.org/show_bug.cgi?id=40961
    
            Implement WebKitUsePreHTML5ParserQuirks preference.
    
            * DumpRenderTree/mac/DumpRenderTree.mm:
            (resetDefaultsToConsistentValues): Reset WebKitUsePreHTML5ParserQuirks
            to false after a test finishes.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67890 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8ad17d9..b6a0fc1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-20  Andy Estes  <aestes at apple.com>
+
+        Reviewed by Adam Barth.
+
+        REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
+        https://bugs.webkit.org/show_bug.cgi?id=40961
+
+        * fast/parser/pre-html5-parser-quirks-expected.txt: Added.
+        * fast/parser/pre-html5-parser-quirks.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-after-attribute-name-state.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-attribute-name-state.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-before-attribute-name-state.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-document-fragment.html: Added.
+        * fast/parser/resources/pre-html5-parser-quirk-tag-name-state.html: Added.
+        * platform/chromium/test_expectations.txt: Skip pre-html5-parser-quirks.html.
+        * platform/gtk/Skipped: Skip pre-html5-parser-quirks.html.
+        * platform/mac-wk2/Skipped: Skip pre-html5-parser-quirks.html.
+        * platform/qt/Skipped: Skip pre-html5-parser-quirks.html.
+        * platform/win/Skipped: Skip pre-html5-parser-quirks.html.
+
 2010-09-20  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt b/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt
new file mode 100644
index 0000000..a3427d0
--- /dev/null
+++ b/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt
@@ -0,0 +1,45 @@
+This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See https://webkit.org/b/40961 for details.
+
+      
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+AfterAttributeNameState:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame1-->-->'
+--------
+AfterAttributeValueQuotedState:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame2-->-->'
+--------
+AfterAttributeValueUnquotedState:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame3-->-->'
+--------
+AttributeNameState:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame4-->-->'
+--------
+BeforeAttributeNameState:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame5-->-->'
+--------
+Document fragment:
+PASS
+
+--------
+Frame: '<!--framePath //<!--frame6-->-->'
+--------
+TagNameState:
+PASS
diff --git a/LayoutTests/fast/parser/pre-html5-parser-quirks.html b/LayoutTests/fast/parser/pre-html5-parser-quirks.html
new file mode 100644
index 0000000..6ff9ca9
--- /dev/null
+++ b/LayoutTests/fast/parser/pre-html5-parser-quirks.html
@@ -0,0 +1,18 @@
+<script>
+    if (window.layoutTestController) {
+        layoutTestController.overridePreference("WebKitUsePreHTML5ParserQuirks", "1");
+        layoutTestController.dumpAsText();
+        layoutTestController.dumpChildFramesAsText();
+    }
+</script>
+
+<p>This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See <a href="https://webkit.org/b/40961">https://webkit.org/b/40961</a> for details.</p>
+
+<iframe src="resources/pre-html5-parser-quirk-after-attribute-name-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-attribute-name-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-before-attribute-name-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-document-fragment.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-tag-name-state.html"></iframe>
+
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-name-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-name-state.html
new file mode 100644
index 0000000..a24b449
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-name-state.html
@@ -0,0 +1,7 @@
+<div>
+    AfterAttributeNameState:
+    <div style="visibility:hidden">
+        <p></p attr
+    </div>
+    PASS
+</div>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html
new file mode 100644
index 0000000..0cafee4
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html
@@ -0,0 +1,6 @@
+<div>
+    AfterAttributeValueQuotedState:
+    <div style="visibility:hidden">
+        <p></p attr="value"</div>
+    PASS
+</div>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html
new file mode 100644
index 0000000..831c4f6
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-after-attribute-value-unquoted-state.html
@@ -0,0 +1,13 @@
+<div>
+    AfterAttributeValueUnquotedState:
+    <div style="visibility:hidden">
+        <p></p id=unquoted</div>
+    FAIL
+</div>
+<div id="console"></div>
+
+<script>
+    var console = document.getElementById("console");
+    if (!document.getElementById("unquoted"))
+        console.innerHTML = "PASS";
+</script>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-attribute-name-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-attribute-name-state.html
new file mode 100644
index 0000000..002e7a8
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-attribute-name-state.html
@@ -0,0 +1,6 @@
+<div>
+    AttributeNameState:
+    <div style="visibility:hidden">
+        <p></p attr</div>
+    PASS
+</div>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-before-attribute-name-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-before-attribute-name-state.html
new file mode 100644
index 0000000..d520800
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-before-attribute-name-state.html
@@ -0,0 +1,7 @@
+<div>
+    BeforeAttributeNameState:
+    <div style="visibility:hidden">
+        <p></p
+    </div>
+    PASS
+</div>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html
new file mode 100644
index 0000000..7dd4d8b
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html
@@ -0,0 +1,7 @@
+Document fragment:
+<div id="wrapper">
+</div>
+
+<script>
+    document.getElementById("wrapper").innerHTML = "<div style='visibility:hidden'><p></p</div>PASS";
+</script>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-tag-name-state.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-tag-name-state.html
new file mode 100644
index 0000000..0950850
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-tag-name-state.html
@@ -0,0 +1,6 @@
+<div>
+    TagNameState:
+    <div style="visibility:hidden">
+        <p></p</div>
+    PASS
+</div>
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index ab34144..f16b0b9 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -3178,3 +3178,6 @@ BUGWEBGL MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TE
 BUGWEBGL MAC : fast/canvas/webgl/texture-npot.html = TEXT
 BUGWEBGL WIN LINUX : fast/canvas/webgl/uniform-location.html = TEXT
 
+// Pre-HTML5 parser quirks only apply to the mac port for now.
+WONTFIX SKIP : fast/parser/pre-html5-parser-quirks.html = FAIL
+
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 7710298..3fe228d 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5923,3 +5923,6 @@ websocket/tests
 
 # viewport meta tag support
 fast/viewport
+
+# Pre-HMTL5 parser quirks only apply to the mac port for now.
+fast/parser/pre-html5-parser-quirks.html
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index d184ee5..693ba05 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -2065,3 +2065,6 @@ platform/mac/fast/events/objc-event-api.html
 # WebKitTestRunner doesn't have eventSender.fireKeyboardEventsToElement
 platform/mac/fast/events/objc-keyboard-event-creation.html
 
+# WebKit2 does not (should not?) support setting WebKitUsePreHTML5ParserQuirks
+# in its WebPreferences implementation.
+fast/parser/pre-html5-parser-quirks.html
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index fa88cb7..429f15e 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5475,3 +5475,7 @@ http/tests/misc/iframe404.html
 http/tests/misc/location-replace-crossdomain.html
 http/tests/misc/slow-loading-image-in-pattern.html
 http/tests/uri/css-href.php
+
+# Pre-HMTL5 parser quirks only apply to the mac port for now.
+fast/parser/pre-html5-parser-quirks.html
+
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 434a51b..ef4d6be 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -998,3 +998,7 @@ media/media-can-play-mpeg4-video.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=46111
 http/tests/media/video-served-as-text.html
+
+# Pre-HMTL5 parser quirks only apply to the mac port for now.
+fast/parser/pre-html5-parser-quirks.html
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a664c49..ccb594e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-09-20  Andy Estes  <aestes at apple.com>
+
+        Reviewed by Adam Barth.
+
+        REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
+        https://bugs.webkit.org/show_bug.cgi?id=40961
+
+        Add an optional quirk to the HTML5 tokenizer that reverts it to WebKit's
+        legacy behavior when the start of a new token is encountered before the
+        current token is finished parsing. The legacy behavior is to emit the
+        current token as if it were properly closed and being parsing the new
+        token.
+
+        Test: fast/parser/pre-html5-parser-quirks.html
+
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::HTMLDocumentParser): Instantiate
+        m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
+        (WebCore::usePreHTMLParserQuirks): Add a helper function to return the
+        value of Settings::usePreHTML5ParserQuirks() if Settings is non-NULL.
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::HTMLPreloadScanner::HTMLPreloadScanner): Instantiate
+        m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
+        * html/parser/HTMLTokenizer.cpp:
+        (WebCore::HTMLTokenizer::HTMLTokenizer):
+        (WebCore::HTMLTokenizer::nextToken): If the quirk is enabled and an
+        unexpected '<' is encountered in certain states, emit the current token
+        and reprocess the '<' as the start of a new token.
+        * html/parser/HTMLTokenizer.h:
+        (WebCore::HTMLTokenizer::create):
+        * html/parser/HTMLViewSourceParser.cpp:
+        (WebCore::HTMLViewSourceParser::HTMLViewSourceParser): Instantiate
+        m_tokenizer with the value of Settings::usePreHTML5ParserQuirks().
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        * page/Settings.h:
+        (WebCore::Settings::setUsePreHTML5ParserQuirks):
+        (WebCore::Settings::usePreHTML5ParserQuirks):
+
 2010-09-20  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/html/parser/HTMLDocumentParser.cpp b/WebCore/html/parser/HTMLDocumentParser.cpp
index 325d7a3..477c761 100644
--- a/WebCore/html/parser/HTMLDocumentParser.cpp
+++ b/WebCore/html/parser/HTMLDocumentParser.cpp
@@ -37,6 +37,7 @@
 #include "HTMLTreeBuilder.h"
 #include "HTMLDocument.h"
 #include "NestingLevelIncrementer.h"
+#include "Settings.h"
 #include "XSSAuditor.h"
 #include <wtf/CurrentTime.h>
 
@@ -79,7 +80,7 @@ HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElement, bo
 
 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors)
     : ScriptableDocumentParser(document)
-    , m_tokenizer(HTMLTokenizer::create())
+    , m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(document)))
     , m_scriptRunner(HTMLScriptRunner::create(document, this))
     , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors))
     , m_parserScheduler(HTMLParserScheduler::create(this))
@@ -92,7 +93,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
 // minimize code duplication between these constructors.
 HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
     : ScriptableDocumentParser(fragment->document())
-    , m_tokenizer(HTMLTokenizer::create())
+    , m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(fragment->document())))
     , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission))
     , m_endWasDelayed(false)
     , m_writeNestingLevel(0)
@@ -517,5 +518,11 @@ void HTMLDocumentParser::parseDocumentFragment(const String& source, DocumentFra
     ASSERT(!parser->processingData()); // Make sure we're done. <rdar://problem/3963151>
     parser->detach(); // Allows ~DocumentParser to assert it was detached before destruction.
 }
+    
+bool HTMLDocumentParser::usePreHTML5ParserQuirks(Document* document)
+{
+    ASSERT(document);
+    return document->settings() && document->settings()->usePreHTML5ParserQuirks();
+}
 
 }
diff --git a/WebCore/html/parser/HTMLDocumentParser.h b/WebCore/html/parser/HTMLDocumentParser.h
index e1f2efe..e65a582 100644
--- a/WebCore/html/parser/HTMLDocumentParser.h
+++ b/WebCore/html/parser/HTMLDocumentParser.h
@@ -66,6 +66,8 @@ public:
     void resumeParsingAfterYield();
 
     static void parseDocumentFragment(const String&, DocumentFragment*, Element* contextElement, FragmentScriptingPermission = FragmentScriptingAllowed);
+    
+    static bool usePreHTML5ParserQuirks(Document*);
 
 protected:
     virtual void insert(const SegmentedString&);
diff --git a/WebCore/html/parser/HTMLPreloadScanner.cpp b/WebCore/html/parser/HTMLPreloadScanner.cpp
index 9f4185b..7859dd8 100644
--- a/WebCore/html/parser/HTMLPreloadScanner.cpp
+++ b/WebCore/html/parser/HTMLPreloadScanner.cpp
@@ -31,6 +31,7 @@
 #include "CSSHelper.h"
 #include "CachedResourceLoader.h"
 #include "Document.h"
+#include "HTMLDocumentParser.h"
 #include "HTMLTokenizer.h"
 #include "HTMLLinkElement.h"
 #include "HTMLNames.h"
@@ -120,7 +121,7 @@ private:
 HTMLPreloadScanner::HTMLPreloadScanner(Document* document)
     : m_document(document)
     , m_cssScanner(document)
-    , m_tokenizer(HTMLTokenizer::create())
+    , m_tokenizer(HTMLTokenizer::create(HTMLDocumentParser::usePreHTML5ParserQuirks(document)))
     , m_bodySeen(false)
     , m_inStyle(false)
 {
diff --git a/WebCore/html/parser/HTMLTokenizer.cpp b/WebCore/html/parser/HTMLTokenizer.cpp
index 99bdb60..305fca2 100644
--- a/WebCore/html/parser/HTMLTokenizer.cpp
+++ b/WebCore/html/parser/HTMLTokenizer.cpp
@@ -103,8 +103,9 @@ inline bool isEndTagBufferingState(HTMLTokenizer::State state)
 
 }
 
-HTMLTokenizer::HTMLTokenizer()
+HTMLTokenizer::HTMLTokenizer(bool usePreHTML5ParserQuirks)
     : m_inputStreamPreprocessor(this)
+    , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks)
 {
     reset();
 }
@@ -436,6 +437,8 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
             ADVANCE_TO(SelfClosingStartTagState);
         else if (cc == '>')
             return emitAndResumeIn(source, DataState);
+        else if (m_usePreHTML5ParserQuirks && cc == '<')
+            return emitAndReconsumeIn(source, DataState);
         else if (isASCIIUpper(cc)) {
             m_token->appendToName(toLowerCase(cc));
             ADVANCE_TO(TagNameState);
@@ -877,6 +880,8 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
             ADVANCE_TO(SelfClosingStartTagState);
         else if (cc == '>')
             return emitAndResumeIn(source, DataState);
+        else if (m_usePreHTML5ParserQuirks && cc == '<')
+            return emitAndReconsumeIn(source, DataState);
         else if (isASCIIUpper(cc)) {
             m_token->addNewAttribute();
             m_token->beginAttributeName(source.numberOfCharactersConsumed());
@@ -909,6 +914,9 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
         } else if (cc == '>') {
             m_token->endAttributeName(source.numberOfCharactersConsumed());
             return emitAndResumeIn(source, DataState);
+        } else if (m_usePreHTML5ParserQuirks && cc == '<') {
+            m_token->endAttributeName(source.numberOfCharactersConsumed());
+            return emitAndReconsumeIn(source, DataState);
         } else if (isASCIIUpper(cc)) {
             m_token->appendToAttributeName(toLowerCase(cc));
             ADVANCE_TO(AttributeNameState);
@@ -934,6 +942,8 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
             ADVANCE_TO(BeforeAttributeValueState);
         else if (cc == '>')
             return emitAndResumeIn(source, DataState);
+        else if (m_usePreHTML5ParserQuirks && cc == '<')
+            return emitAndReconsumeIn(source, DataState);
         else if (isASCIIUpper(cc)) {
             m_token->addNewAttribute();
             m_token->beginAttributeName(source.numberOfCharactersConsumed());
@@ -1076,6 +1086,8 @@ bool HTMLTokenizer::nextToken(SegmentedString& source, HTMLToken& token)
             ADVANCE_TO(SelfClosingStartTagState);
         else if (cc == '>')
             return emitAndResumeIn(source, DataState);
+        else if (m_usePreHTML5ParserQuirks && cc == '<')
+            return emitAndReconsumeIn(source, DataState);
         else if (cc == InputStreamPreprocessor::endOfFileMarker) {
             parseError();
             RECONSUME_IN(DataState);
diff --git a/WebCore/html/parser/HTMLTokenizer.h b/WebCore/html/parser/HTMLTokenizer.h
index 5318944..f16b049 100644
--- a/WebCore/html/parser/HTMLTokenizer.h
+++ b/WebCore/html/parser/HTMLTokenizer.h
@@ -119,7 +119,7 @@ public:
         CDATASectionDoubleRightSquareBracketState,
     };
 
-    static PassOwnPtr<HTMLTokenizer> create() { return adoptPtr(new HTMLTokenizer); }
+    static PassOwnPtr<HTMLTokenizer> create(bool usePreHTML5ParserQuirks) { return adoptPtr(new HTMLTokenizer(usePreHTML5ParserQuirks)); }
     ~HTMLTokenizer();
 
     void reset();
@@ -254,7 +254,7 @@ private:
         bool m_skipNextNewLine;
     };
 
-    HTMLTokenizer();
+    HTMLTokenizer(bool usePreHTML5ParserQuirks);
 
     inline bool processEntity(SegmentedString&);
 
@@ -307,6 +307,8 @@ private:
 
     // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream
     InputStreamPreprocessor m_inputStreamPreprocessor;
+    
+    bool m_usePreHTML5ParserQuirks;
 };
 
 }
diff --git a/WebCore/html/parser/HTMLViewSourceParser.cpp b/WebCore/html/parser/HTMLViewSourceParser.cpp
index f31c0a2..ace8590 100644
--- a/WebCore/html/parser/HTMLViewSourceParser.cpp
+++ b/WebCore/html/parser/HTMLViewSourceParser.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "HTMLViewSourceParser.h"
 
+#include "HTMLDocumentParser.h"
 #include "HTMLNames.h"
 #include "HTMLViewSourceDocument.h"
 
@@ -33,7 +34,7 @@ namespace WebCore {
 
 HTMLViewSourceParser::HTMLViewSourceParser(HTMLViewSourceDocument* document)
     : DecodedDataDocumentParser(document)
-    , m_tokenizer(HTMLTokenizer::create())
+    , m_tokenizer(HTMLTokenizer::create(HTMLDocumentParser::usePreHTML5ParserQuirks(document)))
 {
 }
 
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index bb0781c..fac0a5f 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -146,6 +146,7 @@ Settings::Settings(Page* page)
 #endif
     , m_memoryInfoEnabled(false)
     , m_interactiveFormValidation(false)
+    , m_usePreHTML5ParserQuirks(false)
 {
     // A Frame may not have been created yet, so we initialize the AtomicString 
     // hash before trying to use it.
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index cc8470b..99a4f23 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -326,6 +326,9 @@ namespace WebCore {
         // and http://webkit.org/b/40908
         void setInteractiveFormValidationEnabled(bool flag) { m_interactiveFormValidation = flag; }
         bool interactiveFormValidationEnabled() const { return m_interactiveFormValidation; }
+        
+        void setUsePreHTML5ParserQuirks(bool flag) { m_usePreHTML5ParserQuirks = flag; }
+        bool usePreHTML5ParserQuirks() const { return m_usePreHTML5ParserQuirks; }
 
     private:
         Page* m_page;
@@ -413,6 +416,7 @@ namespace WebCore {
 #endif
         bool m_memoryInfoEnabled: 1;
         bool m_interactiveFormValidation: 1;
+        bool m_usePreHTML5ParserQuirks: 1;
 
 #if USE(SAFARI_THEME)
         static bool gShouldPaintNativeControls;
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index b1543cc..a43b4c5 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,24 @@
+2010-09-20  Andy Estes  <aestes at apple.com>
+
+        Reviewed by Adam Barth.
+
+        REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
+        https://bugs.webkit.org/show_bug.cgi?id=40961
+
+        Implement WebKitUsePreHTML5ParserQuirks preference.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]): Default WebKitUsePreHTML5ParserQuirks to
+        false.
+        (-[WebPreferences usePreHTML5ParserQuirks]):
+        (-[WebPreferences setUsePreHTML5ParserQuirks:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChangedNotification:]): Update WebCore::Settings
+        with the value of WebKitUsePreHTML5ParserQuirks when a preference
+        changes.
+
 2010-09-20  Enrica Casucci  <enrica at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index fcb8368..17c8e4d 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -112,6 +112,7 @@
 #define WebKitCacheModelPreferenceKey @"WebKitCacheModelPreferenceKey"
 #define WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey @"WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey"
 #define WebKitEditingBehaviorPreferenceKey @"WebKitEditingBehavior"
+#define WebKitUsePreHTML5ParserQuirksKey @"WebKitUsePreHTML5ParserQuirks"
 
 // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is set
 // to NO, or has no value.  For compatibility with Mac OS X 10.4.6, deferred updates are OFF by
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index ac1bd95..87284bb 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -368,6 +368,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithBool:YES],  WebKitDNSPrefetchingEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitFullScreenEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitMemoryInfoEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitUsePreHTML5ParserQuirksKey,
         [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
         [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
         nil];
@@ -1341,6 +1342,16 @@ static NSString *classIBCreatorID = nil;
     [self _setIntegerValue:behavior forKey:WebKitEditingBehaviorPreferenceKey];
 }
 
+- (BOOL)usePreHTML5ParserQuirks
+{
+    return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey];
+}
+
+- (void)setUsePreHTML5ParserQuirks:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey];
+}
+
 - (void)didRemoveFromWebView
 {
     ASSERT(_private->numWebViews);
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 4c115c8..3bd5e24 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -217,4 +217,7 @@ extern NSString *WebPreferencesRemovedNotification;
 - (void)setFullScreenEnabled:(BOOL)flag;
 - (BOOL)fullScreenEnabled;
 
+- (void)setUsePreHTML5ParserQuirks:(BOOL)flag;
+- (BOOL)usePreHTML5ParserQuirks;
+
 @end
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index e022eb5..20f6e24 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1453,6 +1453,7 @@ static bool fastDocumentTeardownEnabled()
     settings->setFullScreenEnabled([preferences fullScreenEnabled]);
 #endif
     settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]);
+    settings->setUsePreHTML5ParserQuirks([preferences usePreHTML5ParserQuirks]);
 
     // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
     [WebApplicationCache setDefaultOriginQuota:[preferences applicationCacheDefaultOriginQuota]];
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6f96f29..202402a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-20  Andy Estes  <aestes at apple.com>
+
+        Reviewed by Adam Barth.
+
+        REGRESSION (HTML5 Parser): Pages broken due to <tag<tag> parsing changes
+        https://bugs.webkit.org/show_bug.cgi?id=40961
+
+        Implement WebKitUsePreHTML5ParserQuirks preference.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues): Reset WebKitUsePreHTML5ParserQuirks
+        to false after a test finishes.
+
 2010-09-20  Adam Roben  <aroben at apple.com>
 
         Windows build fix
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index ffcb18a..3732247 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -457,6 +457,7 @@ static void resetDefaultsToConsistentValues()
     [preferences setUsesPageCache:NO];
     [preferences setAcceleratedCompositingEnabled:YES];
     [preferences setWebGLEnabled:NO];
+    [preferences setUsePreHTML5ParserQuirks:NO];
 
     [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list