[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
abarth at webkit.org
abarth at webkit.org
Wed Dec 22 13:10:34 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 60a60f058d142c3d7b03ec4123e29f5c3f19671e
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 8 09:04:17 2010 +0000
2010-09-08 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
Create TextViewSourceParser
https://bugs.webkit.org/show_bug.cgi?id=45343
Rather than have the view source document set a flag on
HTMLViewSourceParser to indicate whether we're parsing a text document,
this patch creates a TextViewSourceParser for parsing text documents in
view-source mode. Like the TextDocumentParser, the
TextViewSourceParser implements this functionality by subclassing its
HTML counterpart.
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* html/HTMLViewSourceDocument.cpp:
(WebCore::HTMLViewSourceDocument::createParser):
* html/parser/HTMLViewSourceParser.cpp:
* html/parser/HTMLViewSourceParser.h:
(WebCore::HTMLViewSourceParser::tokenizer):
* html/parser/TextViewSourceParser.cpp: Added.
(WebCore::TextViewSourceParser::TextViewSourceParser):
(WebCore::TextViewSourceParser::~TextViewSourceParser):
* html/parser/TextViewSourceParser.h: Added.
(WebCore::TextViewSourceParser::create):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66959 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 8bd67d2..9e56fea 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -302,6 +302,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
html/parser/HTMLTreeBuilder.cpp \
html/parser/HTMLViewSourceParser.cpp \
html/parser/TextDocumentParser.cpp \
+ html/parser/TextViewSourceParser.cpp \
\
loader/Cache.cpp \
loader/CachedCSSStyleSheet.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 4249635..dbf6acb 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1048,6 +1048,7 @@ SET(WebCore_SOURCES
html/parser/HTMLTreeBuilder.cpp
html/parser/HTMLViewSourceParser.cpp
html/parser/TextDocumentParser.cpp
+ html/parser/TextViewSourceParser.cpp
inspector/ConsoleMessage.cpp
inspector/InjectedScript.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4cae6f1..496df26 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,37 @@
2010-09-08 Adam Barth <abarth at webkit.org>
+ Reviewed by Eric Seidel.
+
+ Create TextViewSourceParser
+ https://bugs.webkit.org/show_bug.cgi?id=45343
+
+ Rather than have the view source document set a flag on
+ HTMLViewSourceParser to indicate whether we're parsing a text document,
+ this patch creates a TextViewSourceParser for parsing text documents in
+ view-source mode. Like the TextDocumentParser, the
+ TextViewSourceParser implements this functionality by subclassing its
+ HTML counterpart.
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::createParser):
+ * html/parser/HTMLViewSourceParser.cpp:
+ * html/parser/HTMLViewSourceParser.h:
+ (WebCore::HTMLViewSourceParser::tokenizer):
+ * html/parser/TextViewSourceParser.cpp: Added.
+ (WebCore::TextViewSourceParser::TextViewSourceParser):
+ (WebCore::TextViewSourceParser::~TextViewSourceParser):
+ * html/parser/TextViewSourceParser.h: Added.
+ (WebCore::TextViewSourceParser::create):
+
+2010-09-08 Adam Barth <abarth at webkit.org>
+
Reviewed by Darin Adler.
Move HTMLInputStream to WebCore/html/parser
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c5602c2..0df8663 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1571,6 +1571,8 @@ webcore_sources += \
WebCore/html/parser/HTMLViewSourceParser.h \
WebCore/html/parser/TextDocumentParser.cpp \
WebCore/html/parser/TextDocumentParser.h \
+ WebCore/html/parser/TextViewSourceParser.cpp \
+ WebCore/html/parser/TextViewSourceParser.h \
WebCore/html/ValidityState.cpp \
WebCore/html/ValidityState.h \
WebCore/html/VoidCallback.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 1c823ee..3acc572 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1780,6 +1780,8 @@
'html/parser/HTMLViewSourceParser.h',
'html/parser/TextDocumentParser.cpp',
'html/parser/TextDocumentParser.h',
+ 'html/parser/TextViewSourceParser.cpp',
+ 'html/parser/TextViewSourceParser.h',
'inspector/InspectorClient.h',
'inspector/ConsoleMessage.cpp',
'inspector/ConsoleMessage.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 4c263ae..b26306b 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -752,6 +752,7 @@ SOURCES += \
html/parser/HTMLTreeBuilder.cpp \
html/parser/HTMLViewSourceParser.cpp \
html/parser/TextDocumentParser.cpp \
+ html/parser/TextViewSourceParser.cpp \
inspector/ConsoleMessage.cpp \
inspector/InjectedScript.cpp \
inspector/InjectedScriptHost.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 1e4dddf..c87cebf 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -41979,6 +41979,14 @@
RelativePath="..\html\parser\TextDocumentParser.h"
>
</File>
+ <File
+ RelativePath="..\html\parser\TextViewSourceParser.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\parser\TextViewSourceParser.h"
+ >
+ </File>
</Filter>
<File
RelativePath="..\html\StepRange.cpp"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index a4be8d4..f5155de 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2789,6 +2789,8 @@
97BC84831236FD93000C6161 /* TextDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC84811236FD93000C6161 /* TextDocumentParser.cpp */; };
97BC84841236FD93000C6161 /* TextDocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC84821236FD93000C6161 /* TextDocumentParser.h */; };
97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC849A12370A4B000C6161 /* HTMLInputStream.h */; };
+ 97BC84A412370DC8000C6161 /* TextViewSourceParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97BC84A212370DC7000C6161 /* TextViewSourceParser.cpp */; };
+ 97BC84A512370DC8000C6161 /* TextViewSourceParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 97BC84A312370DC8000C6161 /* TextViewSourceParser.h */; };
97C078501165D5BE003A32EF /* SuffixTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 97C0784F1165D5BE003A32EF /* SuffixTree.h */; };
97DCE20110807C750057D394 /* HistoryController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DCE1FF10807C750057D394 /* HistoryController.cpp */; };
97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8659,6 +8661,8 @@
97BC84811236FD93000C6161 /* TextDocumentParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextDocumentParser.cpp; path = parser/TextDocumentParser.cpp; sourceTree = "<group>"; };
97BC84821236FD93000C6161 /* TextDocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextDocumentParser.h; path = parser/TextDocumentParser.h; sourceTree = "<group>"; };
97BC849A12370A4B000C6161 /* HTMLInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLInputStream.h; path = parser/HTMLInputStream.h; sourceTree = "<group>"; };
+ 97BC84A212370DC7000C6161 /* TextViewSourceParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextViewSourceParser.cpp; path = parser/TextViewSourceParser.cpp; sourceTree = "<group>"; };
+ 97BC84A312370DC8000C6161 /* TextViewSourceParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextViewSourceParser.h; path = parser/TextViewSourceParser.h; sourceTree = "<group>"; };
97C0784F1165D5BE003A32EF /* SuffixTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuffixTree.h; sourceTree = "<group>"; };
97C1F552122855CB00EDE616 /* HTMLToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HTMLToken.h; path = parser/HTMLToken.h; sourceTree = "<group>"; };
97DCE1FF10807C750057D394 /* HistoryController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryController.cpp; sourceTree = "<group>"; };
@@ -14442,6 +14446,8 @@
977B3861122883E900B81FF8 /* HTMLViewSourceParser.h */,
97BC84811236FD93000C6161 /* TextDocumentParser.cpp */,
97BC84821236FD93000C6161 /* TextDocumentParser.h */,
+ 97BC84A212370DC7000C6161 /* TextViewSourceParser.cpp */,
+ 97BC84A312370DC8000C6161 /* TextViewSourceParser.h */,
);
name = parser;
sourceTree = "<group>";
@@ -20450,6 +20456,7 @@
BCDD454E1236C95C009A7985 /* ColumnInfo.h in Headers */,
97BC84841236FD93000C6161 /* TextDocumentParser.h in Headers */,
97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */,
+ 97BC84A512370DC8000C6161 /* TextViewSourceParser.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -22915,6 +22922,7 @@
898785F0122E1E87003AABDA /* JSFileException.cpp in Sources */,
898785F4122E1EAC003AABDA /* JSFileReaderSync.cpp in Sources */,
97BC84831236FD93000C6161 /* TextDocumentParser.cpp in Sources */,
+ 97BC84A412370DC8000C6161 /* TextViewSourceParser.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp
index cad8134..f7217eb 100644
--- a/WebCore/html/HTMLViewSourceDocument.cpp
+++ b/WebCore/html/HTMLViewSourceDocument.cpp
@@ -41,7 +41,7 @@
#include "HTMLViewSourceParser.h"
#include "SegmentedString.h"
#include "Text.h"
-#include "TextDocument.h"
+#include "TextViewSourceParser.h"
namespace WebCore {
@@ -58,17 +58,14 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, co
PassRefPtr<DocumentParser> HTMLViewSourceDocument::createParser()
{
- RefPtr<HTMLViewSourceParser> parser = HTMLViewSourceParser::create(this);
- // Use HTMLDocumentParser if applicable, otherwise use TextDocumentParser.
if (m_type == "text/html" || m_type == "application/xhtml+xml" || m_type == "image/svg+xml" || DOMImplementation::isXMLMIMEType(m_type)
#if ENABLE(XHTMLMP)
|| m_type == "application/vnd.wap.xhtml+xml"
#endif
)
- return parser.release();
+ return HTMLViewSourceParser::create(this);
- parser->forcePlaintext();
- return parser.release();
+ return TextViewSourceParser::create(this);
}
void HTMLViewSourceDocument::createContainingTable()
diff --git a/WebCore/html/parser/HTMLViewSourceParser.cpp b/WebCore/html/parser/HTMLViewSourceParser.cpp
index 4aac955..8a7984d 100644
--- a/WebCore/html/parser/HTMLViewSourceParser.cpp
+++ b/WebCore/html/parser/HTMLViewSourceParser.cpp
@@ -42,11 +42,6 @@ HTMLViewSourceParser::~HTMLViewSourceParser()
{
}
-void HTMLViewSourceParser::forcePlaintext()
-{
- m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
-}
-
void HTMLViewSourceParser::insert(const SegmentedString&)
{
ASSERT_NOT_REACHED();
diff --git a/WebCore/html/parser/HTMLViewSourceParser.h b/WebCore/html/parser/HTMLViewSourceParser.h
index 28f05ec..abe55b4 100644
--- a/WebCore/html/parser/HTMLViewSourceParser.h
+++ b/WebCore/html/parser/HTMLViewSourceParser.h
@@ -50,11 +50,12 @@ public:
}
virtual ~HTMLViewSourceParser();
- void forcePlaintext();
+protected:
+ explicit HTMLViewSourceParser(HTMLViewSourceDocument*);
-private:
- HTMLViewSourceParser(HTMLViewSourceDocument*);
+ HTMLTokenizer* tokenizer() const { return m_tokenizer.get(); }
+private:
// DocumentParser
virtual void insert(const SegmentedString&);
virtual void append(const SegmentedString&);
diff --git a/WebCore/html/parser/TextViewSourceParser.cpp b/WebCore/html/parser/TextViewSourceParser.cpp
new file mode 100644
index 0000000..d7e6e3d
--- /dev/null
+++ b/WebCore/html/parser/TextViewSourceParser.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TextViewSourceParser.h"
+
+#include "HTMLTokenizer.h"
+
+namespace WebCore {
+
+TextViewSourceParser::TextViewSourceParser(HTMLViewSourceDocument* document)
+ : HTMLViewSourceParser(document)
+{
+ tokenizer()->setState(HTMLTokenizer::PLAINTEXTState);
+}
+
+TextViewSourceParser::~TextViewSourceParser()
+{
+}
+
+}
diff --git a/WebCore/html/parser/TextViewSourceParser.h b/WebCore/html/parser/TextViewSourceParser.h
new file mode 100644
index 0000000..e4170ed
--- /dev/null
+++ b/WebCore/html/parser/TextViewSourceParser.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextViewSourceParser_h
+#define TextViewSourceParser_h
+
+#include "HTMLViewSourceParser.h"
+
+namespace WebCore {
+
+class TextViewSourceParser : public HTMLViewSourceParser {
+public:
+ static PassRefPtr<TextViewSourceParser> create(HTMLViewSourceDocument* document)
+ {
+ return adoptRef(new TextViewSourceParser(document));
+ }
+ virtual ~TextViewSourceParser();
+
+private:
+ explicit TextViewSourceParser(HTMLViewSourceDocument*);
+};
+
+}
+
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list