Commit 763b6b50 authored by kdecker's avatar kdecker
Browse files

Reviewed by Anders.

        Fixed: <rdar://problem/5001428> stationery background images do not display
       
        Change 19244 fixed the method -[WebResource _shouldIgnoreWhenUnarchiving], but also broke Mail stationery.
        
        The problem was that with archivedResourceForURL now fixed, the engine will try to decode the images.  These images wouldn't decode because
        Mail re-encodes and directly manipulates the image data in such a way that prevented WebKit from decoding the image.  Because Mail was giving
        us bad data, the images wouldn't render.  This was never an issue before because archivedResourceForURL (broken) always returned nil, thus the
        engine would never attempt to decode the resource, therefore the responsibility was delegated to Mail's protocol handler, which would do the 
        right thing and load the image.
        
        Since Mail is relying on the fact it can store arbitrary data in WebArchives, I've introduced SPI that acts as a hint for us to ignore certain 
        subresources while unarchiving. This SPI is -[WebResource _shouldIgnoreWhenUnarchiving].
        
        * WebView/WebResource.mm: Addd private ivar shouldIgnoreWhenUnarchiving.
        (-[WebResource _ignoreWhenUnarchiving]): Added.
        (-[WebResource _shouldIgnoreWhenUnarchiving]): Added.
        * WebView/WebResourcePrivate.h: Added two methods to private header.
        * WebView/WebUnarchivingState.m:
        (-[WebUnarchivingState archivedResourceForURL:]): Check if we should ignore the resource.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20217 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a61bd05e
2007-03-15 Kevin Decker <kdecker@apple.com>
Reviewed by Anders.
Fixed: <rdar://problem/5001428> stationery background images do not display
Change 19244 fixed the method -[WebResource _shouldIgnoreWhenUnarchiving], but also broke Mail stationery.
The problem was that with archivedResourceForURL now fixed, the engine will try to decode the images. These images wouldn't decode because
Mail re-encodes and directly manipulates the image data in such a way that prevented WebKit from decoding the image. Because Mail was giving
us bad data, the images wouldn't render. This was never an issue before because archivedResourceForURL (broken) always returned nil, thus the
engine would never attempt to decode the resource, therefore the responsibility was delegated to Mail's protocol handler, which would do the
right thing and load the image.
Since Mail is relying on the fact it can store arbitrary data in WebArchives, I've introduced SPI that acts as a hint for us to ignore certain
subresources while unarchiving. This SPI is -[WebResource _shouldIgnoreWhenUnarchiving].
* WebView/WebResource.mm: Addd private ivar shouldIgnoreWhenUnarchiving.
(-[WebResource _ignoreWhenUnarchiving]): Added.
(-[WebResource _shouldIgnoreWhenUnarchiving]): Added.
* WebView/WebResourcePrivate.h: Added two methods to private header.
* WebView/WebUnarchivingState.m:
(-[WebUnarchivingState archivedResourceForURL:]): Check if we should ignore the resource.
2007-03-15 Mark Rowe <mrowe@apple.com>
 
Reviewed by Antti.
......
......@@ -1280,6 +1280,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -1294,6 +1295,7 @@
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
......
......@@ -49,6 +49,7 @@ NSString *WebResourceResponseKey = @"WebResourceResponse";
NSString *MIMEType;
NSString *textEncodingName;
NSURLResponse *response;
BOOL shouldIgnoreWhenUnarchiving;
}
@end
......@@ -158,6 +159,17 @@ NSString *WebResourceResponseKey = @"WebResourceResponse";
@implementation WebResource (WebResourcePrivate)
// SPI for Mail (5066325)
- (void)_ignoreWhenUnarchiving
{
_private->shouldIgnoreWhenUnarchiving = YES;
}
- (BOOL)_shouldIgnoreWhenUnarchiving
{
return _private->shouldIgnoreWhenUnarchiving;
}
+ (NSArray *)_resourcesFromPropertyLists:(NSArray *)propertyLists
{
if (![propertyLists isKindOfClass:[NSArray class]]) {
......
......@@ -40,6 +40,9 @@
- (id)_initWithData:(NSData *)data URL:(NSURL *)URL response:(NSURLResponse *)response;
- (BOOL)_shouldIgnoreWhenUnarchiving;
- (void)_ignoreWhenUnarchiving;
+ (NSArray *)_resourcesFromPropertyLists:(NSArray *)propertyLists;
+ (NSArray *)_propertyListsFromResources:(NSArray *)resources;
......
......@@ -32,6 +32,7 @@
#import "WebArchive.h"
#import <JavaScriptCore/Assertions.h>
#import "WebResource.h"
#import "WebResourcePrivate.h"
#import "WebNSURLExtras.h"
@implementation WebUnarchivingState
......@@ -77,11 +78,9 @@ - (void)addResource:(WebResource *)subresource
- (WebResource *)archivedResourceForURL:(NSURL *)URL
{
// FIXME: <rdar://problem/4699166> REGRESSION: Background images in Mail stationery do not load
// This should be just return [URL _web_originalDataAsString]
WebResource *resource = [archivedResources objectForKey:URL];
if (!resource)
resource = [archivedResources objectForKey:[URL _web_originalDataAsString]];
WebResource *resource = [archivedResources objectForKey:[URL _web_originalDataAsString]];
if ([resource _shouldIgnoreWhenUnarchiving])
return nil;
return resource;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment