Changeset 17438 in webkit


Ignore:
Timestamp:
Oct 30, 2006 9:20:05 AM (17 years ago)
Author:
darin
Message:

WebCore:

Reviewed by John Sullivan.

  • work toward removing Objective-C data types from FrameLoader.h: removed NSDate, NSString, WebCorePageState, WebCoreResourceLoader, and WebCoreResourceHandle
  • moved bodyBackgroundColor function from Frame to WebFrame in WebKit
  • page/PageState.h:
  • page/PageState.cpp: Added, C++ class with much of what WebCorePageState had.
  • bridge/mac/FrameMac.h: Removed uneeeded declarations and bodyBackgroundColor().
  • bridge/mac/FrameMac.mm: (WebCore::FrameMac::startRedirectionTimer): Use a double for the date instead of an NSDate.
  • bridge/mac/WebCoreFrameBridge.h:
  • bridge/mac/WebCoreFrameBridge.mm: Removed invalidatePageCache and saveDocumentToPageCache methods.
  • bridge/mac/WebCorePageState.h:
  • bridge/mac/WebCorePageState.mm: Removed most of the class and turned it into an Objective-C wrapper for PageState.
  • loader/FrameLoader.h: Removed unused Objective-C types, eliminated use of NSDate and WebCorePageState.
  • loader/FrameLoaderClient.h: Changed NSDate to double.
  • loader/mac/FrameLoaderMac.mm: (WebCore::FrameLoader::receivedMainResourceError): Moved call to setInPageCache here that used to be in invalidateCurrentItemPageCache on the WebKit side. (WebCore::FrameLoader::clientRedirected): Changed NSDate to double for date. (WebCore::FrameLoader::open): Moved one of the open functions that was part of commitProvisionalLoad inside the commitProvisionalLoad function, so that it can extract the parameters from the response. Changed the open function that takes a PageState to use the new C++ PageState. (WebCore::FrameLoader::commitProvisionalLoad): Added the code from the open function; tightened up logic, removing a few cases that could never happen, as well as the unused reload boolean.
  • ForwardingHeaders/kjs/property_map.h: Added.
  • WebCore.exp: Updated.
  • WebCore.xcodeproj/project.pbxproj: Updated.

WebKit:

Reviewed by John Sullivan.

  • work toward removing Objective-C data types from FrameLoader.h: removed NSDate, NSString, WebCorePageState, WebCoreResourceLoader, and WebCoreResourceHandle
  • moved bodyBackgroundColor function here from Frame
  • History/WebHistoryItem.m: (+[WebHistoryItem _closeObjectsInPendingPageCaches]): Updated for change in WebCorePageState.
  • WebCoreSupport/WebFrameBridge.mm: Removed saveDocumentToPageCache method.
  • WebCoreSupport/WebFrameLoaderClient.h: Changed NSDate to double.
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::invalidateCurrentItemPageCache): Moved the code that was formerly in invalidatePageCache: on the bridge here. (WebFrameLoaderClient::dispatchWillPerformClientRedirect): Added code to make the NSDate here. (WebFrameLoaderClient::createPageCache): Restructured code to create the WebCorePageState object directly instead of calling saveDocumentToPageCache on the bridge.
  • WebView/WebFrame.mm: (-[WebFrame _bodyBackgroundColor]): Rewrote this to work directly with the DOM and renderers rather than using a function on Frame.
Location:
trunk
Files:
3 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r17435 r17438  
     12006-10-30  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - work toward removing Objective-C data types from FrameLoader.h:
     6          removed NSDate, NSString, WebCorePageState, WebCoreResourceLoader,
     7          and WebCoreResourceHandle
     8        - moved bodyBackgroundColor function from Frame to WebFrame in WebKit
     9
     10        * page/PageState.h:
     11        * page/PageState.cpp: Added, C++ class with much of what WebCorePageState had.
     12
     13        * bridge/mac/FrameMac.h: Removed uneeeded declarations and bodyBackgroundColor().
     14        * bridge/mac/FrameMac.mm: (WebCore::FrameMac::startRedirectionTimer): Use a
     15        double for the date instead of an NSDate.
     16
     17        * bridge/mac/WebCoreFrameBridge.h:
     18        * bridge/mac/WebCoreFrameBridge.mm: Removed invalidatePageCache and
     19        saveDocumentToPageCache methods.
     20
     21        * bridge/mac/WebCorePageState.h:
     22        * bridge/mac/WebCorePageState.mm: Removed most of the class and turned it into
     23        an Objective-C wrapper for PageState.
     24
     25        * loader/FrameLoader.h: Removed unused Objective-C types, eliminated use of
     26        NSDate and WebCorePageState.
     27        * loader/FrameLoaderClient.h: Changed NSDate to double.
     28        * loader/mac/FrameLoaderMac.mm:
     29        (WebCore::FrameLoader::receivedMainResourceError): Moved call to setInPageCache
     30        here that used to be in invalidateCurrentItemPageCache on the WebKit side.
     31        (WebCore::FrameLoader::clientRedirected): Changed NSDate to double for date.
     32        (WebCore::FrameLoader::open): Moved one of the open functions that was part of
     33        commitProvisionalLoad inside the commitProvisionalLoad function, so that it can
     34        extract the parameters from the response. Changed the open function that takes
     35        a PageState to use the new C++ PageState.
     36        (WebCore::FrameLoader::commitProvisionalLoad): Added the code from the open
     37        function; tightened up logic, removing a few cases that could never happen, as
     38        well as the unused reload boolean.
     39
     40        * ForwardingHeaders/kjs/property_map.h: Added.
     41
     42        * WebCore.exp: Updated.
     43        * WebCore.xcodeproj/project.pbxproj: Updated.
     44
    1452006-10-29  Maciej Stachowiak  <mjs@apple.com>
    246
  • trunk/WebCore/WebCore.exp

    r17431 r17438  
    114114.objc_class_name_WebCoreKeyGenerator
    115115.objc_class_name_WebCorePageBridge
     116.objc_class_name_WebCorePageState
    116117.objc_class_name_WebCoreScriptDebugger
    117118.objc_class_name_WebCoreSettings
     
    180181__ZN7WebCore4KURLC1EP5NSURL
    181182__ZN7WebCore4Page16setDefersLoadingEb
     183__ZN7WebCore5Frame11clearTimersEv
    182184__ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
    183185__ZN7WebCore5Frame12canCachePageEv
    184186__ZN7WebCore5Frame12ownerElementEv
     187__ZN7WebCore5Frame13pauseTimeoutsEv
    185188__ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE
    186189__ZN7WebCore5Frame17setWindowHasFocusEb
    187190__ZN7WebCore5Frame20hitTestResultAtPointERKNS_8IntPointEb
     191__ZN7WebCore5Frame20saveWindowPropertiesEPN3KJS15SavedPropertiesE
    188192__ZN7WebCore5Frame20setSelectionFromNoneEv
    189193__ZN7WebCore5Frame21setProhibitsScrollingEb
     194__ZN7WebCore5Frame22saveLocationPropertiesEPN3KJS15SavedPropertiesE
     195__ZN7WebCore5Frame23saveInterpreterBuiltinsERN3KJS13SavedBuiltinsE
    190196__ZN7WebCore5Frame26isSelectionInPasswordFieldEv
    191197__ZN7WebCore5Frame6indentEv
     
    195201__ZN7WebCore6StringC1EP8NSString
    196202__ZN7WebCore6StringC1EPKc
     203__ZN7WebCore7nsColorERKNS_5ColorE
    197204__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
     205__ZN7WebCore8Document4bodyEv
    198206__ZN7WebCore8FrameMac10mouseMovedEP7NSEvent
    199207__ZN7WebCore8FrameMac10wheelEventEP7NSEvent
     
    217225__ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
    218226__ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE
     227__ZN7WebCore9PageState5clearEv
    219228__ZN7WebCore9TimerBase4stopEv
    220229__ZN7WebCore9TimerBase5startEdd
     
    265274__ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
    266275__ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
     276__ZNK7WebCore5Frame3urlEv
    267277__ZNK7WebCore5Frame4pageEv
    268278__ZNK7WebCore5Frame4treeEv
     
    276286__ZNK7WebCore8FrameMac14selectionImageEb
    277287__ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent
    278 __ZNK7WebCore8FrameMac19bodyBackgroundColorEv
    279288__ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv
    280289__ZNK7WebCore9FloatRectcv6CGRectEv
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r17435 r17438  
    15091509                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */; };
    15101510                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */; };
     1511                93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E22A6E0AF5E94100D48324 /* PageState.cpp */; };
     1512                93E22A730AF5E94C00D48324 /* PageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E22A720AF5E94C00D48324 /* PageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15111513                93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */; };
    15121514                93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E62D990985F41600E1B5E3 /* SystemTime.h */; };
     
    15391541                93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15401542                93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851702DE375901EA4122 /* LoaderFunctions.h */; };
    1541                 93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394E0A403AA5BBE008635CE /* WebCorePageState.h */; };
     1543                93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394E0A403AA5BBE008635CE /* WebCorePageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15421544                93F1998208245E59001E9ABC /* DeprecatedPtrList.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15431545                93F1998308245E59001E9ABC /* DeprecatedPtrQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786AD02DE3B8601EA4122 /* DeprecatedPtrQueue.h */; };
     
    43964398                93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoader.cpp; sourceTree = "<group>"; };
    43974399                93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoader.cpp; sourceTree = "<group>"; };
     4400                93E22A6E0AF5E94100D48324 /* PageState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageState.cpp; sourceTree = "<group>"; };
     4401                93E22A720AF5E94C00D48324 /* PageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageState.h; sourceTree = "<group>"; };
    43984402                93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; };
    43994403                93E62D990985F41600E1B5E3 /* SystemTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemTime.h; sourceTree = "<group>"; };
     
    64776481                                65FEA86809833ADE00BED4AB /* Page.cpp */,
    64786482                                65A21467097A329100B9050A /* Page.h */,
     6483                                93E22A720AF5E94C00D48324 /* PageState.h */,
     6484                                93E22A6E0AF5E94100D48324 /* PageState.cpp */,
    64796485                                65D1C1C909932B22000CB324 /* Plugin.h */,
    64806486                                F587863A02DE3A1401EA4122 /* Settings.h */,
     
    1048310489                                930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */,
    1048410490                                9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
     10491                                93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
    1048510492                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
    1048610493                                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
     
    1171711724                                654F68880AF1B7C50065BDD6 /* CachedResourceMac.mm in Sources */,
    1171811725                                9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */,
    11719                                 6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
     11726                                6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
    1172011727                                932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
    1172111728                                93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
     
    1172411731                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
    1172511732                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
     11733                                93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */,
    1172611734                        );
    1172711735                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/objc/DOMHTML.mm

    r16947 r17438  
    3232#import "DOMPrivate.h"
    3333#import "DocumentFragment.h"
    34 #import "FoundationExtras.h"
    3534#import "FrameView.h"
    3635#import "HTMLDocument.h"
  • trunk/WebCore/bridge/mac/FrameMac.h

    r17408 r17438  
    2929#import "ClipboardAccessPolicy.h"
    3030#import "Frame.h"
    31 #import "IntRect.h"
    3231#import "PlatformMouseEvent.h"
    3332#import "StringHash.h"
     
    3736
    3837namespace KJS {
    39     class PausedTimeouts;
    40     class SavedProperties;
    41     class SavedBuiltins;
    42     class ScheduledAction;
    4338    namespace Bindings {
    4439        class Instance;
     
    4944#ifdef __OBJC__
    5045
    51 @class WebCorePageState;
    5246@class NSArray;
    5347@class NSAttributedString;
    54 @class NSColor;
    5548@class NSDictionary;
    5649@class NSEvent;
     
    6053@class NSMenu;
    6154@class NSMutableDictionary;
    62 @class NSResponder;
    6355@class NSString;
    6456@class NSView;
     
    6860#else
    6961
    70 class WebCorePageState;
    7162class NSArray;
    7263class NSAttributedString;
    73 class NSColor;
    7464class NSDictionary;
    7565class NSEvent;
     
    7969class NSMenu;
    8070class NSMutableDictionary;
    81 class NSResponder;
    8271class NSString;
    8372class NSView;
     
    9382
    9483class ClipboardMac;
    95 class DocumentFragment;
    9684class EditorClient;
    97 class FramePrivate;
    9885class HTMLTableCellElement;
    99 class RenderObject;
    100 class RenderStyle;
    10186class VisiblePosition;
    102 
    103 struct DashboardRegionValue;
    10487
    10588enum SelectionDirection {
     
    234217
    235218    virtual String overrideMediaType() const;
    236    
    237     NSColor* bodyBackgroundColor() const;
    238219   
    239220    WebCoreKeyboardUIMode keyboardUIMode() const;
  • trunk/WebCore/bridge/mac/FrameMac.mm

    r17431 r17438  
    3838#import "DOMInternal.h"
    3939#import "DOMWindow.h"
    40 #import "TextResourceDecoder.h"
     40#import "DocumentLoader.h"
    4141#import "Event.h"
    4242#import "EventNames.h"
     
    7373#import "RenderView.h"
    7474#import "ResourceHandle.h"
     75#import "SystemTime.h"
    7576#import "TextIterator.h"
     77#import "TextResourceDecoder.h"
    7678#import "WebCoreEditCommand.h"
    7779#import "WebCoreFrameBridge.h"
    78 #import "WebCorePageState.h"
    7980#import "WebCoreSystemInterface.h"
    8081#import "WebCoreViewFactory.h"
    8182#import "WebDashboardRegion.h"
    82 #import "DocumentLoader.h"
    8383#import "WebScriptObjectPrivate.h"
    8484#import "csshelper.h"
     
    708708    // Don't report history navigations, just actual redirection.
    709709    if (d->m_scheduledRedirection != historyNavigationScheduled) {
    710         NSTimeInterval interval = d->m_redirectionTimer.nextFireInterval();
    711         NSDate *fireDate = [[NSDate alloc] initWithTimeIntervalSinceNow:interval];
     710        double fireDate = currentTime() + d->m_redirectionTimer.nextFireInterval();
    712711        loader()->clientRedirected(KURL(d->m_redirectURL).getNSURL(),
    713712            d->m_delayRedirect, fireDate, d->m_redirectLockHistory, d->m_executingJavaScriptFormAction);
    714         [fireDate release];
    715713    }
    716714}
     
    27112709}
    27122710
    2713 NSColor *FrameMac::bodyBackgroundColor() const
    2714 {
    2715     if (document() && document()->body() && document()->body()->renderer()) {
    2716         Color bgColor = document()->body()->renderer()->style()->backgroundColor();
    2717         if (bgColor.isValid())
    2718             return nsColor(bgColor);
    2719     }
    2720     return nil;
    2721 }
    2722 
    27232711WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const
    27242712{
  • trunk/WebCore/bridge/mac/WebCoreAXObject.mm

    r17402 r17438  
    3131#import "EventNames.h"
    3232#import "FontData.h"
    33 #import "FoundationExtras.h"
    3433#import "FrameMac.h"
    3534#import "HTMLAreaElement.h"
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r17435 r17438  
    205205- (void)addData:(NSData *)data;
    206206
    207 - (void)invalidatePageCache:(NSDictionary *)pageCache;
    208 
    209207- (void)saveDocumentState;
    210208- (void)restoreDocumentState;
    211 
    212 - (BOOL)saveDocumentToPageCache;
    213209
    214210- (void)clearFrame;
     
    467463                            DOMElement:(DOMElement *)element;
    468464- (void)redirectDataToPlugin:(NSView *)pluginView;
    469 
    470 - (BOOL)saveDocumentToPageCache:(id)documentInfo;
    471465
    472466- (int)getObjectCacheSize;
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm

    r17431 r17438  
    4141#import "EditorClient.h"
    4242#import "FloatRect.h"
    43 #import "FoundationExtras.h"
    4443#import "FrameLoader.h"
    4544#import "FrameLoaderClient.h"
     
    7574#import "WebCoreEditCommand.h"
    7675#import "WebCorePageBridge.h"
    77 #import "WebCorePageState.h"
    7876#import "WebCoreSettings.h"
    7977#import "WebCoreSystemInterface.h"
     
    9391#import <JavaScriptCore/date_object.h>
    9492#import <JavaScriptCore/runtime_root.h>
    95 #import <kjs/SavedBuiltins.h>
    9693
    9794@class NSView;
     
    434431}
    435432
    436 - (void)invalidatePageCache:(NSDictionary *)pageCache
    437 {
    438     // We might have made a page cache item, but now we're bailing out due to an error before we ever
    439     // transitioned to the new page (before WebFrameState==commit).  The goal here is to restore any state
    440     // so that the existing view (that wenever got far enough to replace) can continue being used.
    441     Document *doc = m_frame->document();
    442     if (doc)
    443         doc->setInPageCache(NO);
    444 
    445     WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
    446 
    447     // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach
    448     // Somehow the WebCorePageState object is not properly updated, and is holding onto a stale document
    449     // both Xcode and FileMaker see this crash, Safari does not.
    450     // This if check MUST be removed as part of re-writing the loader down in WebCore
    451     ASSERT(!state || ([state document] == doc));
    452     if ([state document] == doc)
    453         [state invalidate];
    454 }
    455 
    456433- (void)saveDocumentState
    457434{
     
    492469        return NO;
    493470    return m_frame->scrollOverflow((ScrollDirection)direction, (ScrollGranularity)granularity);
    494 }
    495 
    496 - (BOOL)saveDocumentToPageCache
    497 {
    498     Document *doc = m_frame->document();
    499     if (!doc)
    500         return NO;
    501     if (!doc->view())
    502         return NO;
    503 
    504     m_frame->clearTimers();
    505 
    506     JSLock lock;
    507 
    508     SavedProperties *windowProperties = new SavedProperties;
    509     m_frame->saveWindowProperties(windowProperties);
    510 
    511     SavedProperties *locationProperties = new SavedProperties;
    512     m_frame->saveLocationProperties(locationProperties);
    513    
    514     SavedBuiltins *interpreterBuiltins = new SavedBuiltins;
    515     m_frame->saveInterpreterBuiltins(*interpreterBuiltins);
    516 
    517     WebCorePageState *pageState = [[WebCorePageState alloc] initWithDocument:doc
    518                                                                  URL:m_frame->url()
    519                                                     windowProperties:windowProperties
    520                                                   locationProperties:locationProperties
    521                                                  interpreterBuiltins:interpreterBuiltins
    522                                                       pausedTimeouts:m_frame->pauseTimeouts()];
    523 
    524     BOOL result = [self saveDocumentToPageCache:pageState];
    525 
    526     [pageState release];
    527 
    528     return result;
    529471}
    530472
  • trunk/WebCore/bridge/mac/WebCorePageState.h

    r15438 r17438  
    11/*
    2  * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 namespace KJS {
    27     class SavedBuiltins;
    28     class SavedProperties;
    29     class PausedTimeouts;
    30 }
    31 
    3226namespace WebCore {
    33     class Document;
    34     class KURL;
    35     class Node;
     27    class Page;
     28    class PageState;
    3629}
    3730
    3831@interface WebCorePageState : NSObject
    3932{
    40     WebCore::Document *document;
    41     WebCore::Node *mousePressNode;
    42     WebCore::KURL *URL;
    43     KJS::SavedProperties *windowProperties;
    44     KJS::SavedProperties *locationProperties;
    45     KJS::SavedBuiltins *interpreterBuiltins;
    46     KJS::PausedTimeouts *pausedTimeouts;
    47     BOOL closed;
     33    WebCore::PageState* m_impl;
    4834}
    49 
    50 - initWithDocument:(WebCore::Document *)doc URL:(const WebCore::KURL &)u windowProperties:(KJS::SavedProperties *)wp locationProperties:(KJS::SavedProperties *)lp interpreterBuiltins:(KJS::SavedBuiltins *)ib pausedTimeouts:(KJS::PausedTimeouts *)pt;
    51 
    52 - (WebCore::Document *)document;
    53 - (WebCore::Node *)mousePressNode;
    54 - (WebCore::KURL *)URL;
    55 - (KJS::SavedProperties *)windowProperties;
    56 - (KJS::SavedProperties *)locationProperties;
    57 - (KJS::SavedBuiltins *)interpreterBuiltins;
    58 - (KJS::PausedTimeouts *)pausedTimeouts;
    59 - (void)invalidate;
    60 
     35- (id)initWithPage:(WebCore::Page*)page;
     36- (WebCore::PageState*)impl;
    6137@end
  • trunk/WebCore/bridge/mac/WebCorePageState.mm

    r15269 r17438  
    11/*
    2  * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2828
    2929#import "Document.h"
    30 #import "FoundationExtras.h"
    31 #import "FrameMac.h"
    32 #import "kjs_window.h"
    33 #import <kjs/SavedBuiltins.h>
     30#import "Frame.h"
     31#import "Page.h"
     32#import "PageState.h"
    3433
    3534using namespace WebCore;
    36 using namespace KJS;
    3735
    3836@implementation WebCorePageState
    3937
    40 - (id)initWithDocument:(Document *)doc URL:(const KURL &)u windowProperties:(SavedProperties *)wp locationProperties:(SavedProperties *)lp interpreterBuiltins:(SavedBuiltins *)ib pausedTimeouts:(PausedTimeouts *)pt
     38- (id)initWithPage:(Page*)page
    4139{
    42     [super init];
     40    self = [super init];
     41    if (!self)
     42        return nil;
    4343
    44     doc->ref();
    45     document = doc;
    46     doc->setInPageCache(YES);
    47    
    48     FrameMac *frame = static_cast<FrameMac *>(doc->frame());
    49     mousePressNode = frame ? frame->mousePressNode() : 0;
    50     if (mousePressNode)
    51         mousePressNode->ref();
    52    
    53     URL = new KURL(u);
    54     windowProperties = wp;
    55     locationProperties = lp;
    56     interpreterBuiltins = ib;
    57     pausedTimeouts = pt;
    58 
    59     doc->view()->ref();
    60 
    61     return self;
    62 }
    63 
    64 - (PausedTimeouts *)pausedTimeouts
    65 {
    66     return pausedTimeouts;
    67 }
    68 
    69 - (void)clear
    70 {
    71     if (mousePressNode)
    72         mousePressNode->deref();       
    73     mousePressNode = 0;
    74 
    75     delete URL;
    76     URL = 0;
    77 
    78     JSLock lock;
    79 
    80     delete windowProperties;
    81     windowProperties = 0;
    82     delete locationProperties;
    83     locationProperties = 0;
    84     delete interpreterBuiltins;
    85     interpreterBuiltins = 0;
    86 
    87     delete pausedTimeouts;
    88     pausedTimeouts = 0;
    89 
    90     Collector::collect();
    91 }
    92 
    93 - (void)invalidate
    94 {
    95     // Should only ever invalidate once.
    96     ASSERT(document);
    97     ASSERT(document->view());
    98     ASSERT(!document->inPageCache());
    99 
    100     if (document) {
    101         FrameView *view = document->view();
    102         if (view)
    103             view->deref();
    104         document->deref();
    105         document = 0;
     44    Document* document = page->mainFrame()->document();
     45    if (!document || !document->view()) {
     46        [self release];
     47        return nil;
    10648    }
    10749
    108     [self clear];
     50    m_impl = WebCore::PageState::create(page).releaseRef();
     51    return self;
    10952}
    11053
    11154- (void)dealloc
    11255{
    113     ASSERT(closed);
     56    m_impl->deref();
    11457    [super dealloc];
    11558}
     
    11760- (void)finalize
    11861{
    119     ASSERT(closed);
     62    m_impl->deref();
    12063    [super finalize];
    12164}
    12265
    123 - (void)close
     66- (WebCore::PageState*)impl
    12467{
    125     if (closed)
    126         return;
    127     if (document) {
    128         ASSERT(document->inPageCache());
    129         ASSERT(document->view());
    130 
    131         FrameView *view = document->view();
    132 
    133         FrameMac::clearTimers(view);
    134 
    135         bool detached = document->renderer() == 0;
    136         document->setInPageCache(NO);
    137         if (detached) {
    138             document->detach();
    139             document->removeAllEventListenersFromAllNodes();
    140         }
    141         document->deref();
    142         document = 0;
    143 
    144         if (view) {
    145             view->clearPart();
    146             view->deref();
    147         }
    148     }
    149 
    150     [self clear];
    151     closed = YES;
    152 }
    153 
    154 - (Document *)document
    155 {
    156     return document;
    157 }
    158 
    159 - (WebCore::Node *)mousePressNode
    160 {
    161     return mousePressNode;
    162 }
    163 
    164 - (KURL *)URL
    165 {
    166     return URL;
    167 }
    168 
    169 - (SavedProperties *)windowProperties
    170 {
    171     return windowProperties;
    172 }
    173 
    174 - (SavedProperties *)locationProperties
    175 {
    176     return locationProperties;
    177 }
    178 
    179 - (SavedBuiltins *)interpreterBuiltins
    180 {
    181     return interpreterBuiltins;
     68    return m_impl;
    18269}
    18370
  • trunk/WebCore/bridge/mac/WebCoreSettings.mm

    r16760 r17438  
    2828#import "WebCoreSettings.h"
    2929
    30 #import "FoundationExtras.h"
    3130#import "Settings.h"
    3231#import "Page.h"
  • trunk/WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.mm

    r17257 r17438  
    2929#import "KRenderingDeviceQuartz.h"
    3030
    31 #import "FoundationExtras.h"
    3231#import "GraphicsContext.h"
    3332#include "KCanvasMarker.h"
  • trunk/WebCore/loader/FrameLoader.h

    r17435 r17438  
    4242#ifdef __OBJC__
    4343
    44 @class WebCorePageState;
    45 
    4644@class NSData;
    47 @class NSDate;
    4845@class NSDictionary;
    4946@class NSError;
     
    5653@class NSURLResponse;
    5754
    58 @protocol WebCoreResourceLoader;
    59 @protocol WebCoreResourceHandle;
    60 
    6155#else
    6256
    63 class WebCorePageState;
    64 
    6557class NSData;
    66 class NSDate;
    6758class NSDictionary;
    6859class NSError;
    6960class NSEvent;
    7061class NSMutableURLRequest;
    71 class NSString;
    7262class NSURL;
    7363class NSURLAuthenticationChallenge;
     
    8979    class FrameLoadRequest;
    9080    class FrameLoaderClient;
     81    class PageState;
    9182    class KURL;
    9283    class MainResourceLoader;
     
    283274        void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
    284275#if PLATFORM(MAC)
    285         void clientRedirected(NSURL *, double delay, NSDate *fireDate, bool lockHistory, bool isJavaScriptFormAction);
     276        void clientRedirected(NSURL *, double delay, double fireDate, bool lockHistory, bool isJavaScriptFormAction);
    286277        void commitProvisionalLoad(NSDictionary *pageCache);
    287278        bool shouldReload(NSURL *currentURL, NSURL *destinationURL);
     
    369360
    370361        void closeOldDataSources();
    371 #if PLATFORM(MAC)
    372         void open(NSURL *, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache);
    373         void open(WebCorePageState *);
    374 #endif
     362        void open(PageState&);
    375363        void opened();
    376364
  • trunk/WebCore/loader/FrameLoaderClient.h

    r17431 r17438  
    113113        virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
    114114        virtual void dispatchDidCancelClientRedirect() = 0;
    115         virtual void dispatchWillPerformClientRedirect(NSURL *URL, double, NSDate *) = 0;
     115        virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate) = 0;
    116116        virtual void dispatchDidChangeLocationWithinPage() = 0;
    117117        virtual void dispatchWillClose() = 0;
  • trunk/WebCore/loader/mac/FrameLoaderMac.mm

    r17435 r17438  
    3333#import "DOMElementInternal.h"
    3434#import "Document.h"
     35#import "DocumentLoader.h"
    3536#import "Element.h"
     37#import "FormDataStream.h"
     38#import "FormState.h"
    3639#import "FrameLoadRequest.h"
    3740#import "FrameLoaderClient.h"
    3841#import "FrameMac.h"
    3942#import "FramePrivate.h"
     43#import "PageState.h"
    4044#import "FrameTree.h"
    4145#import "HTMLNames.h"
    4246#import "LoaderNSURLExtras.h"
    4347#import "LoaderNSURLRequestExtras.h"
     48#import "MainResourceLoader.h"
    4449#import "Page.h"
    4550#import "Plugin.h"
    4651#import "ResourceResponse.h"
    4752#import "ResourceResponseMac.h"
     53#import "SubresourceLoader.h"
    4854#import "WebCoreFrameBridge.h"
    4955#import "WebCoreIconDatabaseBridge.h"
     
    5157#import "WebCoreSystemInterface.h"
    5258#import "WebDataProtocol.h"
    53 #import "DocumentLoader.h"
    54 #import "FormDataStream.h"
    55 #import "FormState.h"
    56 #import "MainResourceLoader.h"
    57 #import "SubresourceLoader.h"
    5859#import <kjs/JSLock.h>
    5960#import <wtf/Assertions.h>
     
    713714        NSURL *failedURL = [m_provisionalDocumentLoader->originalRequestCopy() URL];
    714715        m_frame->didNotOpenURL(failedURL);
     716
     717        // We might have made a page cache item, but now we're bailing out due to an error before we ever
     718        // transitioned to the new page (before WebFrameState == commit).  The goal here is to restore any state
     719        // so that the existing view (that wenever got far enough to replace) can continue being used.
     720        Document* document = m_frame->document();
     721        if (document)
     722            document->setInPageCache(false);
    715723        m_client->invalidateCurrentItemPageCache();
    716724       
     
    741749}
    742750
    743 void FrameLoader::clientRedirected(NSURL *URL, double seconds, NSDate *date, bool lockHistory, bool isJavaScriptFormAction)
    744 {
    745     m_client->dispatchWillPerformClientRedirect(URL, seconds, date);
     751void FrameLoader::clientRedirected(NSURL *URL, double seconds, double fireDate, bool lockHistory, bool isJavaScriptFormAction)
     752{
     753    m_client->dispatchWillPerformClientRedirect(URL, seconds, fireDate);
    746754   
    747755    // Remember that we sent a redirect notification to the frame load delegate so that when we commit
     
    820828}
    821829
    822 void FrameLoader::open(NSURL *URL, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache)
    823 {
    824     if (pageCache) {
    825         WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
    826         open(state);
    827         [state invalidate];
    828         return;
    829     }
    830        
    831     m_frame->setResponseMIMEType(contentType);
    832    
    833     // opening the URL
    834     if (m_frame->didOpenURL(URL)) {
    835         // things we have to set up after calling didOpenURL
    836         if (refresh)
    837             m_frame->addMetaData("http-refresh", refresh);
    838         if (lastModified) {
    839             NSString *modifiedString = [lastModified descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil];
    840             m_frame->addMetaData("modified", modifiedString);
    841         }
    842     }
    843 }
    844 
    845 void FrameLoader::open(WebCorePageState *state)
    846 {
     830void FrameLoader::open(PageState& state)
     831{
     832    ASSERT(m_frame->page()->mainFrame() == m_frame);
     833
    847834    FramePrivate* d = m_frame->d;
    848835
    849     // It's safe to assume none of the WebCorePageState methods will raise
    850     // exceptions, since WebCorePageState is implemented by WebCore and
    851     // does not throw
    852 
    853     Document* doc = [state document];
    854     Node* mousePressNode = [state mousePressNode];
    855     KURL URL = *[state URL];
    856     SavedProperties* windowProperties = [state windowProperties];
    857     SavedProperties* locationProperties = [state locationProperties];
    858     SavedBuiltins* interpreterBuiltins = [state interpreterBuiltins];
    859     PausedTimeouts* timeouts = [state pausedTimeouts];
    860    
    861836    m_frame->cancelRedirection();
    862837
     
    874849        d->m_kjsDefaultStatusBarText = String();
    875850    }
    876    
     851
     852    KURL URL = state.URL();
     853
    877854    if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
    878855        URL.setPath("/");
     
    885862    m_frame->clear();
    886863
    887     doc->setInPageCache(false);
     864    Document* document = state.document();
     865    document->setInPageCache(false);
    888866
    889867    d->m_bCleared = false;
     
    892870    d->m_referrer = URL.url();
    893871   
    894     m_frame->setView(doc->view());
    895    
    896     d->m_doc = doc;
    897     d->m_mousePressNode = mousePressNode;
    898     d->m_decoder = doc->decoder();
     872    m_frame->setView(document->view());
     873   
     874    d->m_doc = document;
     875    d->m_mousePressNode = state.mousePressNode();
     876    d->m_decoder = document->decoder();
    899877
    900878    m_frame->updatePolicyBaseURL();
    901879
    902     { // scope the lock
    903         JSLock lock;
    904         m_frame->restoreWindowProperties(windowProperties);
    905         m_frame->restoreLocationProperties(locationProperties);
    906         m_frame->restoreInterpreterBuiltins(*interpreterBuiltins);
    907     }
    908 
    909     m_frame->resumeTimeouts(timeouts);
     880    state.restoreJavaScriptState(m_frame->page());
    910881
    911882    m_frame->checkCompleted();
     
    945916void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
    946917{
    947     bool reload = m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadAllowingStaleData;
    948    
    949918    RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
    950    
    951     NSURLResponse *response = pdl->response();
    952    
    953     NSDictionary *headers = [response isKindOfClass:[NSHTTPURLResponse class]]
    954         ? [(NSHTTPURLResponse *)response allHeaderFields] : nil;
    955919   
    956920    if (m_loadType != FrameLoadTypeReplace)
     
    969933        clientRedirectCancelledOrFinished(false);
    970934   
    971     NSURL *baseURL = [pdl->request() _webDataRequestBaseURL];       
    972     NSURL *URL = baseURL ? baseURL : [response URL];
    973    
    974     if (!URL || urlIsEmpty(URL))
    975         URL = [NSURL URLWithString:@"about:blank"];   
    976    
    977     NSDate *lastModified = pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response);
    978 
    979     open(URL, reload, [response MIMEType], [headers objectForKey:@"Refresh"], lastModified, pageCache);
     935    WebCorePageState *pageState = [pageCache objectForKey:WebCorePageCacheStateKey];
     936    if (PageState* frameState = [pageState impl]) {
     937        open(*frameState);
     938        frameState->clear();
     939    } else {
     940        NSURLResponse *response = pdl->response();
     941   
     942        NSURL *URL = [pdl->request() _webDataRequestBaseURL];
     943        if (!URL)
     944            URL = [response URL];
     945        if (!URL || urlIsEmpty(URL))
     946            URL = [NSURL URLWithString:@"about:blank"];   
     947
     948        m_frame->setResponseMIMEType([response MIMEType]);
     949        if (m_frame->didOpenURL(URL)) {
     950            if ([response isKindOfClass:[NSHTTPURLResponse class]])
     951                if (NSString *refresh = [[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Refresh"])
     952                    m_frame->addMetaData("http-refresh", refresh);
     953            m_frame->addMetaData("modified", [wkGetNSURLResponseLastModifiedDate(response)
     954                descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil]);
     955        }
     956    }
    980957    opened();
    981958}
  • trunk/WebCore/platform/mac/FontMac.mm

    r16502 r17438  
    3030#import "FontData.h"
    3131#import "FontFallbackList.h"
    32 #import "FoundationExtras.h"
    3332#import "GlyphBuffer.h"
    3433#import "GraphicsContext.h"
  • trunk/WebCore/platform/mac/WidgetMac.mm

    r16987 r17438  
    2929#import "Cursor.h"
    3030#import "Font.h"
    31 #import "FoundationExtras.h"
    3231#import "GraphicsContext.h"
    3332#import "BlockExceptions.h"
  • trunk/WebCore/platform/network/mac/ResourceHandleMac.mm

    r17435 r17438  
    3030#import "BlockExceptions.h"
    3131#import "DocLoader.h"
    32 #import "FoundationExtras.h"
    3332#import "FrameLoader.h"
    3433#import "FrameMac.h"
  • trunk/WebKit/ChangeLog

    r17435 r17438  
     12006-10-30  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by John Sullivan.
     4
     5        - work toward removing Objective-C data types from FrameLoader.h:
     6          removed NSDate, NSString, WebCorePageState, WebCoreResourceLoader,
     7          and WebCoreResourceHandle
     8        - moved bodyBackgroundColor function here from Frame
     9
     10        * History/WebHistoryItem.m: (+[WebHistoryItem _closeObjectsInPendingPageCaches]):
     11        Updated for change in WebCorePageState.
     12
     13        * WebCoreSupport/WebFrameBridge.mm: Removed saveDocumentToPageCache method.
     14
     15        * WebCoreSupport/WebFrameLoaderClient.h: Changed NSDate to double.
     16        * WebCoreSupport/WebFrameLoaderClient.mm:
     17        (WebFrameLoaderClient::invalidateCurrentItemPageCache): Moved the code that was
     18        formerly in invalidatePageCache: on the bridge here.
     19        (WebFrameLoaderClient::dispatchWillPerformClientRedirect): Added code to make the
     20        NSDate here.
     21        (WebFrameLoaderClient::createPageCache): Restructured code to create the
     22        WebCorePageState object directly instead of calling saveDocumentToPageCache on
     23        the bridge.
     24
     25        * WebView/WebFrame.mm: (-[WebFrame _bodyBackgroundColor]): Rewrote this to work
     26        directly with the DOM and renderers rather than using a function on Frame.
     27
    1282006-10-29  Maciej Stachowiak  <mjs@apple.com>
    229
  • trunk/WebKit/History/WebHistoryItem.m

    r17408 r17438  
    2727 */
    2828
    29 #import <WebKit/WebHistoryItemPrivate.h>
    30 
     29#import "WebHistoryItemPrivate.h"
     30
     31#import "WebFrameBridge.h"
     32#import "WebFrameInternal.h"
     33#import "WebFrameView.h"
     34#import "WebHTMLViewInternal.h"
     35#import "WebIconDatabase.h"
     36#import "WebKitLogging.h"
     37#import "WebKitNSStringExtras.h"
     38#import "WebNSDictionaryExtras.h"
     39#import "WebNSObjectExtras.h"
     40#import "WebNSURLExtras.h"
     41#import "WebNSURLRequestExtras.h"
     42#import "WebNSViewExtras.h"
     43#import "WebPluginController.h"
    3144#import <JavaScriptCore/Assertions.h>
    32 #import <WebKit/WebFrameBridge.h>
    33 #import <WebKit/WebFrameInternal.h>
    34 #import <WebKit/WebFrameView.h>
    35 #import <WebKit/WebHTMLViewInternal.h>
    36 #import <WebKit/WebIconDatabase.h>
    37 #import <WebKit/WebKitLogging.h>
    38 #import <WebKit/WebKitNSStringExtras.h>
    39 #import <WebKit/WebNSDictionaryExtras.h>
    40 #import <WebKit/WebNSObjectExtras.h>
    41 #import <WebKit/WebNSURLExtras.h>
    42 #import <WebKit/WebNSURLRequestExtras.h>
    43 #import <WebKit/WebNSViewExtras.h>
    44 #import <WebKit/WebPluginController.h>
     45#import <WebCore/PageState.h>
     46#import <WebCore/WebCorePageState.h>
    4547#import <WebKitSystemInterface.h>
    4648
     
    714716        }
    715717
    716         id pageState = [pageCache objectForKey:WebCorePageCacheStateKey];
    717         if ([pageState respondsToSelector:@selector(close)])
    718             [pageState performSelector:@selector(close)];
     718        if (WebCorePageState *pageState = [pageCache objectForKey:WebCorePageCacheStateKey])
     719            [pageState impl]->clear();
    719720    }
    720721}
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.mm

    r17435 r17438  
    571571}
    572572
    573 - (BOOL)saveDocumentToPageCache:(id)documentInfo
    574 {
    575     WebHistoryItem *item = [_frame _itemForSavingDocState];
    576     if (![item hasPageCache]) {
    577         return NO;
    578     }
    579     [[item pageCache] setObject:documentInfo forKey:WebCorePageCacheStateKey];
    580     return YES;
    581 }
    582 
    583573- (NSString *)userAgentForURL:(NSURL *)URL
    584574{
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.h

    r17431 r17438  
    110110    virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
    111111    virtual void dispatchDidCancelClientRedirect();
    112     virtual void dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval, NSDate *);
     112    virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate);
    113113    virtual void dispatchDidChangeLocationWithinPage();
    114114    virtual void dispatchWillClose();
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm

    r17433 r17438  
    3636#import "WebBackForwardList.h"
    3737#import "WebDataSourceInternal.h"
     38#import "WebDefaultResourceLoadDelegate.h"
    3839#import "WebDocumentInternal.h"
    3940#import "WebDocumentLoaderMac.h"
     
    5960#import "WebUIDelegate.h"
    6061#import "WebViewInternal.h"
     62#import <WebCore/Document.h>
     63#import <WebCore/DocumentLoader.h>
     64#import <WebCore/FormState.h>
    6165#import <WebCore/FrameLoader.h>
    6266#import <WebCore/FrameLoaderTypes.h>
    6367#import <WebCore/FrameMac.h>
     68#import <WebCore/PageState.h>
    6469#import <WebCore/FrameTree.h>
    6570#import <WebCore/Page.h>
    6671#import <WebCore/PlatformString.h>
     72#import <WebCore/ResourceLoader.h>
    6773#import <WebCore/WebCoreFrameBridge.h>
     74#import <WebCore/WebCorePageState.h>
    6875#import <WebCore/WebDataProtocol.h>
    69 #import <WebCore/DocumentLoader.h>
    70 #import <WebCore/FormState.h>
    71 #import <WebCore/ResourceLoader.h>
    7276#import <WebKit/DOMElement.h>
    73 #import <WebKit/WebDefaultResourceLoadDelegate.h>
    74 #import <WebKit/WebDocumentLoaderMac.h>
    75 #import <WebKit/WebResourceLoadDelegate.h>
    76 #import <WebKit/WebViewInternal.h>
    7777#import <WebKitSystemInterface.h>
    78 #import <objc/objc-runtime.h>
    7978#import <wtf/PassRefPtr.h>
    8079
     
    164163    WebHistoryItem *currentItem = m_webFrame->_private->currentItem;
    165164    NSDictionary *pageCache = [currentItem pageCache];
    166     [m_webFrame->_private->bridge invalidatePageCache:pageCache];
     165    WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
     166    WebCore::PageState* pageState = [state impl];
     167
     168    // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach
     169    // Somehow the WebCorePageState object is not properly updated, and is holding onto a stale document.
     170    // Both Xcode and FileMaker see this crash, Safari does not.
     171    ASSERT(!pageState || pageState->document() == core(m_webFrame.get())->document());
     172    if (pageState && pageState->document() == core(m_webFrame.get())->document())
     173        pageState->clear();
     174
    167175    // We're assuming that WebCore invalidates its pageCache state in didNotOpen:pageCache:
    168176    [currentItem setHasPageCache:NO];
     
    533541}
    534542
    535 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval delay, NSDate *fireDate)
    536 {
    537     WebView *webView = getWebView(m_webFrame.get());   
     543void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, double delay, double fireDate)
     544{
     545    WebView *webView = getWebView(m_webFrame.get());
    538546    [[webView _frameLoadDelegateForwarder] webView:webView
    539547                         willPerformClientRedirectToURL:URL
    540548                                                  delay:delay
    541                                                fireDate:fireDate
     549                                               fireDate:[NSDate dateWithTimeIntervalSince1970:fireDate]
    542550                                               forFrame:m_webFrame.get()];
    543551}
     
    11251133bool WebFrameLoaderClient::createPageCache(WebHistoryItem *item)
    11261134{
     1135    WebCorePageState *pageState = [[WebCorePageState alloc] initWithPage:core(m_webFrame.get())->page()];
     1136    if (!pageState) {
     1137        [item setHasPageCache:NO];
     1138        return false;
     1139    }
     1140
    11271141    [item setHasPageCache:YES];
    1128     if (![m_webFrame->_private->bridge saveDocumentToPageCache]) {
    1129         [item setHasPageCache:NO];
    1130         return NO;
    1131     }
    11321142    NSMutableDictionary *pageCache = [item pageCache];
    1133     [pageCache setObject:[NSDate date] forKey: WebPageCacheEntryDateKey];
    1134     [pageCache setObject:[m_webFrame.get() dataSource] forKey: WebPageCacheDataSourceKey];
    1135     [pageCache setObject:[m_webFrame->_private->webFrameView documentView] forKey: WebPageCacheDocumentViewKey];
    1136     return YES;
     1143
     1144    [pageCache setObject:pageState forKey:WebCorePageCacheStateKey];
     1145    [pageCache setObject:[NSDate date] forKey:WebPageCacheEntryDateKey];
     1146    [pageCache setObject:[m_webFrame.get() dataSource] forKey:WebPageCacheDataSourceKey];
     1147    [pageCache setObject:[m_webFrame->_private->webFrameView documentView] forKey:WebPageCacheDocumentViewKey];
     1148
     1149    [pageState release];
     1150
     1151    return true;
    11371152}
    11381153
  • trunk/WebKit/WebView/WebFrame.mm

    r17433 r17438  
    10511051- (NSColor *)_bodyBackgroundColor
    10521052{
    1053     return core(self)->bodyBackgroundColor();
     1053    Document* document = core(self)->document();
     1054    if (!document)
     1055        return nil;
     1056    HTMLElement* body = document->body();
     1057    if (!body)
     1058        return nil;
     1059    RenderObject* bodyRenderer = body->renderer();
     1060    if (!bodyRenderer)
     1061        return nil;
     1062    Color color = bodyRenderer->style()->backgroundColor();
     1063    if (!color.isValid())
     1064        return nil;
     1065    return nsColor(color);
    10541066}
    10551067
Note: See TracChangeset for help on using the changeset viewer.