WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 May 2006 19:03:20 +0000 (19:03 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 May 2006 19:03:20 +0000 (19:03 +0000)
2006-05-09  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
        WebCore should handle text files

        * WebCore.xcodeproj/project.pbxproj:
        Add TextDocument.cpp and TextDocument.h

        * bridge/mac/WebCoreFrameBridge.mm:
        (+[WebCoreFrameBridge supportedMIMETypes]):
        Add text types here.

        * dom/DOMImplementation.cpp:
        (WebCore::DOMImplementation::createTextDocument):
        (WebCore::DOMImplementation::isTextMIMEType):
        * dom/DOMImplementation.h:
        New functions for creating a TextDocument and determining if a
        mime type is a text MIME type.

        * loader/TextDocument.cpp: Added.
        (WebCore::TextTokenizer::TextTokenizer):
        (WebCore::TextTokenizer::write):
        (WebCore::TextTokenizer::finish):
        (WebCore::TextTokenizer::isWaitingForScripts):
        Special tokenizer which will put text inside a <pre> tag
        in a document.

        (WebCore::TextDocument::TextDocument):
        (WebCore::TextDocument::createTokenizer):
        Create a TextTokenizer.

        * loader/TextDocument.h: Added.

        * page/Frame.cpp:
        (WebCore::Frame::begin):
        Create a TextDocument if the MIME type is of type text.

WebKit:

2006-05-09  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
        WebCore should handle text files

        * WebKit.exp:
        Remove WebTextView.

        * WebKit.xcodeproj/project.pbxproj:
        Get rid of WebTextView and WebTextRepresentation.

        * WebView/WebDataSource.m:
        (+[WebDataSource _repTypesAllowImageTypeOmission:]):
        * WebView/WebFrameView.m:
        (+[WebFrameView _viewTypesAllowImageTypeOmission:]):
        * WebView/WebHTMLView.m:
        The text MIME types are now handled by WebHTMLView.

        (+[WebHTMLView unsupportedTextMIMETypes]):
        New function, moved here from WebTextView.

        * WebView/WebHTMLViewPrivate.h:
        * WebView/WebTextRepresentation.h: Removed.
        * WebView/WebTextRepresentation.m: Removed.
        * WebView/WebTextView.h: Removed.
        * WebView/WebTextView.m: Removed.

        * WebView/WebView.m:
        (+[WebView _viewClass:andRepresentationClass:forMIMEType:]):
        Now special-case WebHTMLView instead of WebTextView for MIME types
        that shouldn't be shown.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14258 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/dom/DOMImplementation.cpp
WebCore/dom/DOMImplementation.h
WebCore/loader/TextDocument.cpp [new file with mode: 0644]
WebCore/loader/TextDocument.h [new file with mode: 0644]
WebCore/page/Frame.cpp
WebKit/ChangeLog
WebKit/WebKit.exp
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebDataSource.m
WebKit/WebView/WebFrameView.m
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebHTMLViewPrivate.h
WebKit/WebView/WebTextRepresentation.h [deleted file]
WebKit/WebView/WebTextRepresentation.m [deleted file]
WebKit/WebView/WebTextView.h [deleted file]
WebKit/WebView/WebTextView.m [deleted file]
WebKit/WebView/WebView.m

index a786f1d8ee7a0e73b278eeee8ca6e599f70856d8..34a90f264a6a63deec04376319f1e35b57fbc064 100644 (file)
@@ -1,3 +1,42 @@
+2006-05-09  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
+        WebCore should handle text files
+        
+        * WebCore.xcodeproj/project.pbxproj:
+        Add TextDocument.cpp and TextDocument.h
+        
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (+[WebCoreFrameBridge supportedMIMETypes]):
+        Add text types here.
+        
+        * dom/DOMImplementation.cpp:
+        (WebCore::DOMImplementation::createTextDocument):
+        (WebCore::DOMImplementation::isTextMIMEType):
+        * dom/DOMImplementation.h:
+        New functions for creating a TextDocument and determining if a 
+        mime type is a text MIME type.
+        
+        * loader/TextDocument.cpp: Added.
+        (WebCore::TextTokenizer::TextTokenizer):
+        (WebCore::TextTokenizer::write):
+        (WebCore::TextTokenizer::finish):
+        (WebCore::TextTokenizer::isWaitingForScripts):
+        Special tokenizer which will put text inside a <pre> tag
+        in a document.
+        
+        (WebCore::TextDocument::TextDocument):        
+        (WebCore::TextDocument::createTokenizer):
+        Create a TextTokenizer.
+        
+        * loader/TextDocument.h: Added.
+        
+        * page/Frame.cpp:
+        (WebCore::Frame::begin):
+        Create a TextDocument if the MIME type is of type text.
+
 2006-05-09  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Anders.
index adcc429a695a19b58962a995d43648340ca0f822..7209c57e14e06914ffd7e840de75fc6931f0c14f 100644 (file)
@@ -55,6 +55,8 @@
                1A5D938F0A0B9ACC00B1121F /* XPathParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5D938D0A0B9ACC00B1121F /* XPathParser.h */; };
                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6931740A0CD4FA00C127FE /* XPathValue.h */; };
                1A6931770A0CD4FA00C127FE /* XPathValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6931750A0CD4FA00C127FE /* XPathValue.cpp */; };
+               1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6937FF0A11100A00C127FE /* TextDocument.cpp */; };
+               1A6938020A11100A00C127FE /* TextDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6938000A11100A00C127FE /* TextDocument.h */; };
                1A7629830A0740A000989F5B /* XPathExpressionNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7629590A0740A000989F5B /* XPathExpressionNode.cpp */; };
                1A7629840A0740A000989F5B /* XPathExpressionNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A76295A0A0740A000989F5B /* XPathExpressionNode.h */; };
                1A76298A0A0740A000989F5B /* XPathFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7629610A0740A000989F5B /* XPathFunctions.cpp */; };
                1A5D938D0A0B9ACC00B1121F /* XPathParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathParser.h; sourceTree = "<group>"; };
                1A6931740A0CD4FA00C127FE /* XPathValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathValue.h; sourceTree = "<group>"; };
                1A6931750A0CD4FA00C127FE /* XPathValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathValue.cpp; sourceTree = "<group>"; };
+               1A6937FF0A11100A00C127FE /* TextDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextDocument.cpp; sourceTree = "<group>"; };
+               1A6938000A11100A00C127FE /* TextDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextDocument.h; sourceTree = "<group>"; };
                1A7629590A0740A000989F5B /* XPathExpressionNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathExpressionNode.cpp; sourceTree = "<group>"; };
                1A76295A0A0740A000989F5B /* XPathExpressionNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathExpressionNode.h; sourceTree = "<group>"; };
                1A7629610A0740A000989F5B /* XPathFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathFunctions.cpp; sourceTree = "<group>"; };
                                BCB16C140979C3BD00467741 /* loader.h */,
                                BCB16C150979C3BD00467741 /* Request.cpp */,
                                BCB16C160979C3BD00467741 /* Request.h */,
+                               1A6937FF0A11100A00C127FE /* TextDocument.cpp */,
+                               1A6938000A11100A00C127FE /* TextDocument.h */,
                        );
                        path = loader;
                        sourceTree = "<group>";
                                1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */,
                                1A5D938F0A0B9ACC00B1121F /* XPathParser.h in Headers */,
                                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */,
+                               1A6938020A11100A00C127FE /* TextDocument.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                936BDD1D0A031AEB004DF4AB /* GraphicsContextCG.cpp in Sources */,
                                BCCD13200A0C0030001AFA8B /* FontData.mm in Sources */,
                                1A6931770A0CD4FA00C127FE /* XPathValue.cpp in Sources */,
+                               1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index cc88b2c7321b107a660e89f69e2af2e0c66c76e0..1095f6e3771542407c32632154131285176e84da 100644 (file)
@@ -365,6 +365,8 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
         @"text/html",
         @"text/xml",
         @"text/xsl",
+        @"text/",
+        @"application/x-javascript",
         @"application/xml",
         @"application/xhtml+xml",
         @"application/rss+xml",
index 0aebf0da103dec18ed9042098a41ddeb9d0e1be1..8a2281c5a68a6596e7ac0486998c1d73126a395e 100644 (file)
@@ -31,6 +31,7 @@
 #include "css_stylesheetimpl.h"
 #include "HTMLDocument.h"
 #include "RegularExpression.h"
+#include "TextDocument.h"
 
 namespace WebCore {
 
@@ -174,6 +175,11 @@ PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(FrameView* v)
     return new HTMLDocument(this, v);
 }
 
+PassRefPtr<TextDocument> DOMImplementation::createTextDocument(FrameView *v)
+{
+    return new TextDocument(this, v);
+}
+
 DOMImplementation* DOMImplementation::instance()
 {
     static RefPtr<DOMImplementation> i = new DOMImplementation;
@@ -191,6 +197,16 @@ bool DOMImplementation::isXMLMIMEType(const String& mimeType)
     return false;
 }
 
+bool DOMImplementation::isTextMIMEType(const String& mimeType)
+{
+    if (mimeType == "application/x-javascript" ||
+        (mimeType.startsWith("text/") && mimeType != "text/html" &&
+         mimeType != "text/xml" && mimeType != "text/xsl"))
+        return true;
+    
+    return false;
+}
+
 PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
 {
     RefPtr<HTMLDocument> d = createHTMLDocument(0 /* ### create a view otherwise it doesn't work */);
index a8c2f6b9a15dde4e1d067d6ae019d451678b31b4..4dc71d1e3a1c769ce03970532894428f8610ae40 100644 (file)
@@ -37,6 +37,7 @@ class DocumentType;
 class FrameView;
 class HTMLDocument;
 class String;
+class TextDocument;
 
 typedef int ExceptionCode;
 
@@ -58,12 +59,14 @@ public:
     // Other methods (not part of DOM)
     PassRefPtr<Document> createDocument(FrameView* = 0);
     PassRefPtr<HTMLDocument> createHTMLDocument(FrameView* = 0);
+    PassRefPtr<TextDocument> createTextDocument(FrameView* v = 0);
 
     // Returns the static instance of this class - only one instance of this class should
     // ever be present, and is used as a factory method for creating Document objects
     static DOMImplementation* instance();
 
     static bool isXMLMIMEType(const String& mimeType);
+    static bool isTextMIMEType(const String& mimeType);
 };
 
 } //namespace
diff --git a/WebCore/loader/TextDocument.cpp b/WebCore/loader/TextDocument.cpp
new file mode 100644 (file)
index 0000000..6b99195
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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 COMPUTER, 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 COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 "TextDocument.h"
+
+#include "Element.h"
+#include "HTMLNames.h"
+#include "SegmentedString.h"
+#include "Text.h"
+#include "xml_tokenizer.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+    
+class TextTokenizer : public Tokenizer {
+public:
+    TextTokenizer(Document* doc) : m_doc(doc), m_preElement(0) { }
+
+    virtual bool write(const SegmentedString&, bool appendData);
+    virtual void finish();
+    virtual bool isWaitingForScripts() const;
+    
+private:
+    Document* m_doc;
+    Element* m_preElement;
+};
+
+bool TextTokenizer::write(const SegmentedString& s, bool appendData)
+{
+    ExceptionCode ec;
+    
+    if (!m_preElement) {
+        RefPtr<Element> rootElement = m_doc->createElementNS(xhtmlNamespaceURI, "html", ec);
+        m_doc->appendChild(rootElement, ec);
+
+        RefPtr<Element> body = m_doc->createElementNS(xhtmlNamespaceURI, "body", ec);
+        rootElement->appendChild(body, ec);
+
+        RefPtr<Element> preElement = m_doc->createElementNS(xhtmlNamespaceURI, "pre", ec);
+        body->appendChild(m_preElement, ec);
+        
+        m_preElement = preElement.get();
+    } 
+    
+    RefPtr<Text> text = m_doc->createTextNode(s.toString());
+    m_preElement->appendChild(text, ec);
+
+    return false;
+}
+
+void TextTokenizer::finish()
+{
+    m_preElement = 0;
+    
+    m_doc->finishedParsing();
+}
+
+bool TextTokenizer::isWaitingForScripts() const
+{
+    // A text document is never waiting for scripts
+    return false;
+}
+
+TextDocument::TextDocument(DOMImplementation* implementation, FrameView* v)
+    : Document(implementation, v)
+{
+}
+
+Tokenizer* TextDocument::createTokenizer()
+{
+    return new TextTokenizer(this);
+}
+
+}
diff --git a/WebCore/loader/TextDocument.h b/WebCore/loader/TextDocument.h
new file mode 100644 (file)
index 0000000..8ca3ede
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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 COMPUTER, 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 COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * 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 TextDocument_h
+#define TextDocument_h
+
+#include "Document.h"
+
+namespace WebCore {
+
+class DOMImplementation;
+class FrameView;
+
+class TextDocument : public Document
+{
+public:
+    TextDocument(DOMImplementation*, FrameView* = 0);
+    
+    virtual Tokenizer* createTokenizer();
+};
+
+}
+
+#endif // TextDocument_h
index a110573501a7f29bfa34a8d94d99dd483c24d7c0..33ec6c52e37c7b8e60dfbbbc5c921767598d24ac 100644 (file)
@@ -53,6 +53,7 @@
 #include "RenderCanvas.h"
 #include "RenderTheme.h"
 #include "SegmentedString.h"
+#include "TextDocument.h"
 #include "TextIterator.h"
 #include "TransferJob.h"
 #include "TypingCommand.h"
@@ -589,6 +590,8 @@ void Frame::begin(const KURL& url)
 
   if (DOMImplementation::isXMLMIMEType(d->m_request.m_responseMIMEType))
     d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
+  else if (DOMImplementation::isTextMIMEType(d->m_request.m_responseMIMEType))
+    d->m_doc = DOMImplementation::instance()->createTextDocument(d->m_view.get());
   else
     d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
 
index 903e78c6bc581e6277fa27533364a16e3b5cfdb2..346e41828db2c75fa7ac6d02f44eb00a6a38b680 100644 (file)
@@ -1,3 +1,37 @@
+2006-05-09  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
+        WebCore should handle text files
+
+        * WebKit.exp:
+        Remove WebTextView.
+        
+        * WebKit.xcodeproj/project.pbxproj:
+        Get rid of WebTextView and WebTextRepresentation.
+        
+        * WebView/WebDataSource.m:
+        (+[WebDataSource _repTypesAllowImageTypeOmission:]):
+        * WebView/WebFrameView.m:
+        (+[WebFrameView _viewTypesAllowImageTypeOmission:]):
+        * WebView/WebHTMLView.m:
+        The text MIME types are now handled by WebHTMLView.
+        
+        (+[WebHTMLView unsupportedTextMIMETypes]):
+        New function, moved here from WebTextView.
+        
+        * WebView/WebHTMLViewPrivate.h:
+        * WebView/WebTextRepresentation.h: Removed.
+        * WebView/WebTextRepresentation.m: Removed.
+        * WebView/WebTextView.h: Removed.
+        * WebView/WebTextView.m: Removed.
+        
+        * WebView/WebView.m:
+        (+[WebView _viewClass:andRepresentationClass:forMIMEType:]):
+        Now special-case WebHTMLView instead of WebTextView for MIME types
+        that shouldn't be shown.
+
 2006-05-09  Maciej Stachowiak  <mjs@apple.com>
 
         Rubber stamped by Anders.
index a2d8d23d3cec8c42804276ee7759b8069e0f0c67..9bc73ed432a91da55bbf9b56ad0826bef5dfe74a 100644 (file)
@@ -23,7 +23,6 @@
 .objc_class_name_WebRenderNode
 .objc_class_name_WebResource
 .objc_class_name_WebStringTruncator
-.objc_class_name_WebTextView
 .objc_class_name_WebURLsWithTitles
 .objc_class_name_WebView
 _WebActionButtonKey
index eb2d3ce527aa26aa6802d7b4a082d9233f5f86a1..67f32821d909de832d93cfd30dde5191c018fa11 100644 (file)
                9398105E0824BF01008DF038 /* WebPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9398105F0824BF01008DF038 /* WebRenderNode.h in Headers */ = {isa = PBXBuildFile; fileRef = F5F81C3902B67C26018635CA /* WebRenderNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                939810600824BF01008DF038 /* WebResourceLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               939810610824BF01008DF038 /* WebTextRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */; };
-               939810620824BF01008DF038 /* WebTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081DA802B6D4E40ACA2ACA /* WebTextView.h */; settings = {ATTRIBUTES = (); }; };
                939810630824BF01008DF038 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 516F296F03A6C45A00CA2D3A /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */; };
                939810650824BF01008DF038 /* CarbonWindowAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = F7EBEE9003F9DBA103CA0DE6 /* CarbonWindowAdapter.h */; };
                939810F70824BF01008DF038 /* WebMainResourceLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = F5D538EC02441FDD01A80181 /* WebMainResourceLoader.m */; };
                939810F80824BF01008DF038 /* WebPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AEBB3D024A527601C1A526 /* WebPreferences.m */; };
                939810F90824BF01008DF038 /* WebRenderNode.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F81C3A02B67C26018635CA /* WebRenderNode.m */; };
-               939810FA0824BF01008DF038 /* WebTextRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */; };
-               939810FB0824BF01008DF038 /* WebTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081DA902B6D4E40ACA2ACA /* WebTextView.m */; };
                939810FC0824BF01008DF038 /* WebFormDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D81DAB303EB0B2D00A80166 /* WebFormDelegate.m */; };
                939810FD0824BF01008DF038 /* CarbonWindowAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEE9103F9DBA103CA0DE6 /* CarbonWindowAdapter.m */; };
                939810FE0824BF01008DF038 /* CarbonWindowContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEE9303F9DBA103CA0DE6 /* CarbonWindowContentView.m */; };
                35081D9902B6D4D80ACA2ACA /* WebImageRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081D9A02B6D4D80ACA2ACA /* WebImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebImageView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081D9B02B6D4D80ACA2ACA /* WebImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebTextRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebTextRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               35081DA802B6D4E40ACA2ACA /* WebTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebTextView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               35081DA902B6D4E40ACA2ACA /* WebTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebTextView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35081DAE02B6D4F50ACA2ACA /* WebDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                35F3577F0198AAB80ACA1520 /* English */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                3944606B020F50ED0ECA1767 /* WebDynamicScrollBarsView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDynamicScrollBarsView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                F52CA6BD02DF9D0F018635CA /* HTML */,
                                F52CA6BE02DF9D49018635CA /* Image */,
                                51E94C0706C02CA300A9B09E /* PDF */,
-                               F52CA6BF02DF9D4D018635CA /* Text */,
                                8373435A0624EE0D00F3B289 /* WebArchive.h */,
                                8373435B0624EE0D00F3B289 /* WebArchive.m */,
                                51F6866D0366057300CA2D3A /* WebLoader.m */,
                        name = Image;
                        sourceTree = "<group>";
                };
-               F52CA6BF02DF9D4D018635CA /* Text */ = {
-                       isa = PBXGroup;
-                       children = (
-                               35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */,
-                               35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */,
-                               35081DA802B6D4E40ACA2ACA /* WebTextView.h */,
-                               35081DA902B6D4E40ACA2ACA /* WebTextView.m */,
-                       );
-                       name = Text;
-                       sourceTree = "<group>";
-               };
                F52CA6C002DF9D78018635CA /* Download */ = {
                        isa = PBXGroup;
                        children = (
                                9398105E0824BF01008DF038 /* WebPreferencesPrivate.h in Headers */,
                                9398105F0824BF01008DF038 /* WebRenderNode.h in Headers */,
                                939810600824BF01008DF038 /* WebResourceLoadDelegate.h in Headers */,
-                               939810610824BF01008DF038 /* WebTextRepresentation.h in Headers */,
-                               939810620824BF01008DF038 /* WebTextView.h in Headers */,
                                939810630824BF01008DF038 /* WebHistoryItemPrivate.h in Headers */,
                                939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */,
                                939810650824BF01008DF038 /* CarbonWindowAdapter.h in Headers */,
                                939810F70824BF01008DF038 /* WebMainResourceLoader.m in Sources */,
                                939810F80824BF01008DF038 /* WebPreferences.m in Sources */,
                                939810F90824BF01008DF038 /* WebRenderNode.m in Sources */,
-                               939810FA0824BF01008DF038 /* WebTextRepresentation.m in Sources */,
-                               939810FB0824BF01008DF038 /* WebTextView.m in Sources */,
                                939810FC0824BF01008DF038 /* WebFormDelegate.m in Sources */,
                                939810FD0824BF01008DF038 /* CarbonWindowAdapter.m in Sources */,
                                939810FE0824BF01008DF038 /* CarbonWindowContentView.m in Sources */,
index 33764d78788d2698e5d4c185e230f4724c22b90b..7b84820da366063b8d7d40bbc1191a7e16e4c1c0 100644 (file)
@@ -59,7 +59,6 @@
 #import <WebKit/WebPDFRepresentation.h>
 #import <WebKit/WebResourceLoadDelegate.h>
 #import <WebKit/WebResourcePrivate.h>
-#import <WebKit/WebTextRepresentation.h>
 #import <WebKit/WebUnarchivingState.h>
 #import <WebKit/WebViewInternal.h>
 #import <WebKitSystemInterface.h>
@@ -568,7 +567,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class,
     if (!repTypes) {
         repTypes = [[NSMutableDictionary alloc] init];
         addTypesFromClass(repTypes, [WebHTMLRepresentation class], [WebHTMLRepresentation supportedMIMETypes]);
-        addTypesFromClass(repTypes, [WebTextRepresentation class], [WebTextRepresentation supportedMIMETypes]);
 
         // Since this is a "secret default" we don't both registering it.
         BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
index c5894fa318f2285eef4dc94e2b83ed39d5a365b0..c3da9401cf609e50e4ae36ea4cce422f7403d2d1 100644 (file)
@@ -49,7 +49,6 @@
 #import "WebNSViewExtras.h"
 #import "WebPDFView.h"
 #import "WebSystemInterface.h"
-#import "WebTextView.h"
 #import "WebViewFactory.h"
 #import "WebViewInternal.h"
 #import "WebViewPrivate.h"
@@ -258,7 +257,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class class,
     if (!viewTypes) {
         viewTypes = [[NSMutableDictionary alloc] init];
         addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedMIMETypes]);
-        addTypesFromClass(viewTypes, [WebTextView class], [WebTextView supportedMIMETypes]);
 
         // Since this is a "secret default" we don't both registering it.
         BOOL omitPDFSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
index 4bb8ea4e14a9d39bbb0dfb8be17bc2f68f971a55..ce193f00ebf9ae3144655599dae97ab2284d4599 100644 (file)
@@ -690,6 +690,24 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
     return [WebHTMLRepresentation supportedMIMETypes];
 }
 
++ (NSArray *)unsupportedTextMIMETypes
+{
+    return [NSArray arrayWithObjects:
+        @"text/calendar",       // iCal
+        @"text/x-calendar",
+        @"text/x-vcalendar",
+        @"text/vcalendar",
+        @"text/vcard",          // vCard
+        @"text/x-vcard",
+        @"text/directory",
+        @"text/ldif",           // Netscape Address Book
+        @"text/qif",            // Quicken
+        @"text/x-qif",
+        @"text/x-csv",          // CSV (for Address Book and Microsoft Outlook)
+        @"text/x-vcf",          // vCard type used in Sun affinity app
+        nil];
+}
+
 + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent
 {
     NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
index fd4b156f0b0540c6ec27a3646491cbf8afcad97a..aa8d8e7efcb1a0522e6a0532fee99a4b76350e9a 100644 (file)
@@ -40,6 +40,7 @@
 
 - (void)_reset;
 + (NSArray *)supportedMIMETypes;
++ (NSArray *)unsupportedTextMIMETypes;
 
 // Modifier (flagsChanged) tracking SPI
 + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
diff --git a/WebKit/WebView/WebTextRepresentation.h b/WebKit/WebView/WebTextRepresentation.h
deleted file mode 100644 (file)
index b1b6de4..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import <Foundation/Foundation.h>
-
-@protocol WebDocumentRepresentation;
-
-@interface WebTextRepresentation : NSObject <WebDocumentRepresentation>
-{
-    NSString *RTFSource;
-    BOOL hasRTFSource;
-}
-+ (NSArray *)supportedMIMETypes;
-@end
diff --git a/WebKit/WebView/WebTextRepresentation.m b/WebKit/WebView/WebTextRepresentation.m
deleted file mode 100644 (file)
index e452a4b..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import "WebTextRepresentation.h"
-
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebFrame.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebTextView.h>
-
-#import <Foundation/NSURLResponse.h>
-#import <JavaScriptCore/Assertions.h>
-
-@implementation WebTextRepresentation
-
-+ (NSArray *)supportedMIMETypes
-{
-    return [NSArray arrayWithObjects:
-            @"text/",
-            @"application/x-javascript",
-            nil];
-}
-
-- (void)dealloc
-{
-    [RTFSource release];
-    [super dealloc];
-}
-
-- (void)setDataSource:(WebDataSource *)dataSource
-{
-    // FIXME: This is broken. [dataSource data] is incomplete at this point.
-    hasRTFSource = [[[dataSource response] MIMEType] isEqualToString:@"text/rtf"];
-    if (hasRTFSource){
-        RTFSource = [[dataSource _stringWithData: [dataSource data]] retain];
-    }
-}
-
-- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource
-{
-    WebTextView *view = (WebTextView *)[[[dataSource webFrame] frameView] documentView];
-    ASSERT([view isKindOfClass:[WebTextView class]]);
-    [view appendReceivedData:data fromDataSource:dataSource];
-}
-
-- (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource
-{
-
-}
-
-- (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
-{
-    WebTextView *view = (WebTextView *)[[[dataSource webFrame] frameView] documentView];
-    ASSERT([view isKindOfClass:[WebTextView class]]);
-    [view flushReceivedData];
-}
-
-- (BOOL)canProvideDocumentSource
-{
-    return hasRTFSource;
-}
-
-- (NSString *)documentSource
-{
-    return RTFSource;
-}
-
-- (NSString *)title
-{
-    return nil;
-}
-
-
-@end
diff --git a/WebKit/WebView/WebTextView.h b/WebKit/WebView/WebTextView.h
deleted file mode 100644 (file)
index 41e959f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import <WebKit/WebDocumentInternal.h>
-#import <WebKit/WebSearchableTextView.h>
-
-@class WebDataSource;
-@class WebCoreTextDecoder;
-
-@interface WebTextView : WebSearchableTextView <WebDocumentView, WebDocumentElement>
-{
-    float _textSizeMultiplier;
-    WebCoreTextDecoder *_decoder;
-    WebDataSource *_dataSource;
-}
-
-+ (NSArray *)supportedMIMETypes;
-+ (NSArray *)unsupportedTextMIMETypes;
-- (void)setFixedWidthFont;
-
-- (void)appendReceivedData:(NSData *)data fromDataSource:(WebDataSource *)dataSource;
-- (void)flushReceivedData;
-
-@end
diff --git a/WebKit/WebView/WebTextView.m b/WebKit/WebView/WebTextView.m
deleted file mode 100644 (file)
index 335b1b4..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, 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. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
- */
-
-#import <WebKit/WebTextView.h>
-
-#import <JavaScriptCore/Assertions.h>
-#import <WebKit/WebFrameBridge.h>
-#import <WebKit/WebDataSourcePrivate.h>
-#import <WebKit/WebDocumentInternal.h>
-#import <WebKit/WebFramePrivate.h>
-#import <WebKit/WebFrameInternal.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebNSObjectExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSViewExtras.h>
-#import <WebKit/WebPreferences.h>
-#import <WebKit/WebViewInternal.h>
-#import <WebKit/WebViewPrivate.h>
-#import <WebKit/WebTextRepresentation.h>
-
-#import <WebCore/WebCoreTextDecoder.h>
-#import <WebCore/WebCoreTextRenderer.h>
-
-#import <Foundation/NSURLResponse.h>
-
-@interface NSTextView (AppKitSecret)
-+ (NSURL *)_URLForString:(NSString *)string;
-@end
-
-@interface WebTextView (ForwardDeclarations)
-- (void)_updateTextSizeMultiplier;
-@end
-
-@interface WebTextView (TextSizing) <_WebDocumentTextSizing>
-@end
-
-@implementation WebTextView
-
-+ (NSArray *)supportedMIMETypes
-{
-    return [WebTextRepresentation supportedMIMETypes];
-}
-
-+ (NSArray *)unsupportedTextMIMETypes
-{
-    return [NSArray arrayWithObjects:
-        @"text/calendar",       // iCal
-        @"text/x-calendar",
-        @"text/x-vcalendar",
-        @"text/vcalendar",
-        @"text/vcard",          // vCard
-        @"text/x-vcard",
-        @"text/directory",
-        @"text/ldif",           // Netscape Address Book
-        @"text/qif",            // Quicken
-        @"text/x-qif",
-        @"text/x-csv",          // CSV (for Address Book and Microsoft Outlook)
-        @"text/x-vcf",          // vCard type used in Sun affinity app
-        nil];
-}
-
-- (id)initWithFrame:(NSRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        _textSizeMultiplier = 1.0;
-        [self setAutoresizingMask:NSViewWidthSizable];
-        [self setEditable:NO];
-        [[NSNotificationCenter defaultCenter] addObserver:self
-                                                 selector:@selector(defaultsChanged:)
-                                                     name:WebPreferencesChangedNotification
-                                                   object:nil];
-    }
-    return self;
-}
-
-- (void)dealloc
-{
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [_decoder release];
-    [super dealloc];
-}
-
-- (void)finalize
-{
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-    [super finalize];
-}
-
-- (float)_textSizeMultiplierFromWebView
-{
-    // Note that we are not guaranteed to be the subview of a WebView at any given time.
-    WebView *webView = [_dataSource _webView];
-    return webView ? [webView textSizeMultiplier] : 1.0;
-}
-
-- (WebPreferences *)_preferences
-{
-    // Handle nil result because we might not be in a WebView at any given time.
-    WebPreferences *preferences = [[_dataSource _webView] preferences];
-    if (preferences == nil) {
-        preferences = [WebPreferences standardPreferences];
-    }
-    return preferences;
-}
-
-
-- (void)setFixedWidthFont
-{
-    WebPreferences *preferences = [self _preferences];
-    NSFont* font = WebCoreFindFont([preferences fixedFontFamily], 0, [preferences defaultFixedFontSize] * _textSizeMultiplier);
-    if (font)
-        [self setFont:font];
-}
-
-// This method was borrowed from Mail and changed to use ratios rather than deltas.
-// Also, I removed the isEditable clause since RTF displayed in WebKit is never editable.
-- (void)_adjustRichTextFontSizeByRatio:(float)ratio 
-{
-    NSTextStorage *storage = [self textStorage];
-    NSRange remainingRange = NSMakeRange(0, [storage length]);
-    
-    while (remainingRange.length > 0) {
-        NSRange effectiveRange;
-        NSFont *font = [storage attribute:NSFontAttributeName atIndex:remainingRange.location longestEffectiveRange:&effectiveRange inRange:remainingRange];
-        
-        if (font) {
-            font = [[NSFontManager sharedFontManager] convertFont:font toSize:[font pointSize]*ratio];
-            [storage addAttribute:NSFontAttributeName value:font range:effectiveRange];
-        }
-        if (NSMaxRange(effectiveRange) < NSMaxRange(remainingRange)) {
-            remainingRange.length = NSMaxRange(remainingRange) - NSMaxRange(effectiveRange);
-            remainingRange.location = NSMaxRange(effectiveRange);
-        } else {
-            break;
-        }
-    }
-}
-
-- (void)_updateTextSizeMultiplier
-{
-    float newMultiplier = [self _textSizeMultiplierFromWebView];
-    if (newMultiplier == _textSizeMultiplier) {
-        return;
-    }
-    
-    float oldMultiplier = _textSizeMultiplier;
-    _textSizeMultiplier = newMultiplier;
-    
-    if ([self isRichText]) {
-        [self _adjustRichTextFontSizeByRatio:newMultiplier/oldMultiplier];
-    } else {
-        [self setFixedWidthFont];
-    }
-}
-
-- (void)setDataSource:(WebDataSource *)dataSource
-{
-    _dataSource = dataSource;
-    
-    [self setRichText:[[[dataSource response] MIMEType] isEqualToString:@"text/rtf"]];
-    
-    float oldMultiplier = _textSizeMultiplier;
-    [self _updateTextSizeMultiplier];
-    // If the multiplier didn't change, we still need to update the fixed-width font.
-    // If the multiplier did change, this was already handled.
-    if (_textSizeMultiplier == oldMultiplier && ![self isRichText])
-        [self setFixedWidthFont];
-}
-
-// We handle incoming data here rather than in dataSourceUpdated because we
-// need to distinguish the last hunk of received data from the whole glob
-// of data received so far. This is a bad design in that it requires
-// WebTextRepresentation to know that it's view is a WebTextView, but this
-// bad design already existed.
-- (void)appendReceivedData:(NSData *)data fromDataSource:(WebDataSource *)dataSource
-{
-    if ([self isRichText]) {
-        // FIXME: We should try to progressively load RTF.
-        [self replaceCharactersInRange:NSMakeRange(0, [[self string] length])
-                               withRTF:[dataSource data]];
-        if (_textSizeMultiplier != 1.0) {
-            [self _adjustRichTextFontSizeByRatio:_textSizeMultiplier];
-        }
-    } else {
-        if (!_decoder) {
-            NSString *textEncodingName = [dataSource textEncodingName];
-            if (textEncodingName == nil)
-                textEncodingName = [[self _preferences] defaultTextEncodingName];
-
-            _decoder = [[WebCoreTextDecoder alloc] initWithEncodingName:textEncodingName];
-        }
-        
-        [self replaceCharactersInRange:NSMakeRange([[self string] length], 0)
-                            withString:[_decoder decodeData:data]];
-    }
-}
-
-- (void)flushReceivedData
-{
-    if ([self isRichText]) {
-        // FIXME: We should try to progressively load RTF.
-    } else {
-        if (_decoder)
-            [self replaceCharactersInRange:NSMakeRange([[self string] length], 0)
-                            withString:[_decoder flush]];
-    }
-}
-
-
-- (void)dataSourceUpdated:(WebDataSource *)dataSource
-{
-}
-
-- (void)viewDidMoveToSuperview
-{
-    NSView *superview = [self superview];
-    if (superview) {
-        [self setFrameSize:NSMakeSize([superview frame].size.width, [self frame].size.height)];
-    }
-}
-
-- (void)setNeedsLayout:(BOOL)flag
-{
-}
-
-- (void)layout
-{
-    [self sizeToFit];
-}
-
-- (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow
-{
-
-}
-
-- (void)viewDidMoveToHostWindow
-{
-
-}
-
-- (void)defaultsChanged:(NSNotification *)notification
-{
-    // We use the default fixed-width font, but rich text
-    // pages specify their own fonts
-    if (![self isRichText]) {
-        [self setFixedWidthFont];
-    }
-}
-
-- (BOOL)canTakeFindStringFromSelection
-{
-    return [self isSelectable] && [self selectedRange].length && ![self hasMarkedText];
-}
-
-
-- (IBAction)takeFindStringFromSelection:(id)sender
-{
-    if (![self canTakeFindStringFromSelection]) {
-        NSBeep();
-        return;
-    }
-    
-    // Note: can't use writeSelectionToPasteboard:type: here, though it seems equivalent, because
-    // it doesn't declare the types to the pasteboard and thus doesn't bump the change count
-    [self writeSelectionToPasteboard:[NSPasteboard pasteboardWithName:NSFindPboard]
-                               types:[NSArray arrayWithObject:NSStringPboardType]];
-}
-
-- (void)keyDown:(NSEvent *)event
-{
-    [[self nextResponder] keyDown:event];
-}
-
-- (void)keyUp:(NSEvent *)event
-{
-    [[self nextResponder] keyUp:event];
-}
-
-- (WebFrame *)_webFrame
-{
-    return [[[_dataSource webFrame] frameView] webFrame];
-}
-
-- (NSDictionary *)_elementAtWindowPoint:(NSPoint)windowPoint
-{
-    WebFrame *frame = [self _webFrame];
-    ASSERT(frame);
-    
-    NSPoint screenPoint = [[self window] convertBaseToScreen:windowPoint];
-    BOOL isPointSelected = NSLocationInRange([self characterIndexForPoint:screenPoint], [self selectedRange]);
-    return [NSDictionary dictionaryWithObjectsAndKeys:
-        [NSNumber numberWithBool:isPointSelected], WebElementIsSelectedKey,
-        frame, WebElementFrameKey, nil];
-}
-
-- (NSDictionary *)elementAtPoint:(NSPoint)point
-{
-    return [self _elementAtWindowPoint:[self convertPoint:point toView:nil]];
-}
-
-- (NSDictionary *)elementAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow
-{
-    return [self elementAtPoint:point];
-}
-
-- (BOOL)dragSelectionWithEvent:(NSEvent *)event offset:(NSSize)mouseOffset slideBack:(BOOL)slideBack
-{
-    // Mark webview as initiating the drag so dropping the text back on this webview never tries to navigate.
-    WebView *webView = [_dataSource _webView];
-    [webView _setInitiatedDrag:YES];
-    
-    // The last reference can be lost during the drag if it causes a navigation (e.g. dropping in Safari location
-    // field). This can mess up the dragging machinery (radar 4118126), so retain here and release at end of drag.
-    [self retain];
-
-    BOOL result = [super dragSelectionWithEvent:event offset:mouseOffset slideBack:slideBack];
-    
-    // When the call to super finishes, the drag is either aborted or completed. We must clean up in either case.
-    [webView _setInitiatedDrag:NO];
-    [self release];
-    
-    return result;
-}
-
-- (NSMenu *)menuForEvent:(NSEvent *)event
-{    
-    WebView *webView = [_dataSource _webView];
-    ASSERT(webView);
-    return [webView _menuForElement:[self _elementAtWindowPoint:[event locationInWindow]] defaultItems:nil];
-}
-
-- (BOOL)becomeFirstResponder
-{
-    BOOL result = [super becomeFirstResponder];
-    if (result)
-        [[self _webFrame] _clearSelectionInOtherFrames];
-    return result;
-}
-
-- (BOOL)resignFirstResponder
-{
-    BOOL resign = [super resignFirstResponder];
-    if (resign && ![[_dataSource _webView] maintainsInactiveSelection])
-        [self deselectAll];
-    return resign;
-}
-
-- (void)clickedOnLink:(id)link atIndex:(unsigned)charIndex
-{
-    NSURL *URL = nil;
-    if ([link isKindOfClass:[NSURL class]]) {
-        URL = (NSURL *)link;
-    } else if ([link isKindOfClass:[NSString class]]) {
-        URL = [[self class] _URLForString:(NSString *)link];
-    }
-    if (URL != nil)
-        [[self _webFrame] _safeLoadURL:URL];
-}
-
-#pragma mark PRINTING
-
-- (void)drawPageBorderWithSize:(NSSize)borderSize
-{
-    ASSERT(NSEqualSizes(borderSize, [[[NSPrintOperation currentOperation] printInfo] paperSize]));
-    [[_dataSource _webView] _drawHeaderAndFooter];
-}
-
-- (BOOL)knowsPageRange:(NSRangePointer)range {
-    // Waiting for beginDocument to adjust the printing margins is too late.
-    [[_dataSource _webView] _adjustPrintingMarginsForHeaderAndFooter];
-    return [super knowsPageRange:range];
-}
-
-- (BOOL)canPrintHeadersAndFooters
-{
-    return YES;
-}
-
-@end
-
-@implementation WebTextView (TextSizing)
-
-- (IBAction)_makeTextSmaller:(id)sender
-{
-    [self _updateTextSizeMultiplier];
-}
-
-- (IBAction)_makeTextLarger:(id)sender
-{
-    [self _updateTextSizeMultiplier];
-}
-
-- (IBAction)_makeTextStandardSize:(id)sender
-{
-    [self _updateTextSizeMultiplier];
-}
-
-- (BOOL)_tracksCommonSizeFactor
-{
-    return YES;
-}
-
-// never sent because we track the common size factor
-- (BOOL)_canMakeTextSmaller          {   ASSERT_NOT_REACHED(); return NO;    }
-- (BOOL)_canMakeTextLarger           {   ASSERT_NOT_REACHED(); return NO;    }
-- (BOOL)_canMakeTextStandardSize     {   ASSERT_NOT_REACHED(); return NO;    }
-
-@end
index 46e2813cb810acd27af53ab2337b73449c476918..bb5b02dba130e0d8ee536b86770027e97587ac3e 100644 (file)
@@ -79,8 +79,6 @@
 #import "WebPreferencesPrivate.h"
 #import "WebResourceLoadDelegate.h"
 #import "WebScriptDebugDelegatePrivate.h"
-#import "WebTextRepresentation.h"
-#import "WebTextView.h"
 #import "WebUIDelegate.h"
 #import "WebUIDelegatePrivate.h"
 #import <CoreFoundation/CFSet.h>
@@ -512,10 +510,10 @@ static bool debugWidget = true;
     }
     
     if (viewClass && repClass) {
-        // Special-case WebTextView for text types that shouldn't be shown.
-        if (viewClass == [WebTextView class] &&
-            repClass == [WebTextRepresentation class] &&
-            [[WebTextView unsupportedTextMIMETypes] containsObject:MIMEType]) {
+        // Special-case WebHTMLView for text types that shouldn't be shown.
+        if (viewClass == [WebHTMLView class] &&
+            repClass == [WebHTMLRepresentation class] &&
+            [[WebHTMLView unsupportedTextMIMETypes] containsObject:MIMEType]) {
             return NO;
         }
         if (vClass)