Changeset 14258 in webkit


Ignore:
Timestamp:
May 9, 2006 12:03:20 PM (18 years ago)
Author:
andersca
Message:

WebCore:

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.
Location:
trunk
Files:
2 added
4 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r14257 r14258  
     12006-05-09  Anders Carlsson  <acarlsson@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
     6        WebCore should handle text files
     7       
     8        * WebCore.xcodeproj/project.pbxproj:
     9        Add TextDocument.cpp and TextDocument.h
     10       
     11        * bridge/mac/WebCoreFrameBridge.mm:
     12        (+[WebCoreFrameBridge supportedMIMETypes]):
     13        Add text types here.
     14       
     15        * dom/DOMImplementation.cpp:
     16        (WebCore::DOMImplementation::createTextDocument):
     17        (WebCore::DOMImplementation::isTextMIMEType):
     18        * dom/DOMImplementation.h:
     19        New functions for creating a TextDocument and determining if a
     20        mime type is a text MIME type.
     21       
     22        * loader/TextDocument.cpp: Added.
     23        (WebCore::TextTokenizer::TextTokenizer):
     24        (WebCore::TextTokenizer::write):
     25        (WebCore::TextTokenizer::finish):
     26        (WebCore::TextTokenizer::isWaitingForScripts):
     27        Special tokenizer which will put text inside a <pre> tag
     28        in a document.
     29       
     30        (WebCore::TextDocument::TextDocument):       
     31        (WebCore::TextDocument::createTokenizer):
     32        Create a TextTokenizer.
     33       
     34        * loader/TextDocument.h: Added.
     35       
     36        * page/Frame.cpp:
     37        (WebCore::Frame::begin):
     38        Create a TextDocument if the MIME type is of type text.
     39
    1402006-05-09  Maciej Stachowiak  <mjs@apple.com>
    241
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r14234 r14258  
    5656                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6931740A0CD4FA00C127FE /* XPathValue.h */; };
    5757                1A6931770A0CD4FA00C127FE /* XPathValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6931750A0CD4FA00C127FE /* XPathValue.cpp */; };
     58                1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6937FF0A11100A00C127FE /* TextDocument.cpp */; };
     59                1A6938020A11100A00C127FE /* TextDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6938000A11100A00C127FE /* TextDocument.h */; };
    5860                1A7629830A0740A000989F5B /* XPathExpressionNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7629590A0740A000989F5B /* XPathExpressionNode.cpp */; };
    5961                1A7629840A0740A000989F5B /* XPathExpressionNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A76295A0A0740A000989F5B /* XPathExpressionNode.h */; };
     
    12981300                1A6931740A0CD4FA00C127FE /* XPathValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathValue.h; sourceTree = "<group>"; };
    12991301                1A6931750A0CD4FA00C127FE /* XPathValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathValue.cpp; sourceTree = "<group>"; };
     1302                1A6937FF0A11100A00C127FE /* TextDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextDocument.cpp; sourceTree = "<group>"; };
     1303                1A6938000A11100A00C127FE /* TextDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextDocument.h; sourceTree = "<group>"; };
    13001304                1A7629590A0740A000989F5B /* XPathExpressionNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathExpressionNode.cpp; sourceTree = "<group>"; };
    13011305                1A76295A0A0740A000989F5B /* XPathExpressionNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathExpressionNode.h; sourceTree = "<group>"; };
     
    39803984                                BCB16C150979C3BD00467741 /* Request.cpp */,
    39813985                                BCB16C160979C3BD00467741 /* Request.h */,
     3986                                1A6937FF0A11100A00C127FE /* TextDocument.cpp */,
     3987                                1A6938000A11100A00C127FE /* TextDocument.h */,
    39823988                        );
    39833989                        path = loader;
     
    50045010                                1A5D938F0A0B9ACC00B1121F /* XPathParser.h in Headers */,
    50055011                                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */,
     5012                                1A6938020A11100A00C127FE /* TextDocument.h in Headers */,
    50065013                        );
    50075014                        runOnlyForDeploymentPostprocessing = 0;
     
    57415748                                BCCD13200A0C0030001AFA8B /* FontData.mm in Sources */,
    57425749                                1A6931770A0CD4FA00C127FE /* XPathValue.cpp in Sources */,
     5750                                1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */,
    57435751                        );
    57445752                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm

    r14251 r14258  
    366366        @"text/xml",
    367367        @"text/xsl",
     368        @"text/",
     369        @"application/x-javascript",
    368370        @"application/xml",
    369371        @"application/xhtml+xml",
  • trunk/WebCore/dom/DOMImplementation.cpp

    r14234 r14258  
    3232#include "HTMLDocument.h"
    3333#include "RegularExpression.h"
     34#include "TextDocument.h"
    3435
    3536namespace WebCore {
     
    175176}
    176177
     178PassRefPtr<TextDocument> DOMImplementation::createTextDocument(FrameView *v)
     179{
     180    return new TextDocument(this, v);
     181}
     182
    177183DOMImplementation* DOMImplementation::instance()
    178184{
     
    192198}
    193199
     200bool DOMImplementation::isTextMIMEType(const String& mimeType)
     201{
     202    if (mimeType == "application/x-javascript" ||
     203        (mimeType.startsWith("text/") && mimeType != "text/html" &&
     204         mimeType != "text/xml" && mimeType != "text/xsl"))
     205        return true;
     206   
     207    return false;
     208}
     209
    194210PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
    195211{
  • trunk/WebCore/dom/DOMImplementation.h

    r14256 r14258  
    3838class HTMLDocument;
    3939class String;
     40class TextDocument;
    4041
    4142typedef int ExceptionCode;
     
    5960    PassRefPtr<Document> createDocument(FrameView* = 0);
    6061    PassRefPtr<HTMLDocument> createHTMLDocument(FrameView* = 0);
     62    PassRefPtr<TextDocument> createTextDocument(FrameView* v = 0);
    6163
    6264    // Returns the static instance of this class - only one instance of this class should
     
    6567
    6668    static bool isXMLMIMEType(const String& mimeType);
     69    static bool isTextMIMEType(const String& mimeType);
    6770};
    6871
  • trunk/WebCore/page/Frame.cpp

    r14211 r14258  
    5454#include "RenderTheme.h"
    5555#include "SegmentedString.h"
     56#include "TextDocument.h"
    5657#include "TextIterator.h"
    5758#include "TransferJob.h"
     
    590591  if (DOMImplementation::isXMLMIMEType(d->m_request.m_responseMIMEType))
    591592    d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
     593  else if (DOMImplementation::isTextMIMEType(d->m_request.m_responseMIMEType))
     594    d->m_doc = DOMImplementation::instance()->createTextDocument(d->m_view.get());
    592595  else
    593596    d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
  • trunk/WebKit/ChangeLog

    r14257 r14258  
     12006-05-09  Anders Carlsson  <acarlsson@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=8808
     6        WebCore should handle text files
     7
     8        * WebKit.exp:
     9        Remove WebTextView.
     10       
     11        * WebKit.xcodeproj/project.pbxproj:
     12        Get rid of WebTextView and WebTextRepresentation.
     13       
     14        * WebView/WebDataSource.m:
     15        (+[WebDataSource _repTypesAllowImageTypeOmission:]):
     16        * WebView/WebFrameView.m:
     17        (+[WebFrameView _viewTypesAllowImageTypeOmission:]):
     18        * WebView/WebHTMLView.m:
     19        The text MIME types are now handled by WebHTMLView.
     20       
     21        (+[WebHTMLView unsupportedTextMIMETypes]):
     22        New function, moved here from WebTextView.
     23       
     24        * WebView/WebHTMLViewPrivate.h:
     25        * WebView/WebTextRepresentation.h: Removed.
     26        * WebView/WebTextRepresentation.m: Removed.
     27        * WebView/WebTextView.h: Removed.
     28        * WebView/WebTextView.m: Removed.
     29       
     30        * WebView/WebView.m:
     31        (+[WebView _viewClass:andRepresentationClass:forMIMEType:]):
     32        Now special-case WebHTMLView instead of WebTextView for MIME types
     33        that shouldn't be shown.
     34
    1352006-05-09  Maciej Stachowiak  <mjs@apple.com>
    236
  • trunk/WebKit/WebKit.exp

    r14185 r14258  
    2424.objc_class_name_WebResource
    2525.objc_class_name_WebStringTruncator
    26 .objc_class_name_WebTextView
    2726.objc_class_name_WebURLsWithTitles
    2827.objc_class_name_WebView
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r14113 r14258  
    119119                9398105F0824BF01008DF038 /* WebRenderNode.h in Headers */ = {isa = PBXBuildFile; fileRef = F5F81C3902B67C26018635CA /* WebRenderNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
    120120                939810600824BF01008DF038 /* WebResourceLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 513D422E034CF55A00CA2ACD /* WebResourceLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
    121                 939810610824BF01008DF038 /* WebTextRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */; };
    122                 939810620824BF01008DF038 /* WebTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081DA802B6D4E40ACA2ACA /* WebTextView.h */; settings = {ATTRIBUTES = (); }; };
    123121                939810630824BF01008DF038 /* WebHistoryItemPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 516F296F03A6C45A00CA2D3A /* WebHistoryItemPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    124122                939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D36FD5E03F78F9E00A80166 /* WebFormDelegatePrivate.h */; };
     
    240238                939810F80824BF01008DF038 /* WebPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AEBB3D024A527601C1A526 /* WebPreferences.m */; };
    241239                939810F90824BF01008DF038 /* WebRenderNode.m in Sources */ = {isa = PBXBuildFile; fileRef = F5F81C3A02B67C26018635CA /* WebRenderNode.m */; };
    242                 939810FA0824BF01008DF038 /* WebTextRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */; };
    243                 939810FB0824BF01008DF038 /* WebTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081DA902B6D4E40ACA2ACA /* WebTextView.m */; };
    244240                939810FC0824BF01008DF038 /* WebFormDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D81DAB303EB0B2D00A80166 /* WebFormDelegate.m */; };
    245241                939810FD0824BF01008DF038 /* CarbonWindowAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EBEE9103F9DBA103CA0DE6 /* CarbonWindowAdapter.m */; };
     
    371367                35081D9A02B6D4D80ACA2ACA /* WebImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebImageView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    372368                35081D9B02B6D4D80ACA2ACA /* WebImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    373                 35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebTextRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    374                 35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebTextRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    375                 35081DA802B6D4E40ACA2ACA /* WebTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebTextView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    376                 35081DA902B6D4E40ACA2ACA /* WebTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebTextView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    377369                35081DAE02B6D4F50ACA2ACA /* WebDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    378370                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; };
     
    912904                                F52CA6BE02DF9D49018635CA /* Image */,
    913905                                51E94C0706C02CA300A9B09E /* PDF */,
    914                                 F52CA6BF02DF9D4D018635CA /* Text */,
    915906                                8373435A0624EE0D00F3B289 /* WebArchive.h */,
    916907                                8373435B0624EE0D00F3B289 /* WebArchive.m */,
     
    993984                        );
    994985                        name = Image;
    995                         sourceTree = "<group>";
    996                 };
    997                 F52CA6BF02DF9D4D018635CA /* Text */ = {
    998                         isa = PBXGroup;
    999                         children = (
    1000                                 35081DA602B6D4E40ACA2ACA /* WebTextRepresentation.h */,
    1001                                 35081DA702B6D4E40ACA2ACA /* WebTextRepresentation.m */,
    1002                                 35081DA802B6D4E40ACA2ACA /* WebTextView.h */,
    1003                                 35081DA902B6D4E40ACA2ACA /* WebTextView.m */,
    1004                         );
    1005                         name = Text;
    1006986                        sourceTree = "<group>";
    1007987                };
     
    12141194                                9398105F0824BF01008DF038 /* WebRenderNode.h in Headers */,
    12151195                                939810600824BF01008DF038 /* WebResourceLoadDelegate.h in Headers */,
    1216                                 939810610824BF01008DF038 /* WebTextRepresentation.h in Headers */,
    1217                                 939810620824BF01008DF038 /* WebTextView.h in Headers */,
    12181196                                939810630824BF01008DF038 /* WebHistoryItemPrivate.h in Headers */,
    12191197                                939810640824BF01008DF038 /* WebFormDelegatePrivate.h in Headers */,
     
    17851763                                939810F80824BF01008DF038 /* WebPreferences.m in Sources */,
    17861764                                939810F90824BF01008DF038 /* WebRenderNode.m in Sources */,
    1787                                 939810FA0824BF01008DF038 /* WebTextRepresentation.m in Sources */,
    1788                                 939810FB0824BF01008DF038 /* WebTextView.m in Sources */,
    17891765                                939810FC0824BF01008DF038 /* WebFormDelegate.m in Sources */,
    17901766                                939810FD0824BF01008DF038 /* CarbonWindowAdapter.m in Sources */,
  • trunk/WebKit/WebView/WebDataSource.m

    r14251 r14258  
    6060#import <WebKit/WebResourceLoadDelegate.h>
    6161#import <WebKit/WebResourcePrivate.h>
    62 #import <WebKit/WebTextRepresentation.h>
    6362#import <WebKit/WebUnarchivingState.h>
    6463#import <WebKit/WebViewInternal.h>
     
    569568        repTypes = [[NSMutableDictionary alloc] init];
    570569        addTypesFromClass(repTypes, [WebHTMLRepresentation class], [WebHTMLRepresentation supportedMIMETypes]);
    571         addTypesFromClass(repTypes, [WebTextRepresentation class], [WebTextRepresentation supportedMIMETypes]);
    572570
    573571        // Since this is a "secret default" we don't both registering it.
  • trunk/WebKit/WebView/WebFrameView.m

    r14196 r14258  
    5050#import "WebPDFView.h"
    5151#import "WebSystemInterface.h"
    52 #import "WebTextView.h"
    5352#import "WebViewFactory.h"
    5453#import "WebViewInternal.h"
     
    259258        viewTypes = [[NSMutableDictionary alloc] init];
    260259        addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedMIMETypes]);
    261         addTypesFromClass(viewTypes, [WebTextView class], [WebTextView supportedMIMETypes]);
    262260
    263261        // Since this is a "secret default" we don't both registering it.
  • trunk/WebKit/WebView/WebHTMLView.m

    r14251 r14258  
    689689{
    690690    return [WebHTMLRepresentation supportedMIMETypes];
     691}
     692
     693+ (NSArray *)unsupportedTextMIMETypes
     694{
     695    return [NSArray arrayWithObjects:
     696        @"text/calendar",       // iCal
     697        @"text/x-calendar",
     698        @"text/x-vcalendar",
     699        @"text/vcalendar",
     700        @"text/vcard",          // vCard
     701        @"text/x-vcard",
     702        @"text/directory",
     703        @"text/ldif",           // Netscape Address Book
     704        @"text/qif",            // Quicken
     705        @"text/x-qif",
     706        @"text/x-csv",          // CSV (for Address Book and Microsoft Outlook)
     707        @"text/x-vcf",          // vCard type used in Sun affinity app
     708        nil];
    691709}
    692710
  • trunk/WebKit/WebView/WebHTMLViewPrivate.h

    r13581 r14258  
    4141- (void)_reset;
    4242+ (NSArray *)supportedMIMETypes;
     43+ (NSArray *)unsupportedTextMIMETypes;
    4344
    4445// Modifier (flagsChanged) tracking SPI
  • trunk/WebKit/WebView/WebView.m

    r14166 r14258  
    8080#import "WebResourceLoadDelegate.h"
    8181#import "WebScriptDebugDelegatePrivate.h"
    82 #import "WebTextRepresentation.h"
    83 #import "WebTextView.h"
    8482#import "WebUIDelegate.h"
    8583#import "WebUIDelegatePrivate.h"
     
    513511   
    514512    if (viewClass && repClass) {
    515         // Special-case WebTextView for text types that shouldn't be shown.
    516         if (viewClass == [WebTextView class] &&
    517             repClass == [WebTextRepresentation class] &&
    518             [[WebTextView unsupportedTextMIMETypes] containsObject:MIMEType]) {
     513        // Special-case WebHTMLView for text types that shouldn't be shown.
     514        if (viewClass == [WebHTMLView class] &&
     515            repClass == [WebHTMLRepresentation class] &&
     516            [[WebHTMLView unsupportedTextMIMETypes] containsObject:MIMEType]) {
    519517            return NO;
    520518        }
Note: See TracChangeset for help on using the changeset viewer.