+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.
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;
};
@"text/html",
@"text/xml",
@"text/xsl",
+ @"text/",
+ @"application/x-javascript",
@"application/xml",
@"application/xhtml+xml",
@"application/rss+xml",
#include "css_stylesheetimpl.h"
#include "HTMLDocument.h"
#include "RegularExpression.h"
+#include "TextDocument.h"
namespace WebCore {
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;
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 */);
class FrameView;
class HTMLDocument;
class String;
+class TextDocument;
typedef int ExceptionCode;
// 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
--- /dev/null
+/*
+ * 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);
+}
+
+}
--- /dev/null
+/*
+ * 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
#include "RenderCanvas.h"
#include "RenderTheme.h"
#include "SegmentedString.h"
+#include "TextDocument.h"
#include "TextIterator.h"
#include "TransferJob.h"
#include "TypingCommand.h"
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());
+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.
.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
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 */,
#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>
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"];
#import "WebNSViewExtras.h"
#import "WebPDFView.h"
#import "WebSystemInterface.h"
-#import "WebTextView.h"
#import "WebViewFactory.h"
#import "WebViewInternal.h"
#import "WebViewPrivate.h"
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"];
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
- (void)_reset;
+ (NSArray *)supportedMIMETypes;
++ (NSArray *)unsupportedTextMIMETypes;
// Modifier (flagsChanged) tracking SPI
+ (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
#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>
}
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)