Changeset 14414 in webkit


Ignore:
Timestamp:
May 16, 2006 2:30:22 AM (18 years ago)
Author:
andersca
Message:

WebCore:

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

Reviewed by Maciej.

http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
Use WebCore to render full-frame images.

  • WebCore.xcodeproj/project.pbxproj: Add ImageDocument.


  • bridge/mac/WebCoreFrameBridge.h: Add mainResourceURLResponse and imageTitleForFilename.


  • bridge/mac/WebCoreFrameBridge.mm: (+[WebCoreFrameBridge supportedNonImageMIMETypes]): This used to be supportedMIMETypes but WebKit requires that we handle the image MIME types separately.


(+[WebCoreFrameBridge supportedImageMIMETypes]):
Add image types from WebCoreImageRendererFactory.


(-[WebCoreFrameBridge canProvideDocumentSource]):
Return no for image types.


  • dom/xml_tokenizer.h: (WebCore::Tokenizer::wantsRawData): (WebCore::Tokenizer::writeRawData): New virtual functions which tokenizers can override if they want to get raw data (which isn't fed through the decoder)


  • html/HTMLImageElement.h: (WebCore::HTMLImageElement::setLoadManually): New function which calls HTMLImageLoader::setLoadManually


  • html/HTMLImageLoader.cpp: (WebCore::HTMLImageLoader::HTMLImageLoader): (WebCore::HTMLImageLoader::updateFromElement): Don't request the image from the loader if the load is set to be manual.


  • html/HTMLImageLoader.h: (WebCore::HTMLImageLoader::setLoadManually): New function which decides if the image data should be fed manually or loaded by the loader.


  • loader/DocLoader.h: Add HTMLImageLoader as a friend.


  • loader/ImageDocument.cpp: Added. (WebCore::ImageTokenizer::ImageTokenizer): (WebCore::ImageTokenizer::wantsRawData): (WebCore::ImageTokenizer::write): (WebCore::ImageTokenizer::writeRawData): (WebCore::ImageTokenizer::stopParsing): (WebCore::ImageTokenizer::finish): (WebCore::ImageTokenizer::isWaitingForScripts): (WebCore::ImageDocument::ImageDocument): (WebCore::ImageDocument::createTokenizer):
  • loader/ImageDocument.h: Added. Add new ImageDocument class which will feed its data to a created image element.
  • loader/TextDocument.h: Inherit from HTMLDocument here too, in case any broken web pages want to manipulate the DOM of any plain text documents.


  • page/Frame.cpp: (WebCore::Frame::begin): (WebCore::Frame::write): Don't create or use the decoder if the tokenizer is in "raw mode".


WebKit:

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

Reviewed by Maciej.

http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
Use WebCore to render full-frame images


  • WebCoreSupport/WebFrameBridge.m: (-[WebFrameBridge determineObjectFromMIMEType:URL:]): Remove WebImageView handling.


(-[WebFrameBridge mainResourceURLResponse]):
New function which returns the URL response for the main resource. This is used by the
manual loading of images.


(-[WebFrameBridge imageTitleForFilename:size:]):
New function which returns a correctly translated image title given a filename and a size.


  • WebCoreSupport/WebImageRenderer.m: (-[WebImageRenderer _startOrContinueAnimationIfNecessary]): Remove WebImageView handling.


  • WebKit.xcodeproj/project.pbxproj: Remove WebImageRepresentation and WebImageView.


  • WebView/WebArchiver.h:
  • WebView/WebArchiver.m: (+[WebArchiver archiveMainResourceForFrame:]): New functions which returns a WebArchive with just the main resource, ignoring any subresources.


  • WebView/WebDataSource.m: (+[WebDataSource _repTypesAllowImageTypeOmission:]): Use MIME types from WebHTMLRepresentation instead of WebImageRepresentation.


  • WebView/WebFrameView.m: (+[WebFrameView _viewTypesAllowImageTypeOmission:]): Use MIME types from WebHTMLRepresentation instead of WebImageRepresentation.


(+[WebHTMLRepresentation supportedMIMETypes]):
Create an array of image and non-image MIME Types.


(+[WebHTMLRepresentation supportedNonImageMIMETypes]):
(+[WebHTMLRepresentation supportedImageMIMETypes]):
New functions, separating the list of MIME types into image and non-image ones.


  • WebView/WebHTMLView.m: (+[WebHTMLView supportedImageMIMETypes]): (+[WebHTMLView supportedNonImageMIMETypes]): New functions which call down to WebHTMLRepresentation.


(-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
If the image element comes from an ImageDocument, just use an archive of the main resource
instead of the generated HTML document.


  • WebView/WebHTMLViewPrivate.h: Declare new functions.


  • WebView/WebImageRepresentation.h: Removed.
  • WebView/WebImageRepresentation.m: Removed.
  • WebView/WebImageView.h: Removed.
  • WebView/WebImageView.m: Removed.


LayoutTests:

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

Reviewed by Maciej.

http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
Use WebCore to render full-frame images.

  • css2.1/t0801-c412-hz-box-00-b-a-expected.txt:
  • dom/xhtml/level2/html/frame-expected.checksum:
  • dom/xhtml/level2/html/frame-expected.png:
  • dom/xhtml/level2/html/frame-expected.txt:
  • dom/xhtml/level2/html/iframe-expected.checksum:
  • dom/xhtml/level2/html/iframe-expected.png:
  • dom/xhtml/level2/html/iframe-expected.txt:
  • tables/mozilla/bugs/bug50695-2-expected.txt: Update tests.
Location:
trunk
Files:
2 added
4 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r14413 r14414  
     12006-05-16  Anders Carlsson  <acarlsson@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
     6        Use WebCore to render full-frame images.
     7
     8        * css2.1/t0801-c412-hz-box-00-b-a-expected.txt:
     9        * dom/xhtml/level2/html/frame-expected.checksum:
     10        * dom/xhtml/level2/html/frame-expected.png:
     11        * dom/xhtml/level2/html/frame-expected.txt:
     12        * dom/xhtml/level2/html/iframe-expected.checksum:
     13        * dom/xhtml/level2/html/iframe-expected.png:
     14        * dom/xhtml/level2/html/iframe-expected.txt:
     15        * tables/mozilla/bugs/bug50695-2-expected.txt:
     16        Update tests.
     17
    1182006-05-16  Eric Seidel  <eseidel@apple.com>
    219
  • trunk/LayoutTests/css2.1/t0801-c412-hz-box-00-b-a-expected.txt

    r13869 r14414  
    1313        RenderBlock {P} at (0,56) size 784x154
    1414          RenderPartObject {OBJECT} at (0,0) size 300x150
     15            layer at (0,0) size 600x135
     16              RenderCanvas at (0,0) size 300x135
     17            layer at (0,0) size 600x44
     18              RenderBlock {HTML} at (0,0) size 300x44
     19                RenderBody {BODY} at (0,0) size 300x44
     20                  RenderImage {IMG} at (0,0) size 600x40
    1521          RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/dom/xhtml/level2/html/frame-expected.checksum

    r11995 r14414  
    1 b9450a3e59fe332228de2775caf02a6e
     198bb7e11c17ebf4f2b4a6e0ce246f8b4
  • trunk/LayoutTests/dom/xhtml/level2/html/frame-expected.txt

    r13869 r14414  
    66      RenderFrameSet {frameset} at (0,0) size 159x600
    77        RenderFrame {frame} at (0,0) size 159x198
     8          layer at (0,0) size 157x194
     9            RenderCanvas at (0,0) size 157x194
     10          layer at (0,0) size 157x18
     11            RenderBlock {HTML} at (0,0) size 157x18
     12              RenderBody {BODY} at (0,0) size 157x18
     13                RenderImage {IMG} at (0,3) size 17x11
    814      RenderFrame {frame} at (163,0) size 637x600
     15        layer at (0,0) size 635x596
     16          RenderCanvas at (0,0) size 635x596
     17        layer at (0,0) size 635x52
     18          RenderBlock {HTML} at (0,0) size 635x52
     19            RenderBody {BODY} at (0,0) size 635x52
     20              RenderImage {IMG} at (0,0) size 315x48
  • trunk/LayoutTests/dom/xhtml/level2/html/iframe-expected.checksum

    r11995 r14414  
    1 0e025222ec84509671c451a6111ff44e
     1d22fe9e9c656b78abd845529b36dbd41
  • trunk/LayoutTests/dom/xhtml/level2/html/iframe-expected.txt

    r13869 r14414  
    55    RenderBody {body} at (8,8) size 784x50
    66      RenderPartObject {iframe} at (0,0) size 60x50
     7        layer at (0,0) size 58x46
     8          RenderCanvas at (0,0) size 58x46
     9        layer at (0,0) size 58x18
     10          RenderBlock {HTML} at (0,0) size 58x18
     11            RenderBody {BODY} at (0,0) size 58x18
     12              RenderImage {IMG} at (0,3) size 17x11
    713      RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/tables/mozilla/bugs/bug50695-2-expected.txt

    r13869 r14414  
    66      RenderBlock {FORM} at (0,0) size 784x300
    77        RenderPartObject {IFRAME} at (0,0) size 300x300
     8          layer at (0,0) size 300x300
     9            RenderCanvas at (0,0) size 300x300
     10          layer at (0,0) size 300x174
     11            RenderBlock {HTML} at (0,0) size 300x174
     12              RenderBody {BODY} at (0,0) size 300x174
     13                RenderImage {IMG} at (0,0) size 250x170
    814        RenderText {#text} at (0,0) size 0x0
  • trunk/WebCore/ChangeLog

    r14413 r14414  
     12006-05-16  Anders Carlsson  <acarlsson@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
     6        Use WebCore to render full-frame images.
     7
     8        * WebCore.xcodeproj/project.pbxproj:
     9        Add ImageDocument.
     10       
     11        * bridge/mac/WebCoreFrameBridge.h:
     12        Add mainResourceURLResponse and imageTitleForFilename.
     13       
     14        * bridge/mac/WebCoreFrameBridge.mm:
     15        (+[WebCoreFrameBridge supportedNonImageMIMETypes]):
     16        This used to be supportedMIMETypes but WebKit requires that we handle the
     17        image MIME types separately.
     18       
     19        (+[WebCoreFrameBridge supportedImageMIMETypes]):
     20        Add image types from WebCoreImageRendererFactory.
     21       
     22        (-[WebCoreFrameBridge canProvideDocumentSource]):
     23        Return no for image types.
     24       
     25        * dom/xml_tokenizer.h:
     26        (WebCore::Tokenizer::wantsRawData):
     27        (WebCore::Tokenizer::writeRawData):
     28        New virtual functions which tokenizers can override if they want to get
     29        raw data (which isn't fed through the decoder)
     30       
     31        * html/HTMLImageElement.h:
     32        (WebCore::HTMLImageElement::setLoadManually):
     33        New function which calls HTMLImageLoader::setLoadManually
     34       
     35        * html/HTMLImageLoader.cpp:
     36        (WebCore::HTMLImageLoader::HTMLImageLoader):
     37        (WebCore::HTMLImageLoader::updateFromElement):
     38        Don't request the image from the loader if the load is set to be manual.
     39       
     40        * html/HTMLImageLoader.h:
     41        (WebCore::HTMLImageLoader::setLoadManually):
     42        New function which decides if the image data should be fed manually or loaded
     43        by the loader.
     44       
     45        * loader/DocLoader.h:
     46        Add HTMLImageLoader as a friend.
     47       
     48        * loader/ImageDocument.cpp: Added.
     49        (WebCore::ImageTokenizer::ImageTokenizer):
     50        (WebCore::ImageTokenizer::wantsRawData):
     51        (WebCore::ImageTokenizer::write):
     52        (WebCore::ImageTokenizer::writeRawData):
     53        (WebCore::ImageTokenizer::stopParsing):
     54        (WebCore::ImageTokenizer::finish):
     55        (WebCore::ImageTokenizer::isWaitingForScripts):
     56        (WebCore::ImageDocument::ImageDocument):
     57        (WebCore::ImageDocument::createTokenizer):
     58        * loader/ImageDocument.h: Added.
     59        Add new ImageDocument class which will feed its data to a created image element.
     60
     61        * loader/TextDocument.h:
     62        Inherit from HTMLDocument here too, in case any broken web pages want to manipulate
     63        the DOM of any plain text documents.
     64       
     65        * page/Frame.cpp:
     66        (WebCore::Frame::begin):
     67        (WebCore::Frame::write):
     68        Don't create or use the decoder if the tokenizer is in "raw mode".
     69       
    1702006-05-16  Eric Seidel  <eseidel@apple.com>
    271
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r14413 r14414  
    101101                1A762C790A074F2600989F5B /* JSXPathResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A762C710A074F2600989F5B /* JSXPathResult.cpp */; };
    102102                1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A762C720A074F2600989F5B /* JSXPathResult.h */; };
     103                1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */; settings = {COMPILER_FLAGS = "-xobjective-c++"; }; };
     104                1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A820D900A13EBA600AF843C /* ImageDocument.h */; };
    103105                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
    104106                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; };
     
    15431545                1A762C710A074F2600989F5B /* JSXPathResult.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathResult.cpp; sourceTree = "<group>"; };
    15441546                1A762C720A074F2600989F5B /* JSXPathResult.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXPathResult.h; sourceTree = "<group>"; };
     1547                1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ImageDocument.cpp; sourceTree = "<group>"; };
     1548                1A820D900A13EBA600AF843C /* ImageDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageDocument.h; sourceTree = "<group>"; };
    15451549                2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    15461550                2D90660C0665D937006B6F1A /* ClipboardMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClipboardMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    44544458                                93ABCE5D06E1A42E0085925B /* FormData.cpp */,
    44554459                                93ABCE5E06E1A42E0085925B /* FormData.h */,
     4460                                1A820D8F0A13EBA600AF843C /* ImageDocument.cpp */,
     4461                                1A820D900A13EBA600AF843C /* ImageDocument.h */,
    44564462                                BCB16C130979C3BD00467741 /* loader.cpp */,
    44574463                                BCB16C140979C3BD00467741 /* loader.h */,
     
    55795585                                1A494E350A12358B00FDAFC1 /* JSHTMLDocument.h in Headers */,
    55805586                                1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */,
     5587                                1A820D920A13EBA600AF843C /* ImageDocument.h in Headers */,
    55815588                                A871DB250A150BD600B12A68 /* HTMLTableSectionElement.h in Headers */,
    55825589                                A871DB270A150BD600B12A68 /* HTMLTableElement.h in Headers */,
     
    64196426                                1A494E340A12358B00FDAFC1 /* JSHTMLDocument.cpp in Sources */,
    64206427                                1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */,
     6428                                1A820D910A13EBA600AF843C /* ImageDocument.cpp in Sources */,
    64216429                                A871DB260A150BD600B12A68 /* HTMLTableSectionElement.cpp in Sources */,
    64226430                                A871DB280A150BD600B12A68 /* HTMLTableElement.cpp in Sources */,
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r14376 r14414  
    187187- (id)initSubframeWithRenderer:(WebCoreRenderPart *)renderer;
    188188
    189 + (NSArray *)supportedMIMETypes;
     189+ (NSArray *)supportedNonImageMIMETypes;
     190+ (NSArray *)supportedImageMIMETypes;
    190191
    191192- (void)initializeSettings:(WebCoreSettings *)settings;
     
    665666- (WebCoreKeyboardUIMode)keyboardUIMode;
    666667
     668- (NSURLResponse*)mainResourceURLResponse;
     669- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size;
     670
    667671@end
    668672
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm

    r14393 r14414  
    4949#import "Page.h"
    5050#import "SelectionController.h"
     51#import "WebCoreImageRendererFactory.h"
    5152#import "WebCorePageBridge.h"
    5253#import "WebCoreSettings.h"
     
    5859#import "htmlediting.h"
    5960#import "HTMLNames.h"
     61#import "Image.h"
    6062#import "kjs_proxy.h"
    6163#import "kjs_window.h"
     
    361363}
    362364
    363 + (NSArray *)supportedMIMETypes
    364 {
    365     return [NSArray arrayWithObjects:
     365+ (NSArray *)supportedNonImageMIMETypes
     366{
     367    return [NSArray arrayWithObjects:       
    366368        @"text/html",
    367369        @"text/xml",
     
    379381#endif
    380382        nil];
     383}
     384
     385+ (NSArray *)supportedImageMIMETypes
     386{
     387    static NSMutableArray *mimeTypes = nil;
     388    if (mimeTypes == nil) {
     389        mimeTypes = [[[WebCoreImageRendererFactory sharedFactory] supportedMIMETypes] mutableCopy];
     390        [mimeTypes removeObject:@"application/pdf"];
     391        [mimeTypes removeObject:@"application/postscript"];
     392    }
     393    return mimeTypes;
    381394}
    382395
     
    24622475    String mimeType = m_frame->resourceRequest().m_responseMIMEType;
    24632476   
    2464     if (WebCore::DOMImplementation::isTextMIMEType(mimeType))
     2477    if (WebCore::DOMImplementation::isTextMIMEType(mimeType) ||
     2478        Image::supportsType(mimeType))
    24652479        return NO;
    24662480   
  • trunk/WebCore/dom/xml_tokenizer.h

    r14273 r14414  
    5454    virtual int executingScript() const { return 0; }
    5555
     56    virtual bool wantsRawData() const { return false; }
     57    virtual bool writeRawData(const char* data, int len) { return false; }
     58   
    5659protected:
    5760    // The tokenizer has buffers, so parsing may continue even after
  • trunk/WebCore/html/HTMLImageElement.h

    r14393 r14414  
    6565    CachedImage* cachedImage() const { return m_imageLoader.image(); }
    6666   
     67    void setLoadManually (bool loadManually) { m_imageLoader.setLoadManually(loadManually); }
     68
    6769    String name() const;
    6870    void setName(const String&);
  • trunk/WebCore/html/HTMLImageLoader.cpp

    r14393 r14414  
    4545    , m_firedLoad(true)
    4646    , m_imageComplete(true)
     47    , m_loadManually(false)
    4748{
    4849}
     
    7576    // Treat a lack of src or empty string for src as no image at all.
    7677    CachedImage *newImage = 0;
    77     if (!attr.isEmpty())
    78         newImage = doc->docLoader()->requestImage(parseURL(attr));
    79 
     78    if (!attr.isEmpty()) {
     79        if (m_loadManually) {
     80            newImage = new CachedImage(doc->docLoader(), parseURL(attr), KIO::CC_Verify, 0);
     81            doc->docLoader()->m_docObjects.set(newImage->url(), newImage);
     82        } else
     83            newImage = doc->docLoader()->requestImage(parseURL(attr));
     84    }
     85   
    8086    CachedImage *oldImage = m_image;
    8187    if (newImage != oldImage) {
  • trunk/WebCore/html/HTMLImageLoader.h

    r14393 r14414  
    4545    CachedImage* image() const { return m_image; }
    4646
     47    void setLoadManually(bool loadManually) { m_loadManually = loadManually; }
     48
    4749    // CachedObjectClient API
    4850    virtual void notifyFinished(CachedObject*);
     
    5658    bool m_firedLoad : 1;
    5759    bool m_imageComplete : 1;
     60    bool m_loadManually : 1;
    5861};
    5962
  • trunk/WebCore/loader/DocLoader.h

    r14256 r14414  
    4646    class Document;
    4747    class Frame;
    48 
     48    class HTMLImageLoader;
     49   
    4950    /**
    5051     * Manages the loading of scripts/images/stylesheets for a particular document
     
    8990        friend class Cache;
    9091        friend class WebCore::Document;
     92        friend class WebCore::HTMLImageLoader;
    9193
    9294        DeprecatedStringList m_reloadedURLs;
  • trunk/WebCore/page/Frame.cpp

    r14407 r14414  
    5151#include "HTMLNames.h"
    5252#include "HTMLObjectElement.h"
     53#include "ImageDocument.h"
    5354#include "MouseEventWithHitTestResults.h"
    5455#include "NodeList.h"
     
    601602    d->m_doc = DOMImplementation::instance()->createDocument(d->m_view.get());
    602603  else if (DOMImplementation::isTextMIMEType(d->m_request.m_responseMIMEType))
    603     d->m_doc = DOMImplementation::instance()->createTextDocument(d->m_view.get());
     604    d->m_doc = new TextDocument(DOMImplementation::instance(), d->m_view.get());
     605 else if (Image::supportsType(d->m_request.m_responseMIMEType))
     606    d->m_doc = new ImageDocument(DOMImplementation::instance(), d->m_view.get());
    604607  else
    605608    d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
     
    632635void Frame::write(const char* str, int len)
    633636{
     637    if (len == 0)
     638        return;
     639   
     640    if (len == -1)
     641        len = strlen(str);
     642
     643    if (Tokenizer* t = d->m_doc->tokenizer()) {
     644        if (t->wantsRawData()) {
     645            t->writeRawData(str, len);
     646            return;
     647        }
     648    }
     649   
    634650    if (!d->m_decoder) {
    635651        d->m_decoder = new Decoder;
     
    643659            d->m_doc->setDecoder(d->m_decoder.get());
    644660    }
    645   if (len == 0)
    646     return;
    647 
    648   if (len == -1)
    649     len = strlen(str);
    650 
    651661  DeprecatedString decoded = d->m_decoder->decode(str, len);
    652662
     
    664674  }
    665675
    666   if (Tokenizer* t = d->m_doc->tokenizer())
     676  if (Tokenizer* t = d->m_doc->tokenizer()) {
     677      ASSERT(!t->wantsRawData());
    667678      t->write(decoded, true);
     679  }
    668680}
    669681
  • trunk/WebKit/ChangeLog

    r14397 r14414  
     12006-05-16  Anders Carlsson  <acarlsson@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        http://bugzilla.opendarwin.org/show_bug.cgi?id=8921
     6        Use WebCore to render full-frame images
     7       
     8        * WebCoreSupport/WebFrameBridge.m:
     9        (-[WebFrameBridge determineObjectFromMIMEType:URL:]):
     10        Remove WebImageView handling.
     11       
     12        (-[WebFrameBridge mainResourceURLResponse]):
     13        New function which returns the URL response for the main resource. This is used by the
     14        manual loading of images.
     15       
     16        (-[WebFrameBridge imageTitleForFilename:size:]):
     17        New function which returns a correctly translated image title given a filename and a size.
     18       
     19        * WebCoreSupport/WebImageRenderer.m:
     20        (-[WebImageRenderer _startOrContinueAnimationIfNecessary]):
     21        Remove WebImageView handling.
     22       
     23        * WebKit.xcodeproj/project.pbxproj:
     24        Remove WebImageRepresentation and WebImageView.
     25       
     26        * WebView/WebArchiver.h:
     27        * WebView/WebArchiver.m:
     28        (+[WebArchiver archiveMainResourceForFrame:]):
     29        New functions which returns a WebArchive with just the main resource, ignoring any subresources.
     30       
     31        * WebView/WebDataSource.m:
     32        (+[WebDataSource _repTypesAllowImageTypeOmission:]):
     33        Use MIME types from WebHTMLRepresentation instead of WebImageRepresentation.
     34       
     35        * WebView/WebFrameView.m:
     36        (+[WebFrameView _viewTypesAllowImageTypeOmission:]):
     37        Use MIME types from WebHTMLRepresentation instead of WebImageRepresentation.
     38       
     39        (+[WebHTMLRepresentation supportedMIMETypes]):
     40        Create an array of image and non-image MIME Types.
     41       
     42        (+[WebHTMLRepresentation supportedNonImageMIMETypes]):
     43        (+[WebHTMLRepresentation supportedImageMIMETypes]):
     44        New functions, separating the list of MIME types into image and non-image ones.
     45       
     46        * WebView/WebHTMLView.m:
     47        (+[WebHTMLView supportedImageMIMETypes]):
     48        (+[WebHTMLView supportedNonImageMIMETypes]):
     49        New functions which call down to WebHTMLRepresentation.
     50       
     51        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
     52        If the image element comes from an ImageDocument, just use an archive of the main resource
     53        instead of the generated HTML document.
     54       
     55        * WebView/WebHTMLViewPrivate.h:
     56        Declare new functions.
     57       
     58        * WebView/WebImageRepresentation.h: Removed.
     59        * WebView/WebImageRepresentation.m: Removed.
     60        * WebView/WebImageView.h: Removed.
     61        * WebView/WebImageView.m: Removed.
     62       
    1632006-05-15  Tim Omernick  <timo@apple.com>
    264
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.m

    r14333 r14414  
    4444#import "WebHTMLViewInternal.h"
    4545#import "WebHistoryItemPrivate.h"
    46 #import "WebImageView.h"
    4746#import "WebJavaPlugIn.h"
    4847#import "WebJavaScriptTextInputPanel.h"
     
    11341133    }
    11351134   
    1136     if ([viewClass isSubclassOfClass:[WebImageView class]])
    1137         return ObjectElementImage;
    1138    
    11391135    // If we're a supported type other than a plugin, we want to make a frame.
    11401136    // Ultimately we should just use frames for all mime types (plugins and HTML/XML/text documents),
     
    16251621}
    16261622
     1623- (NSURLResponse*)mainResourceURLResponse
     1624{
     1625    return [[_frame dataSource] response];
     1626}
     1627
     1628- (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size
     1629{
     1630    return [NSString stringWithFormat:UI_STRING("%@ %.0f×%.0f pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename, size.width, size.height];
     1631}
     1632
    16271633@end
  • trunk/WebKit/WebCoreSupport/WebImageRenderer.m

    r14021 r14414  
    3434#import <WebKit/WebImageData.h>
    3535#import <WebKit/WebImageRendererFactory.h>
    36 #import <WebKit/WebImageView.h>
    3736#import <WebKit/WebNSObjectExtras.h>
    3837#import <WebKitSystemInterface.h>
     
    195194    // like <rdar://problem/3966973>, which describes a third party application that renders thumbnails of
    196195    // the page into a alternate view.
    197     if (([targetView isKindOfClass:[WebHTMLView class]] || [targetView isKindOfClass:[WebImageView class]])
     196    if ([targetView isKindOfClass:[WebHTMLView class]]
    198197            && [imageData shouldAnimate] && [MIMEType isEqual:@"image/gif"]) {
    199198        [imageData addAnimatingRenderer:self inView:targetView];
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r14383 r14414  
    112112                939810570824BF01008DF038 /* WebHTMLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081D9402B6D4D80ACA2ACA /* WebHTMLView.h */; settings = {ATTRIBUTES = (Private, ); }; };
    113113                939810580824BF01008DF038 /* WebHTMLViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081D9602B6D4D80ACA2ACA /* WebHTMLViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    114                 939810590824BF01008DF038 /* WebImageRepresentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081D9802B6D4D80ACA2ACA /* WebImageRepresentation.h */; };
    115                 9398105A0824BF01008DF038 /* WebImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 35081D9A02B6D4D80ACA2ACA /* WebImageView.h */; settings = {ATTRIBUTES = (); }; };
    116114                9398105B0824BF01008DF038 /* WebFrameLoadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5152FAE5033FC52200CA2ACD /* WebFrameLoadDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
    117115                9398105C0824BF01008DF038 /* WebMainResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = F5D538E802441F2601A80181 /* WebMainResourceLoader.h */; };
     
    234232                939810F30824BF01008DF038 /* WebHTMLRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081D9302B6D4D80ACA2ACA /* WebHTMLRepresentation.m */; };
    235233                939810F40824BF01008DF038 /* WebHTMLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081D9502B6D4D80ACA2ACA /* WebHTMLView.m */; };
    236                 939810F50824BF01008DF038 /* WebImageRepresentation.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081D9902B6D4D80ACA2ACA /* WebImageRepresentation.m */; };
    237                 939810F60824BF01008DF038 /* WebImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 35081D9B02B6D4D80ACA2ACA /* WebImageView.m */; };
    238234                939810F70824BF01008DF038 /* WebMainResourceLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = F5D538EC02441FDD01A80181 /* WebMainResourceLoader.m */; };
    239235                939810F80824BF01008DF038 /* WebPreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = F5AEBB3D024A527601C1A526 /* WebPreferences.m */; };
     
    295291/* End PBXBuildFile section */
    296292
     293/* Begin PBXBuildStyle section */
     294                1AF77F6B0A193B680058FFAF /* Development */ = {
     295                        isa = PBXBuildStyle;
     296                        buildSettings = {
     297                                COPY_PHASE_STRIP = NO;
     298                        };
     299                        name = Development;
     300                };
     301                1AF77F6C0A193B680058FFAF /* Deployment */ = {
     302                        isa = PBXBuildStyle;
     303                        buildSettings = {
     304                                COPY_PHASE_STRIP = YES;
     305                        };
     306                        name = Deployment;
     307                };
     308/* End PBXBuildStyle section */
     309
    297310/* Begin PBXFileReference section */
    298311                1C68F640095B5FC100C2984E /* webInspector */ = {isa = PBXFileReference; lastKnownFileType = folder; name = webInspector; path = WebInspector/webInspector; sourceTree = SOURCE_ROOT; };
     
    324337                35081D9502B6D4D80ACA2ACA /* WebHTMLView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebHTMLView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    325338                35081D9602B6D4D80ACA2ACA /* WebHTMLViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLViewPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    326                 35081D9802B6D4D80ACA2ACA /* WebImageRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebImageRepresentation.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    327                 35081D9902B6D4D80ACA2ACA /* WebImageRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRepresentation.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    328                 35081D9A02B6D4D80ACA2ACA /* WebImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebImageView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    329                 35081D9B02B6D4D80ACA2ACA /* WebImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    330339                35081DAE02B6D4F50ACA2ACA /* WebDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    331340                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; };
     
    865874                                6550B7C6099EFAE90090D781 /* WebArchiver.m */,
    866875                                F52CA6BD02DF9D0F018635CA /* HTML */,
    867                                 F52CA6BE02DF9D49018635CA /* Image */,
    868876                                51E94C0706C02CA300A9B09E /* PDF */,
    869877                                8373435A0624EE0D00F3B289 /* WebArchive.h */,
     
    936944                        );
    937945                        name = HTML;
    938                         sourceTree = "<group>";
    939                 };
    940                 F52CA6BE02DF9D49018635CA /* Image */ = {
    941                         isa = PBXGroup;
    942                         children = (
    943                                 35081D9802B6D4D80ACA2ACA /* WebImageRepresentation.h */,
    944                                 35081D9902B6D4D80ACA2ACA /* WebImageRepresentation.m */,
    945                                 35081D9A02B6D4D80ACA2ACA /* WebImageView.h */,
    946                                 35081D9B02B6D4D80ACA2ACA /* WebImageView.m */,
    947                         );
    948                         name = Image;
    949946                        sourceTree = "<group>";
    950947                };
     
    11491146                                939810570824BF01008DF038 /* WebHTMLView.h in Headers */,
    11501147                                939810580824BF01008DF038 /* WebHTMLViewPrivate.h in Headers */,
    1151                                 939810590824BF01008DF038 /* WebImageRepresentation.h in Headers */,
    1152                                 9398105A0824BF01008DF038 /* WebImageView.h in Headers */,
    11531148                                9398105B0824BF01008DF038 /* WebFrameLoadDelegate.h in Headers */,
    11541149                                9398105C0824BF01008DF038 /* WebMainResourceLoader.h in Headers */,
     
    12931288                        isa = PBXProject;
    12941289                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
     1290                        buildSettings = {
     1291                        };
     1292                        buildStyles = (
     1293                                1AF77F6B0A193B680058FFAF /* Development */,
     1294                                1AF77F6C0A193B680058FFAF /* Deployment */,
     1295                        );
    12951296                        hasScannedForEncodings = 1;
    12961297                        knownRegions = (
     
    16551656                                939810F30824BF01008DF038 /* WebHTMLRepresentation.m in Sources */,
    16561657                                939810F40824BF01008DF038 /* WebHTMLView.m in Sources */,
    1657                                 939810F50824BF01008DF038 /* WebImageRepresentation.m in Sources */,
    1658                                 939810F60824BF01008DF038 /* WebImageView.m in Sources */,
    16591658                                939810F70824BF01008DF038 /* WebMainResourceLoader.m in Sources */,
    16601659                                939810F80824BF01008DF038 /* WebPreferences.m in Sources */,
  • trunk/WebKit/WebView/WebArchiver.h

    r13090 r14414  
    4242+ (WebArchive *)archiveSelectionInFrame:(WebFrame *)frame;
    4343+ (WebArchive *)archiveFrame:(WebFrame *)frame;
     44+ (WebArchive *)archiveMainResourceForFrame:(WebFrame *)frame;
    4445
    4546@end
  • trunk/WebKit/WebView/WebArchiver.m

    r14021 r14414  
    5858                                        subresources:[[frame dataSource] subresources]
    5959                                    subframeArchives:[self _subframeArchivesForFrame:frame]] autorelease];
     60}
     61
     62+ (WebArchive *)archiveMainResourceForFrame:(WebFrame *)frame;
     63{
     64    return [[[WebArchive alloc] initWithMainResource:[[frame dataSource] mainResource]
     65                                        subresources:nil
     66                                    subframeArchives:nil] autorelease];
    6067}
    6168
  • trunk/WebKit/WebView/WebDataSource.m

    r14333 r14414  
    4949#import <WebKit/WebIconLoader.h>
    5050#import <WebKit/WebImageRendererFactory.h>
    51 #import <WebKit/WebImageRepresentation.h>
    52 #import <WebKit/WebImageView.h>
    5351#import <WebKit/WebKitErrorsPrivate.h>
    5452#import <WebKit/WebKitLogging.h>
     
    712710    if (!repTypes) {
    713711        repTypes = [[NSMutableDictionary alloc] init];
    714         addTypesFromClass(repTypes, [WebHTMLRepresentation class], [WebHTMLRepresentation supportedMIMETypes]);
     712        addTypesFromClass(repTypes, [WebHTMLRepresentation class], [WebHTMLRepresentation supportedNonImageMIMETypes]);
    715713
    716714        // Since this is a "secret default" we don't both registering it.
     
    721719   
    722720    if (!addedImageTypes && !allowImageTypeOmission) {
    723         addTypesFromClass(repTypes, [WebImageRepresentation class], [WebImageRepresentation supportedMIMETypes]);
     721        addTypesFromClass(repTypes, [WebHTMLRepresentation class], [WebHTMLRepresentation supportedImageMIMETypes]);
    724722        addedImageTypes = YES;
    725723    }
  • trunk/WebKit/WebView/WebFrameView.m

    r14293 r14414  
    4141#import "WebImageRenderer.h"
    4242#import "WebImageRendererFactory.h"
    43 #import "WebImageView.h"
    4443#import "WebKeyGenerator.h"
    4544#import "WebKitErrorsPrivate.h"
     
    260259    if (!viewTypes) {
    261260        viewTypes = [[NSMutableDictionary alloc] init];
    262         addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedMIMETypes]);
     261        addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedNonImageMIMETypes]);
    263262
    264263        // Since this is a "secret default" we don't both registering it.
     
    269268   
    270269    if (!addedImageTypes && !allowImageTypeOmission) {
    271         addTypesFromClass(viewTypes, [WebImageView class], [WebImageView supportedMIMETypes]);
     270        addTypesFromClass(viewTypes, [WebHTMLView class], [WebHTMLView supportedImageMIMETypes]);
    272271        addedImageTypes = YES;
    273272    }
  • trunk/WebKit/WebView/WebHTMLRepresentation.h

    r11962 r14414  
    5050
    5151+ (NSArray *)supportedMIMETypes;
     52+ (NSArray *)supportedNonImageMIMETypes;
     53+ (NSArray *)supportedImageMIMETypes;
    5254
    5355- (NSAttributedString *)attributedStringFrom:(DOMNode *)startNode startOffset:(int)startOffset to:(DOMNode *)endNode endOffset:(int)endOffset;
  • trunk/WebKit/WebView/WebHTMLRepresentation.m

    r14376 r14414  
    3636#import <WebKit/WebDocumentPrivate.h>
    3737#import <WebKit/WebFramePrivate.h>
     38#import <WebKit/WebImageRendererFactory.h>
    3839#import <WebKit/WebKitNSStringExtras.h>
    3940#import <WebKit/WebKitStatisticsPrivate.h>
     
    6768+ (NSArray *)supportedMIMETypes
    6869{
    69     return [WebCoreFrameBridge supportedMIMETypes];
     70    static NSMutableArray *mimeTypes
     71 = nil;
     72   
     73    if (!mimeTypes) {
     74        mimeTypes = [[self supportedNonImageMIMETypes] mutableCopy];
     75        [mimeTypes addObjectsFromArray:[self supportedImageMIMETypes]];
     76    }
     77   
     78    return mimeTypes;
     79}
     80
     81+ (NSArray *)supportedNonImageMIMETypes
     82{
     83    return [WebCoreFrameBridge supportedNonImageMIMETypes];
     84}
     85
     86+ (NSArray *)supportedImageMIMETypes
     87{
     88    [WebImageRendererFactory createSharedFactory];
     89    return [WebCoreFrameBridge supportedImageMIMETypes];
    7090}
    7191
  • trunk/WebKit/WebView/WebHTMLView.m

    r14387 r14414  
    699699}
    700700
     701+ (NSArray *)supportedImageMIMETypes
     702{
     703    return [WebHTMLRepresentation supportedImageMIMETypes];
     704}
     705
     706+ (NSArray *)supportedNonImageMIMETypes
     707{
     708    return [WebHTMLRepresentation supportedNonImageMIMETypes];
     709}
     710
    701711+ (NSArray *)unsupportedTextMIMETypes
    702712{
     
    12891299            [webView setSelectedDOMRange:[[[self _bridge] DOMDocument] _createRangeWithNode:imageElement] affinity:NSSelectionAffinityDownstream];
    12901300            _private->draggingImageURL = [imageURL retain];
     1301           
     1302            WebArchive *archive;
     1303           
     1304            // If the image element comes from an ImageDocument, we don't want to
     1305            // create a web archive from the image element.
     1306            if ([[self _bridge] canSaveAsWebArchive])
     1307                archive = [imageElement webArchive];
     1308            else
     1309                archive = [WebArchiver archiveMainResourceForFrame:[self _frame]];
     1310           
    12911311            source = [pasteboard _web_declareAndWriteDragImage:nil
    12921312                                                       element:imageElement
    12931313                                                           URL:linkURL ? linkURL : imageURL
    12941314                                                         title:[element objectForKey:WebElementImageAltStringKey]
    1295                                                        archive:[imageElement webArchive]
     1315                                                       archive:archive
    12961316                                                        source:self];
    12971317        }
  • trunk/WebKit/WebView/WebHTMLViewPrivate.h

    r14258 r14414  
    4141- (void)_reset;
    4242+ (NSArray *)supportedMIMETypes;
     43+ (NSArray *)supportedImageMIMETypes;
     44+ (NSArray *)supportedNonImageMIMETypes;
    4345+ (NSArray *)unsupportedTextMIMETypes;
    4446
Note: See TracChangeset for help on using the changeset viewer.