WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2006 17:20:05 +0000 (17:20 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2006 17:20:05 +0000 (17:20 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
WebCore/ChangeLog
WebCore/ForwardingHeaders/kjs/property_map.h [new file with mode: 0644]
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOMHTML.mm
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/bridge/mac/WebCoreFrameBridge.h
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/bridge/mac/WebCorePageState.h
WebCore/bridge/mac/WebCorePageState.mm
WebCore/bridge/mac/WebCoreSettings.mm
WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
WebCore/loader/FrameLoader.h
WebCore/loader/FrameLoaderClient.h
WebCore/loader/mac/FrameLoaderMac.mm
WebCore/page/PageState.cpp [new file with mode: 0644]
WebCore/page/PageState.h [new file with mode: 0644]
WebCore/platform/mac/FontMac.mm
WebCore/platform/mac/WidgetMac.mm
WebCore/platform/network/mac/ResourceHandleMac.mm
WebKit/ChangeLog
WebKit/History/WebHistoryItem.m
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebView/WebFrame.mm

index b47f695fdaec9fe29d8466a35427df739fa8044b..03669cc3fb113ceb89e7cca77f9754aedd9f1cfe 100644 (file)
@@ -1,3 +1,47 @@
+2006-10-30  Darin Adler  <darin@apple.com>
+
+        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.
+
 2006-10-29  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
 2006-10-29  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
diff --git a/WebCore/ForwardingHeaders/kjs/property_map.h b/WebCore/ForwardingHeaders/kjs/property_map.h
new file mode 100644 (file)
index 0000000..8986882
--- /dev/null
@@ -0,0 +1 @@
+#import <JavaScriptCore/property_map.h>
index 7f7a772a78721947c268a04ada4d9f200cb016cc..88e5d24e9225875491e0b50789acc27f78f0f95d 100644 (file)
 .objc_class_name_WebCoreJavaScript
 .objc_class_name_WebCoreKeyGenerator
 .objc_class_name_WebCorePageBridge
 .objc_class_name_WebCoreJavaScript
 .objc_class_name_WebCoreKeyGenerator
 .objc_class_name_WebCorePageBridge
+.objc_class_name_WebCorePageState
 .objc_class_name_WebCoreScriptDebugger
 .objc_class_name_WebCoreSettings
 .objc_class_name_WebCoreStringTruncator
 .objc_class_name_WebCoreScriptDebugger
 .objc_class_name_WebCoreSettings
 .objc_class_name_WebCoreStringTruncator
@@ -179,14 +180,19 @@ __ZN7WebCore21isBackForwardLoadTypeENS_13FrameLoadTypeE
 __ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
 __ZN7WebCore4KURLC1EP5NSURL
 __ZN7WebCore4Page16setDefersLoadingEb
 __ZN7WebCore26NetscapePlugInStreamLoader6createEPNS_5FrameEP11objc_object
 __ZN7WebCore4KURLC1EP5NSURL
 __ZN7WebCore4Page16setDefersLoadingEb
+__ZN7WebCore5Frame11clearTimersEv
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
 __ZN7WebCore5Frame12canCachePageEv
 __ZN7WebCore5Frame12ownerElementEv
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
 __ZN7WebCore5Frame12canCachePageEv
 __ZN7WebCore5Frame12ownerElementEv
+__ZN7WebCore5Frame13pauseTimeoutsEv
 __ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE
 __ZN7WebCore5Frame17setWindowHasFocusEb
 __ZN7WebCore5Frame20hitTestResultAtPointERKNS_8IntPointEb
 __ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE
 __ZN7WebCore5Frame17setWindowHasFocusEb
 __ZN7WebCore5Frame20hitTestResultAtPointERKNS_8IntPointEb
+__ZN7WebCore5Frame20saveWindowPropertiesEPN3KJS15SavedPropertiesE
 __ZN7WebCore5Frame20setSelectionFromNoneEv
 __ZN7WebCore5Frame21setProhibitsScrollingEb
 __ZN7WebCore5Frame20setSelectionFromNoneEv
 __ZN7WebCore5Frame21setProhibitsScrollingEb
+__ZN7WebCore5Frame22saveLocationPropertiesEPN3KJS15SavedPropertiesE
+__ZN7WebCore5Frame23saveInterpreterBuiltinsERN3KJS13SavedBuiltinsE
 __ZN7WebCore5Frame26isSelectionInPasswordFieldEv
 __ZN7WebCore5Frame6indentEv
 __ZN7WebCore5Frame7outdentEv
 __ZN7WebCore5Frame26isSelectionInPasswordFieldEv
 __ZN7WebCore5Frame6indentEv
 __ZN7WebCore5Frame7outdentEv
@@ -194,7 +200,9 @@ __ZN7WebCore5RangeD1Ev
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EPKc
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EP8NSString
 __ZN7WebCore6StringC1EPKc
+__ZN7WebCore7nsColorERKNS_5ColorE
 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
+__ZN7WebCore8Document4bodyEv
 __ZN7WebCore8FrameMac10mouseMovedEP7NSEvent
 __ZN7WebCore8FrameMac10wheelEventEP7NSEvent
 __ZN7WebCore8FrameMac11mayDHTMLCutEv
 __ZN7WebCore8FrameMac10mouseMovedEP7NSEvent
 __ZN7WebCore8FrameMac10wheelEventEP7NSEvent
 __ZN7WebCore8FrameMac11mayDHTMLCutEv
@@ -216,6 +224,7 @@ __ZN7WebCore8FrameMac9mouseDownEP7NSEvent
 __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE
 __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
 __ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE
+__ZN7WebCore9PageState5clearEv
 __ZN7WebCore9TimerBase4stopEv
 __ZN7WebCore9TimerBase5startEdd
 __ZN7WebCore9TimerBaseC2Ev
 __ZN7WebCore9TimerBase4stopEv
 __ZN7WebCore9TimerBase5startEdd
 __ZN7WebCore9TimerBaseC2Ev
@@ -264,6 +273,7 @@ __ZNK7WebCore5Frame19setInViewSourceModeEb
 __ZNK7WebCore5Frame20visibleSelectionRectEv
 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
 __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
 __ZNK7WebCore5Frame20visibleSelectionRectEv
 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
 __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
+__ZNK7WebCore5Frame3urlEv
 __ZNK7WebCore5Frame4pageEv
 __ZNK7WebCore5Frame4treeEv
 __ZNK7WebCore5Frame6loaderEv
 __ZNK7WebCore5Frame4pageEv
 __ZNK7WebCore5Frame4treeEv
 __ZNK7WebCore5Frame6loaderEv
@@ -275,7 +285,6 @@ __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore8FrameMac14selectionImageEb
 __ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore8FrameMac14selectionImageEb
 __ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent
-__ZNK7WebCore8FrameMac19bodyBackgroundColorEv
 __ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv
 __ZNK7WebCore9FloatRectcv6CGRectEv
 __ZNK7WebCore9FloatRectcv7_NSRectEv
 __ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv
 __ZNK7WebCore9FloatRectcv6CGRectEv
 __ZNK7WebCore9FloatRectcv7_NSRectEv
index 6a6829759c66f4bdf5f654157bdecfdcdc424619..d0630e8da675c5b84e35c8ea26596486b46c3b53 100644 (file)
                93E227E20AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; };
                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */; };
                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */; };
                93E227E20AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; };
                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */; };
                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */; };
+               93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E22A6E0AF5E94100D48324 /* PageState.cpp */; };
+               93E22A730AF5E94C00D48324 /* PageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E22A720AF5E94C00D48324 /* PageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */; };
                93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E62D990985F41600E1B5E3 /* SystemTime.h */; };
                93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */; };
                93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */; };
                93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E62D990985F41600E1B5E3 /* SystemTime.h */; };
                93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */; };
                93F1996C08245E59001E9ABC /* ListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851302DE375901EA4122 /* ListBox.h */; };
                93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851702DE375901EA4122 /* LoaderFunctions.h */; };
                93F1996C08245E59001E9ABC /* ListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851302DE375901EA4122 /* ListBox.h */; };
                93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1996E08245E59001E9ABC /* LoaderFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851702DE375901EA4122 /* LoaderFunctions.h */; };
-               93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394E0A403AA5BBE008635CE /* WebCorePageState.h */; };
+               93F1997708245E59001E9ABC /* WebCorePageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 9394E0A403AA5BBE008635CE /* WebCorePageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1998208245E59001E9ABC /* DeprecatedPtrList.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1998308245E59001E9ABC /* DeprecatedPtrQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786AD02DE3B8601EA4122 /* DeprecatedPtrQueue.h */; };
                93F1998A08245E59001E9ABC /* RegularExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B302DE3B8601EA4122 /* RegularExpression.h */; };
                93F1998208245E59001E9ABC /* DeprecatedPtrList.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F1998308245E59001E9ABC /* DeprecatedPtrQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786AD02DE3B8601EA4122 /* DeprecatedPtrQueue.h */; };
                93F1998A08245E59001E9ABC /* RegularExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786B302DE3B8601EA4122 /* RegularExpression.h */; };
                93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugInStreamLoader.cpp; sourceTree = "<group>"; };
                93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoader.cpp; sourceTree = "<group>"; };
                93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoader.cpp; sourceTree = "<group>"; };
                93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePlugInStreamLoader.cpp; sourceTree = "<group>"; };
                93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoader.cpp; sourceTree = "<group>"; };
                93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoader.cpp; sourceTree = "<group>"; };
+               93E22A6E0AF5E94100D48324 /* PageState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageState.cpp; sourceTree = "<group>"; };
+               93E22A720AF5E94C00D48324 /* PageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageState.h; sourceTree = "<group>"; };
                93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; };
                93E62D990985F41600E1B5E3 /* SystemTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemTime.h; sourceTree = "<group>"; };
                93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterface.mm; sourceTree = "<group>"; };
                93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; };
                93E62D990985F41600E1B5E3 /* SystemTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemTime.h; sourceTree = "<group>"; };
                93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreSystemInterface.mm; sourceTree = "<group>"; };
                                935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
                                65FEA86809833ADE00BED4AB /* Page.cpp */,
                                65A21467097A329100B9050A /* Page.h */,
                                935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */,
                                65FEA86809833ADE00BED4AB /* Page.cpp */,
                                65A21467097A329100B9050A /* Page.h */,
+                               93E22A720AF5E94C00D48324 /* PageState.h */,
+                               93E22A6E0AF5E94100D48324 /* PageState.cpp */,
                                65D1C1C909932B22000CB324 /* Plugin.h */,
                                F587863A02DE3A1401EA4122 /* Settings.h */,
                        );
                                65D1C1C909932B22000CB324 /* Plugin.h */,
                                F587863A02DE3A1401EA4122 /* Settings.h */,
                        );
                                655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */,
                                930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */,
                                9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
                                655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */,
                                930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */,
                                9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */,
+                               93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
                                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
                        );
                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
                                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
                        );
                                853CA9F00AEEC657002372DC /* RenderPath.cpp in Sources */,
                                654F68880AF1B7C50065BDD6 /* CachedResourceMac.mm in Sources */,
                                9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */,
                                853CA9F00AEEC657002372DC /* RenderPath.cpp in Sources */,
                                654F68880AF1B7C50065BDD6 /* CachedResourceMac.mm in Sources */,
                                9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */,
-                               6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
+                               6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */,
                                932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
                                93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
                                93E227E10AF589AD00D48324 /* MainResourceLoader.cpp in Sources */,
                                93E227E20AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp in Sources */,
                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
                                932E16090AF578340025F408 /* FrameLoader.cpp in Sources */,
                                93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */,
                                93E227E10AF589AD00D48324 /* MainResourceLoader.cpp in Sources */,
                                93E227E20AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp in Sources */,
                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
+                               93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index fe7d31fddfe5dae2041b01543dd2e999c5fe9d2d..be68fcb1fc62a9007701ddc70974c9615bbe2b72 100644 (file)
@@ -31,7 +31,6 @@
 #import "DOMInternal.h"
 #import "DOMPrivate.h"
 #import "DocumentFragment.h"
 #import "DOMInternal.h"
 #import "DOMPrivate.h"
 #import "DocumentFragment.h"
-#import "FoundationExtras.h"
 #import "FrameView.h"
 #import "HTMLDocument.h"
 #import "HTMLInputElement.h"
 #import "FrameView.h"
 #import "HTMLDocument.h"
 #import "HTMLInputElement.h"
index 073435e4fcbac8f536bb077ae0a7e61a4d8b3b23..b4eee54e6c5b67c1044f4c446a23539ffc74d1ab 100644 (file)
@@ -28,7 +28,6 @@
 
 #import "ClipboardAccessPolicy.h"
 #import "Frame.h"
 
 #import "ClipboardAccessPolicy.h"
 #import "Frame.h"
-#import "IntRect.h"
 #import "PlatformMouseEvent.h"
 #import "StringHash.h"
 #import "WebCoreKeyboardAccess.h"
 #import "PlatformMouseEvent.h"
 #import "StringHash.h"
 #import "WebCoreKeyboardAccess.h"
 class NPObject;
 
 namespace KJS {
 class NPObject;
 
 namespace KJS {
-    class PausedTimeouts;
-    class SavedProperties;
-    class SavedBuiltins;
-    class ScheduledAction;
     namespace Bindings {
         class Instance;
         class RootObject;
     namespace Bindings {
         class Instance;
         class RootObject;
@@ -48,10 +43,8 @@ namespace KJS {
 
 #ifdef __OBJC__
 
 
 #ifdef __OBJC__
 
-@class WebCorePageState;
 @class NSArray;
 @class NSAttributedString;
 @class NSArray;
 @class NSAttributedString;
-@class NSColor;
 @class NSDictionary;
 @class NSEvent;
 @class NSFileWrapper;
 @class NSDictionary;
 @class NSEvent;
 @class NSFileWrapper;
@@ -59,7 +52,6 @@ namespace KJS {
 @class NSImage;
 @class NSMenu;
 @class NSMutableDictionary;
 @class NSImage;
 @class NSMenu;
 @class NSMutableDictionary;
-@class NSResponder;
 @class NSString;
 @class NSView;
 @class WebCoreFrameBridge;
 @class NSString;
 @class NSView;
 @class WebCoreFrameBridge;
@@ -67,10 +59,8 @@ namespace KJS {
 
 #else
 
 
 #else
 
-class WebCorePageState;
 class NSArray;
 class NSAttributedString;
 class NSArray;
 class NSAttributedString;
-class NSColor;
 class NSDictionary;
 class NSEvent;
 class NSFileWrapper;
 class NSDictionary;
 class NSEvent;
 class NSFileWrapper;
@@ -78,7 +68,6 @@ class NSFont;
 class NSImage;
 class NSMenu;
 class NSMutableDictionary;
 class NSImage;
 class NSMenu;
 class NSMutableDictionary;
-class NSResponder;
 class NSString;
 class NSView;
 class WebCoreFrameBridge;
 class NSString;
 class NSView;
 class WebCoreFrameBridge;
@@ -92,16 +81,10 @@ typedef int NSWritingDirection;
 namespace WebCore {
 
 class ClipboardMac;
 namespace WebCore {
 
 class ClipboardMac;
-class DocumentFragment;
 class EditorClient;
 class EditorClient;
-class FramePrivate;
 class HTMLTableCellElement;
 class HTMLTableCellElement;
-class RenderObject;
-class RenderStyle;
 class VisiblePosition;
 
 class VisiblePosition;
 
-struct DashboardRegionValue;
-
 enum SelectionDirection {
     SelectingNext,
     SelectingPrevious
 enum SelectionDirection {
     SelectingNext,
     SelectingPrevious
@@ -234,8 +217,6 @@ public:
 
     virtual String overrideMediaType() const;
     
 
     virtual String overrideMediaType() const;
     
-    NSColor* bodyBackgroundColor() const;
-    
     WebCoreKeyboardUIMode keyboardUIMode() const;
 
     void didTellBridgeAboutLoad(const String& URL);
     WebCoreKeyboardUIMode keyboardUIMode() const;
 
     void didTellBridgeAboutLoad(const String& URL);
index 06ff90f21f67f1fe039b0bc41de92971861adfd8..32c6b01c85c9d5c7e79ff9b32e2c2446b08cf13d 100644 (file)
@@ -37,7 +37,7 @@
 #import "Cursor.h"
 #import "DOMInternal.h"
 #import "DOMWindow.h"
 #import "Cursor.h"
 #import "DOMInternal.h"
 #import "DOMWindow.h"
-#import "TextResourceDecoder.h"
+#import "DocumentLoader.h"
 #import "Event.h"
 #import "EventNames.h"
 #import "FloatRect.h"
 #import "Event.h"
 #import "EventNames.h"
 #import "FloatRect.h"
 #import "RenderTheme.h"
 #import "RenderView.h"
 #import "ResourceHandle.h"
 #import "RenderTheme.h"
 #import "RenderView.h"
 #import "ResourceHandle.h"
+#import "SystemTime.h"
 #import "TextIterator.h"
 #import "TextIterator.h"
+#import "TextResourceDecoder.h"
 #import "WebCoreEditCommand.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreEditCommand.h"
 #import "WebCoreFrameBridge.h"
-#import "WebCorePageState.h"
 #import "WebCoreSystemInterface.h"
 #import "WebCoreViewFactory.h"
 #import "WebDashboardRegion.h"
 #import "WebCoreSystemInterface.h"
 #import "WebCoreViewFactory.h"
 #import "WebDashboardRegion.h"
-#import "DocumentLoader.h"
 #import "WebScriptObjectPrivate.h"
 #import "csshelper.h"
 #import "htmlediting.h"
 #import "WebScriptObjectPrivate.h"
 #import "csshelper.h"
 #import "htmlediting.h"
@@ -707,11 +707,9 @@ void FrameMac::startRedirectionTimer()
 
     // Don't report history navigations, just actual redirection.
     if (d->m_scheduledRedirection != historyNavigationScheduled) {
 
     // Don't report history navigations, just actual redirection.
     if (d->m_scheduledRedirection != historyNavigationScheduled) {
-        NSTimeInterval interval = d->m_redirectionTimer.nextFireInterval();
-        NSDate *fireDate = [[NSDate alloc] initWithTimeIntervalSinceNow:interval];
+        double fireDate = currentTime() + d->m_redirectionTimer.nextFireInterval();
         loader()->clientRedirected(KURL(d->m_redirectURL).getNSURL(),
             d->m_delayRedirect, fireDate, d->m_redirectLockHistory, d->m_executingJavaScriptFormAction);
         loader()->clientRedirected(KURL(d->m_redirectURL).getNSURL(),
             d->m_delayRedirect, fireDate, d->m_redirectLockHistory, d->m_executingJavaScriptFormAction);
-        [fireDate release];
     }
 }
 
     }
 }
 
@@ -2710,16 +2708,6 @@ String FrameMac::overrideMediaType() const
     return String();
 }
 
     return String();
 }
 
-NSColor *FrameMac::bodyBackgroundColor() const
-{
-    if (document() && document()->body() && document()->body()->renderer()) {
-        Color bgColor = document()->body()->renderer()->style()->backgroundColor();
-        if (bgColor.isValid())
-            return nsColor(bgColor);
-    }
-    return nil;
-}
-
 WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
index e7b358896de647750ea035ae35c83d1e0e657940..ed615f4f409972ee6d403a27f9147a5c8adce730 100644 (file)
@@ -30,7 +30,6 @@
 #import "Document.h"
 #import "EventNames.h"
 #import "FontData.h"
 #import "Document.h"
 #import "EventNames.h"
 #import "FontData.h"
-#import "FoundationExtras.h"
 #import "FrameMac.h"
 #import "HTMLAreaElement.h"
 #import "HTMLCollection.h"
 #import "FrameMac.h"
 #import "HTMLAreaElement.h"
 #import "HTMLCollection.h"
index 35ba8d4dc4c824e870df8118e6fe872450ffe751..767a53f8666a8cf2a5e06e2588972438158de314 100644 (file)
@@ -204,13 +204,9 @@ typedef enum {
 
 - (void)addData:(NSData *)data;
 
 
 - (void)addData:(NSData *)data;
 
-- (void)invalidatePageCache:(NSDictionary *)pageCache;
-
 - (void)saveDocumentState;
 - (void)restoreDocumentState;
 
 - (void)saveDocumentState;
 - (void)restoreDocumentState;
 
-- (BOOL)saveDocumentToPageCache;
-
 - (void)clearFrame;
 
 - (NSURL *)baseURL;
 - (void)clearFrame;
 
 - (NSURL *)baseURL;
@@ -467,8 +463,6 @@ typedef enum {
                             DOMElement:(DOMElement *)element;
 - (void)redirectDataToPlugin:(NSView *)pluginView;
 
                             DOMElement:(DOMElement *)element;
 - (void)redirectDataToPlugin:(NSView *)pluginView;
 
-- (BOOL)saveDocumentToPageCache:(id)documentInfo;
-
 - (int)getObjectCacheSize;
 
 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
 - (int)getObjectCacheSize;
 
 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
index bca70a89836c04095960ea6fa2e212f6963ef57d..2881895a48d4b12f00cfd6a1c21229f4544935e0 100644 (file)
@@ -40,7 +40,6 @@
 #import "DocumentType.h"
 #import "EditorClient.h"
 #import "FloatRect.h"
 #import "DocumentType.h"
 #import "EditorClient.h"
 #import "FloatRect.h"
-#import "FoundationExtras.h"
 #import "FrameLoader.h"
 #import "FrameLoaderClient.h"
 #import "FrameMac.h"
 #import "FrameLoader.h"
 #import "FrameLoaderClient.h"
 #import "FrameMac.h"
@@ -74,7 +73,6 @@
 #import "TypingCommand.h"
 #import "WebCoreEditCommand.h"
 #import "WebCorePageBridge.h"
 #import "TypingCommand.h"
 #import "WebCoreEditCommand.h"
 #import "WebCorePageBridge.h"
-#import "WebCorePageState.h"
 #import "WebCoreSettings.h"
 #import "WebCoreSystemInterface.h"
 #import "WebCoreViewFactory.h"
 #import "WebCoreSettings.h"
 #import "WebCoreSystemInterface.h"
 #import "WebCoreViewFactory.h"
@@ -92,7 +90,6 @@
 #import <JavaScriptCore/array_instance.h>
 #import <JavaScriptCore/date_object.h>
 #import <JavaScriptCore/runtime_root.h>
 #import <JavaScriptCore/array_instance.h>
 #import <JavaScriptCore/date_object.h>
 #import <JavaScriptCore/runtime_root.h>
-#import <kjs/SavedBuiltins.h>
 
 @class NSView;
 
 
 @class NSView;
 
@@ -433,26 +430,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     }
 }
 
     }
 }
 
-- (void)invalidatePageCache:(NSDictionary *)pageCache
-{
-    // We might have made a page cache item, but now we're bailing out due to an error before we ever
-    // transitioned to the new page (before WebFrameState==commit).  The goal here is to restore any state
-    // so that the existing view (that wenever got far enough to replace) can continue being used.
-    Document *doc = m_frame->document();
-    if (doc)
-        doc->setInPageCache(NO);
-
-    WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
-
-    // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach
-    // Somehow the WebCorePageState object is not properly updated, and is holding onto a stale document
-    // both Xcode and FileMaker see this crash, Safari does not.
-    // This if check MUST be removed as part of re-writing the loader down in WebCore
-    ASSERT(!state || ([state document] == doc));
-    if ([state document] == doc)
-        [state invalidate];
-}
-
 - (void)saveDocumentState
 {
     Vector<String> stateVector;
 - (void)saveDocumentState
 {
     Vector<String> stateVector;
@@ -493,41 +470,6 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
     return m_frame->scrollOverflow((ScrollDirection)direction, (ScrollGranularity)granularity);
 }
 
     return m_frame->scrollOverflow((ScrollDirection)direction, (ScrollGranularity)granularity);
 }
 
-- (BOOL)saveDocumentToPageCache
-{
-    Document *doc = m_frame->document();
-    if (!doc)
-        return NO;
-    if (!doc->view())
-        return NO;
-
-    m_frame->clearTimers();
-
-    JSLock lock;
-
-    SavedProperties *windowProperties = new SavedProperties;
-    m_frame->saveWindowProperties(windowProperties);
-
-    SavedProperties *locationProperties = new SavedProperties;
-    m_frame->saveLocationProperties(locationProperties);
-    
-    SavedBuiltins *interpreterBuiltins = new SavedBuiltins;
-    m_frame->saveInterpreterBuiltins(*interpreterBuiltins);
-
-    WebCorePageState *pageState = [[WebCorePageState alloc] initWithDocument:doc
-                                                                 URL:m_frame->url()
-                                                    windowProperties:windowProperties
-                                                  locationProperties:locationProperties
-                                                 interpreterBuiltins:interpreterBuiltins
-                                                      pausedTimeouts:m_frame->pauseTimeouts()];
-
-    BOOL result = [self saveDocumentToPageCache:pageState];
-
-    [pageState release];
-
-    return result;
-}
-
 - (void)clearFrame
 {
     m_frame = 0;
 - (void)clearFrame
 {
     m_frame = 0;
index cb96965e3a77461c7202992a60e9c7cb123b69f2..d1ec87caafbee8f79c0b2f7394b0f408f1a3295a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-namespace KJS {
-    class SavedBuiltins;
-    class SavedProperties;
-    class PausedTimeouts;
-}
-
 namespace WebCore {
 namespace WebCore {
-    class Document;
-    class KURL;
-    class Node;
+    class Page;
+    class PageState;
 }
 
 @interface WebCorePageState : NSObject
 {
 }
 
 @interface WebCorePageState : NSObject
 {
-    WebCore::Document *document;
-    WebCore::Node *mousePressNode;
-    WebCore::KURL *URL;
-    KJS::SavedProperties *windowProperties;
-    KJS::SavedProperties *locationProperties;
-    KJS::SavedBuiltins *interpreterBuiltins;
-    KJS::PausedTimeouts *pausedTimeouts;
-    BOOL closed;
+    WebCore::PageState* m_impl;
 }
 }
-
-- 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;
-
-- (WebCore::Document *)document;
-- (WebCore::Node *)mousePressNode;
-- (WebCore::KURL *)URL;
-- (KJS::SavedProperties *)windowProperties;
-- (KJS::SavedProperties *)locationProperties;
-- (KJS::SavedBuiltins *)interpreterBuiltins;
-- (KJS::PausedTimeouts *)pausedTimeouts;
-- (void)invalidate;
-
+- (id)initWithPage:(WebCore::Page*)page;
+- (WebCore::PageState*)impl;
 @end
 @end
index 14650d518cc6f2fce7dc0e4489549cd2da29458e..9e086c3cfe0b0a4fe36496386ebb0caaf7213c9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #import "WebCorePageState.h"
 
 #import "Document.h"
 #import "WebCorePageState.h"
 
 #import "Document.h"
-#import "FoundationExtras.h"
-#import "FrameMac.h"
-#import "kjs_window.h"
-#import <kjs/SavedBuiltins.h>
+#import "Frame.h"
+#import "Page.h"
+#import "PageState.h"
 
 using namespace WebCore;
 
 using namespace WebCore;
-using namespace KJS;
 
 @implementation WebCorePageState
 
 
 @implementation WebCorePageState
 
-- (id)initWithDocument:(Document *)doc URL:(const KURL &)u windowProperties:(SavedProperties *)wp locationProperties:(SavedProperties *)lp interpreterBuiltins:(SavedBuiltins *)ib pausedTimeouts:(PausedTimeouts *)pt
+- (id)initWithPage:(Page*)page
 {
 {
-    [super init];
-
-    doc->ref();
-    document = doc;
-    doc->setInPageCache(YES);
-    
-    FrameMac *frame = static_cast<FrameMac *>(doc->frame());
-    mousePressNode = frame ? frame->mousePressNode() : 0;
-    if (mousePressNode)
-        mousePressNode->ref();
-    
-    URL = new KURL(u);
-    windowProperties = wp;
-    locationProperties = lp;
-    interpreterBuiltins = ib;
-    pausedTimeouts = pt;
-
-    doc->view()->ref();
-
-    return self;
-}
-
-- (PausedTimeouts *)pausedTimeouts
-{
-    return pausedTimeouts;
-}
-
-- (void)clear
-{
-    if (mousePressNode)
-        mousePressNode->deref();        
-    mousePressNode = 0;
-
-    delete URL;
-    URL = 0;
-
-    JSLock lock;
-
-    delete windowProperties;
-    windowProperties = 0;
-    delete locationProperties;
-    locationProperties = 0;
-    delete interpreterBuiltins;
-    interpreterBuiltins = 0;
-
-    delete pausedTimeouts;
-    pausedTimeouts = 0;
-
-    Collector::collect();
-}
-
-- (void)invalidate
-{
-    // Should only ever invalidate once.
-    ASSERT(document);
-    ASSERT(document->view());
-    ASSERT(!document->inPageCache());
-
-    if (document) {
-        FrameView *view = document->view();
-        if (view)
-            view->deref();
-        document->deref();
-        document = 0;
+    self = [super init];
+    if (!self)
+        return nil;
+
+    Document* document = page->mainFrame()->document();
+    if (!document || !document->view()) {
+        [self release];
+        return nil;
     }
 
     }
 
-    [self clear];
+    m_impl = WebCore::PageState::create(page).releaseRef();
+    return self;
 }
 
 - (void)dealloc
 {
 }
 
 - (void)dealloc
 {
-    ASSERT(closed);
+    m_impl->deref();
     [super dealloc];
 }
 
 - (void)finalize
 {
     [super dealloc];
 }
 
 - (void)finalize
 {
-    ASSERT(closed);
+    m_impl->deref();
     [super finalize];
 }
 
     [super finalize];
 }
 
-- (void)close
-{
-    if (closed)
-        return;
-    if (document) {
-        ASSERT(document->inPageCache());
-        ASSERT(document->view());
-
-        FrameView *view = document->view();
-
-        FrameMac::clearTimers(view);
-
-        bool detached = document->renderer() == 0;
-        document->setInPageCache(NO);
-        if (detached) {
-            document->detach();
-            document->removeAllEventListenersFromAllNodes();
-        }
-        document->deref();
-        document = 0;
-
-        if (view) {
-            view->clearPart();
-            view->deref();
-        }
-    }
-
-    [self clear];
-    closed = YES;
-}
-
-- (Document *)document
-{
-    return document;
-}
-
-- (WebCore::Node *)mousePressNode
-{
-    return mousePressNode;
-}
-
-- (KURL *)URL
-{
-    return URL;
-}
-
-- (SavedProperties *)windowProperties
-{
-    return windowProperties;
-}
-
-- (SavedProperties *)locationProperties
-{
-    return locationProperties;
-}
-
-- (SavedBuiltins *)interpreterBuiltins
+- (WebCore::PageState*)impl
 {
 {
-    return interpreterBuiltins;
+    return m_impl;
 }
 
 @end
 }
 
 @end
index 0e21234e32548c06308c3828ce9ad5ed326feddf..021241d7ab70d744f99fbd9bf986fa126cf6244f 100644 (file)
@@ -27,7 +27,6 @@
 #import "config.h"
 #import "WebCoreSettings.h"
 
 #import "config.h"
 #import "WebCoreSettings.h"
 
-#import "FoundationExtras.h"
 #import "Settings.h"
 #import "Page.h"
 #import "WebCoreFrameBridge.h"
 #import "Settings.h"
 #import "Page.h"
 #import "WebCoreFrameBridge.h"
index 76272f46d0079f134fffb80be914129d31458fbf..6b4a34ec803ff6f192897b2a2ccdfd11f491d859 100644 (file)
@@ -28,7 +28,6 @@
 #ifdef SVG_SUPPORT
 #import "KRenderingDeviceQuartz.h"
 
 #ifdef SVG_SUPPORT
 #import "KRenderingDeviceQuartz.h"
 
-#import "FoundationExtras.h"
 #import "GraphicsContext.h"
 #include "KCanvasMarker.h"
 #import "KCanvasFilterQuartz.h"
 #import "GraphicsContext.h"
 #include "KCanvasMarker.h"
 #import "KCanvasFilterQuartz.h"
index 2de02fbe14a9bef33e429405f691cb403a494ca9..6ae6365db68f73750433e86f65bb0c8ff89982d8 100644 (file)
 
 #ifdef __OBJC__
 
 
 #ifdef __OBJC__
 
-@class WebCorePageState;
-
 @class NSData;
 @class NSData;
-@class NSDate;
 @class NSDictionary;
 @class NSError;
 @class NSEvent;
 @class NSDictionary;
 @class NSError;
 @class NSEvent;
 @class NSURLRequest;
 @class NSURLResponse;
 
 @class NSURLRequest;
 @class NSURLResponse;
 
-@protocol WebCoreResourceLoader;
-@protocol WebCoreResourceHandle;
-
 #else
 
 #else
 
-class WebCorePageState;
-
 class NSData;
 class NSData;
-class NSDate;
 class NSDictionary;
 class NSError;
 class NSEvent;
 class NSMutableURLRequest;
 class NSDictionary;
 class NSError;
 class NSEvent;
 class NSMutableURLRequest;
-class NSString;
 class NSURL;
 class NSURLAuthenticationChallenge;
 class NSURLConnection;
 class NSURL;
 class NSURLAuthenticationChallenge;
 class NSURLConnection;
@@ -88,6 +78,7 @@ namespace WebCore {
     class Frame;
     class FrameLoadRequest;
     class FrameLoaderClient;
     class Frame;
     class FrameLoadRequest;
     class FrameLoaderClient;
+    class PageState;
     class KURL;
     class MainResourceLoader;
     class ResourceRequest;
     class KURL;
     class MainResourceLoader;
     class ResourceRequest;
@@ -282,7 +273,7 @@ namespace WebCore {
 
         void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
 #if PLATFORM(MAC)
 
         void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress);
 #if PLATFORM(MAC)
-        void clientRedirected(NSURL *, double delay, NSDate *fireDate, bool lockHistory, bool isJavaScriptFormAction);
+        void clientRedirected(NSURL *, double delay, double fireDate, bool lockHistory, bool isJavaScriptFormAction);
         void commitProvisionalLoad(NSDictionary *pageCache);
         bool shouldReload(NSURL *currentURL, NSURL *destinationURL);
 #endif
         void commitProvisionalLoad(NSDictionary *pageCache);
         bool shouldReload(NSURL *currentURL, NSURL *destinationURL);
 #endif
@@ -368,10 +359,7 @@ namespace WebCore {
         void setState(FrameState);
 
         void closeOldDataSources();
         void setState(FrameState);
 
         void closeOldDataSources();
-#if PLATFORM(MAC)
-        void open(NSURL *, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache);
-        void open(WebCorePageState *);
-#endif
+        void open(PageState&);
         void opened();
 
 #if PLATFORM(MAC)
         void opened();
 
 #if PLATFORM(MAC)
index 0945aa91d8b971ae179ce2fc2a53676434f23074..233fa5c96687fc53a78eefa85417bc7a08ee34ed 100644 (file)
@@ -112,7 +112,7 @@ namespace WebCore {
         virtual void dispatchDidHandleOnloadEvents() = 0;
         virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
         virtual void dispatchDidCancelClientRedirect() = 0;
         virtual void dispatchDidHandleOnloadEvents() = 0;
         virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0;
         virtual void dispatchDidCancelClientRedirect() = 0;
-        virtual void dispatchWillPerformClientRedirect(NSURL *URL, double, NSDate *) = 0;
+        virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate) = 0;
         virtual void dispatchDidChangeLocationWithinPage() = 0;
         virtual void dispatchWillClose() = 0;
         virtual void dispatchDidReceiveIcon(NSImage *) = 0;
         virtual void dispatchDidChangeLocationWithinPage() = 0;
         virtual void dispatchWillClose() = 0;
         virtual void dispatchDidReceiveIcon(NSImage *) = 0;
index 8e26c8d531ec4e004dad8c205185600da7a19afd..be3ef3c38335e5e2077c9628ae576697c2b8c292 100644 (file)
 #import "Cache.h"
 #import "DOMElementInternal.h"
 #import "Document.h"
 #import "Cache.h"
 #import "DOMElementInternal.h"
 #import "Document.h"
+#import "DocumentLoader.h"
 #import "Element.h"
 #import "Element.h"
+#import "FormDataStream.h"
+#import "FormState.h"
 #import "FrameLoadRequest.h"
 #import "FrameLoaderClient.h"
 #import "FrameMac.h"
 #import "FramePrivate.h"
 #import "FrameLoadRequest.h"
 #import "FrameLoaderClient.h"
 #import "FrameMac.h"
 #import "FramePrivate.h"
+#import "PageState.h"
 #import "FrameTree.h"
 #import "HTMLNames.h"
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
 #import "FrameTree.h"
 #import "HTMLNames.h"
 #import "LoaderNSURLExtras.h"
 #import "LoaderNSURLRequestExtras.h"
+#import "MainResourceLoader.h"
 #import "Page.h"
 #import "Plugin.h"
 #import "ResourceResponse.h"
 #import "ResourceResponseMac.h"
 #import "Page.h"
 #import "Plugin.h"
 #import "ResourceResponse.h"
 #import "ResourceResponseMac.h"
+#import "SubresourceLoader.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreIconDatabaseBridge.h"
 #import "WebCorePageState.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
 #import "WebCoreFrameBridge.h"
 #import "WebCoreIconDatabaseBridge.h"
 #import "WebCorePageState.h"
 #import "WebCoreSystemInterface.h"
 #import "WebDataProtocol.h"
-#import "DocumentLoader.h"
-#import "FormDataStream.h"
-#import "FormState.h"
-#import "MainResourceLoader.h"
-#import "SubresourceLoader.h"
 #import <kjs/JSLock.h>
 #import <wtf/Assertions.h>
 
 #import <kjs/JSLock.h>
 #import <wtf/Assertions.h>
 
@@ -712,6 +713,13 @@ void FrameLoader::receivedMainResourceError(NSError *error, bool isComplete)
     if (m_state == FrameStateProvisional) {
         NSURL *failedURL = [m_provisionalDocumentLoader->originalRequestCopy() URL];
         m_frame->didNotOpenURL(failedURL);
     if (m_state == FrameStateProvisional) {
         NSURL *failedURL = [m_provisionalDocumentLoader->originalRequestCopy() URL];
         m_frame->didNotOpenURL(failedURL);
+
+        // We might have made a page cache item, but now we're bailing out due to an error before we ever
+        // transitioned to the new page (before WebFrameState == commit).  The goal here is to restore any state
+        // so that the existing view (that wenever got far enough to replace) can continue being used.
+        Document* document = m_frame->document();
+        if (document)
+            document->setInPageCache(false);
         m_client->invalidateCurrentItemPageCache();
         
         // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's
         m_client->invalidateCurrentItemPageCache();
         
         // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's
@@ -740,9 +748,9 @@ void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgres
     m_sentRedirectNotification = false;
 }
 
     m_sentRedirectNotification = false;
 }
 
-void FrameLoader::clientRedirected(NSURL *URL, double seconds, NSDate *date, bool lockHistory, bool isJavaScriptFormAction)
+void FrameLoader::clientRedirected(NSURL *URL, double seconds, double fireDate, bool lockHistory, bool isJavaScriptFormAction)
 {
 {
-    m_client->dispatchWillPerformClientRedirect(URL, seconds, date);
+    m_client->dispatchWillPerformClientRedirect(URL, seconds, fireDate);
     
     // Remember that we sent a redirect notification to the frame load delegate so that when we commit
     // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
     
     // Remember that we sent a redirect notification to the frame load delegate so that when we commit
     // the next provisional load, we can send a corresponding -webView:didCancelClientRedirectForFrame:
@@ -819,45 +827,12 @@ void FrameLoader::closeOldDataSources()
     m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers
 }
 
     m_client->setMainFrameDocumentReady(false); // stop giving out the actual DOMDocument to observers
 }
 
-void FrameLoader::open(NSURL *URL, bool reload, NSString *contentType, NSString *refresh, NSDate *lastModified, NSDictionary *pageCache)
+void FrameLoader::open(PageState& state)
 {
 {
-    if (pageCache) {
-        WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
-        open(state);
-        [state invalidate];
-        return;
-    }
-        
-    m_frame->setResponseMIMEType(contentType);
-    
-    // opening the URL
-    if (m_frame->didOpenURL(URL)) {
-        // things we have to set up after calling didOpenURL
-        if (refresh)
-            m_frame->addMetaData("http-refresh", refresh);
-        if (lastModified) {
-            NSString *modifiedString = [lastModified descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil];
-            m_frame->addMetaData("modified", modifiedString);
-        }
-    }
-}
+    ASSERT(m_frame->page()->mainFrame() == m_frame);
 
 
-void FrameLoader::open(WebCorePageState *state)
-{
     FramePrivate* d = m_frame->d;
 
     FramePrivate* d = m_frame->d;
 
-    // It's safe to assume none of the WebCorePageState methods will raise
-    // exceptions, since WebCorePageState is implemented by WebCore and
-    // does not throw
-
-    Document* doc = [state document];
-    Node* mousePressNode = [state mousePressNode];
-    KURL URL = *[state URL];
-    SavedProperties* windowProperties = [state windowProperties];
-    SavedProperties* locationProperties = [state locationProperties];
-    SavedBuiltins* interpreterBuiltins = [state interpreterBuiltins];
-    PausedTimeouts* timeouts = [state pausedTimeouts];
-    
     m_frame->cancelRedirection();
 
     // We still have to close the previous part page.
     m_frame->cancelRedirection();
 
     // We still have to close the previous part page.
@@ -873,7 +848,9 @@ void FrameLoader::open(WebCorePageState *state)
         d->m_kjsStatusBarText = String();
         d->m_kjsDefaultStatusBarText = String();
     }
         d->m_kjsStatusBarText = String();
         d->m_kjsDefaultStatusBarText = String();
     }
-    
+
+    KURL URL = state.URL();
+
     if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
         URL.setPath("/");
     
     if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
         URL.setPath("/");
     
@@ -884,29 +861,23 @@ void FrameLoader::open(WebCorePageState *state)
 
     m_frame->clear();
 
 
     m_frame->clear();
 
-    doc->setInPageCache(false);
+    Document* document = state.document();
+    document->setInPageCache(false);
 
     d->m_bCleared = false;
     d->m_bComplete = false;
     d->m_bLoadEventEmitted = false;
     d->m_referrer = URL.url();
     
 
     d->m_bCleared = false;
     d->m_bComplete = false;
     d->m_bLoadEventEmitted = false;
     d->m_referrer = URL.url();
     
-    m_frame->setView(doc->view());
+    m_frame->setView(document->view());
     
     
-    d->m_doc = doc;
-    d->m_mousePressNode = mousePressNode;
-    d->m_decoder = doc->decoder();
+    d->m_doc = document;
+    d->m_mousePressNode = state.mousePressNode();
+    d->m_decoder = document->decoder();
 
     m_frame->updatePolicyBaseURL();
 
 
     m_frame->updatePolicyBaseURL();
 
-    { // scope the lock
-        JSLock lock;
-        m_frame->restoreWindowProperties(windowProperties);
-        m_frame->restoreLocationProperties(locationProperties);
-        m_frame->restoreInterpreterBuiltins(*interpreterBuiltins);
-    }
-
-    m_frame->resumeTimeouts(timeouts);
+    state.restoreJavaScriptState(m_frame->page());
 
     m_frame->checkCompleted();
 }
 
     m_frame->checkCompleted();
 }
@@ -944,15 +915,8 @@ void FrameLoader::opened()
 
 void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
 {
 
 void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
 {
-    bool reload = m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadAllowingStaleData;
-    
     RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
     
     RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
     
-    NSURLResponse *response = pdl->response();
-    
-    NSDictionary *headers = [response isKindOfClass:[NSHTTPURLResponse class]]
-        ? [(NSHTTPURLResponse *)response allHeaderFields] : nil;
-    
     if (m_loadType != FrameLoadTypeReplace)
         closeOldDataSources();
     
     if (m_loadType != FrameLoadTypeReplace)
         closeOldDataSources();
     
@@ -968,15 +932,28 @@ void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache)
     if (m_sentRedirectNotification)
         clientRedirectCancelledOrFinished(false);
     
     if (m_sentRedirectNotification)
         clientRedirectCancelledOrFinished(false);
     
-    NSURL *baseURL = [pdl->request() _webDataRequestBaseURL];        
-    NSURL *URL = baseURL ? baseURL : [response URL];
-    
-    if (!URL || urlIsEmpty(URL))
-        URL = [NSURL URLWithString:@"about:blank"];    
-    
-    NSDate *lastModified = pageCache ? nil : wkGetNSURLResponseLastModifiedDate(response);
-
-    open(URL, reload, [response MIMEType], [headers objectForKey:@"Refresh"], lastModified, pageCache);
+    WebCorePageState *pageState = [pageCache objectForKey:WebCorePageCacheStateKey];
+    if (PageState* frameState = [pageState impl]) {
+        open(*frameState);
+        frameState->clear();
+    } else {
+        NSURLResponse *response = pdl->response();
+    
+        NSURL *URL = [pdl->request() _webDataRequestBaseURL];
+        if (!URL)
+            URL = [response URL];
+        if (!URL || urlIsEmpty(URL))
+            URL = [NSURL URLWithString:@"about:blank"];    
+
+        m_frame->setResponseMIMEType([response MIMEType]);
+        if (m_frame->didOpenURL(URL)) {
+            if ([response isKindOfClass:[NSHTTPURLResponse class]])
+                if (NSString *refresh = [[(NSHTTPURLResponse *)response allHeaderFields] objectForKey:@"Refresh"])
+                    m_frame->addMetaData("http-refresh", refresh);
+            m_frame->addMetaData("modified", [wkGetNSURLResponseLastModifiedDate(response)
+                descriptionWithCalendarFormat:@"%a %b %d %Y %H:%M:%S" timeZone:nil locale:nil]);
+        }
+    }
     opened();
 }
 
     opened();
 }
 
diff --git a/WebCore/page/PageState.cpp b/WebCore/page/PageState.cpp
new file mode 100644 (file)
index 0000000..99aeee2
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "PageState.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "Page.h"
+#include "kjs_window.h"
+#include <kjs/JSLock.h>
+#include <kjs/property_map.h>
+#include <kjs/SavedBuiltins.h>
+
+using KJS::Collector;
+using KJS::JSLock;
+using KJS::SavedBuiltins;
+using KJS::SavedProperties;
+
+namespace WebCore {
+
+PassRefPtr<PageState> PageState::create(Page* page)
+{
+    return new PageState(page);
+}
+
+PageState::PageState(Page* page)
+    : m_document(page->mainFrame()->document())
+    , m_view(page->mainFrame()->view())
+    , m_mousePressNode(page->mainFrame()->mousePressNode())
+    , m_URL(page->mainFrame()->url())
+    , m_windowProperties(new SavedProperties)
+    , m_locationProperties(new SavedProperties)
+    , m_interpreterBuiltins(new SavedBuiltins)
+{
+    Frame* mainFrame = page->mainFrame();
+
+    mainFrame->clearTimers();
+
+    JSLock lock;
+
+    mainFrame->saveWindowProperties(m_windowProperties.get());
+    mainFrame->saveLocationProperties(m_locationProperties.get());
+    mainFrame->saveInterpreterBuiltins(*m_interpreterBuiltins.get());
+    m_pausedTimeouts.set(mainFrame->pauseTimeouts());
+
+    m_document->setInPageCache(true);
+}
+
+PageState::~PageState()
+{
+    clear();
+}
+
+void PageState::restoreJavaScriptState(Page* page)
+{
+    Frame* mainFrame = page->mainFrame();
+
+    JSLock lock;
+    mainFrame->restoreWindowProperties(m_windowProperties.get());
+    mainFrame->restoreLocationProperties(m_locationProperties.get());
+    mainFrame->restoreInterpreterBuiltins(*m_interpreterBuiltins.get());
+    mainFrame->resumeTimeouts(m_pausedTimeouts.get());
+}
+
+void PageState::clear()
+{
+    if (!m_document)
+        return;
+
+    ASSERT(m_view);
+    ASSERT(m_document->view() == m_view);
+
+    if (m_document->inPageCache()) {
+        Frame::clearTimers(m_view.get());
+
+        bool detached = !m_document->renderer();
+        m_document->setInPageCache(false);
+        if (detached) {
+            m_document->detach();
+            m_document->removeAllEventListenersFromAllNodes();
+        }
+
+        m_view->clearPart();
+    }
+
+    ASSERT(!m_document->inPageCache());
+
+    m_document = 0;
+    m_view = 0;
+    m_mousePressNode = 0;
+    m_URL = KURL();
+
+    JSLock lock;
+
+    m_windowProperties.clear();
+    m_locationProperties.clear();
+    m_interpreterBuiltins.clear();
+    m_pausedTimeouts.clear();
+
+    Collector::collect();
+}
+
+}
diff --git a/WebCore/page/PageState.h b/WebCore/page/PageState.h
new file mode 100644 (file)
index 0000000..f322f94
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "KURL.h"
+#include "Shared.h"
+#include <wtf/Forward.h>
+#include <wtf/OwnPtr.h>
+
+namespace KJS {
+    class PausedTimeouts;
+    class SavedBuiltins;
+    class SavedProperties;
+}
+
+namespace WebCore {
+
+    class Document;
+    class FrameView;
+    class Node;
+    class Page;
+
+    class PageState : public Shared<PageState> {
+    public:
+        static PassRefPtr<PageState> create(Page*);
+        ~PageState();
+
+        void clear();
+
+        Document* document() { return m_document.get(); }
+        Node* mousePressNode() { return m_mousePressNode.get(); }
+        const KURL& URL() { return m_URL; }
+
+        void restoreJavaScriptState(Page*);
+
+    private:
+        PageState(Page*);
+
+        RefPtr<Document> m_document;
+        RefPtr<FrameView> m_view;
+        RefPtr<Node> m_mousePressNode;
+        KURL m_URL;
+        OwnPtr<KJS::SavedProperties> m_windowProperties;
+        OwnPtr<KJS::SavedProperties> m_locationProperties;
+        OwnPtr<KJS::SavedBuiltins> m_interpreterBuiltins;
+        OwnPtr<KJS::PausedTimeouts> m_pausedTimeouts;
+    };
+
+}
index 46f612f3b3bc67e40e27bb7cc6a884fcf20b72f3..349d46173177971d91646732d6061f6e317c8e3b 100644 (file)
@@ -29,7 +29,6 @@
 #import "BlockExceptions.h"
 #import "FontData.h"
 #import "FontFallbackList.h"
 #import "BlockExceptions.h"
 #import "FontData.h"
 #import "FontFallbackList.h"
-#import "FoundationExtras.h"
 #import "GlyphBuffer.h"
 #import "GraphicsContext.h"
 #import "IntRect.h"
 #import "GlyphBuffer.h"
 #import "GraphicsContext.h"
 #import "IntRect.h"
index 768f27d043e6758c913268fa35d8f444973ea1a8..f96284728d0faf2f91da3f5fc1188fa9a59eb4c5 100644 (file)
@@ -28,7 +28,6 @@
 
 #import "Cursor.h"
 #import "Font.h"
 
 #import "Cursor.h"
 #import "Font.h"
-#import "FoundationExtras.h"
 #import "GraphicsContext.h"
 #import "BlockExceptions.h"
 #import "FrameMac.h"
 #import "GraphicsContext.h"
 #import "BlockExceptions.h"
 #import "FrameMac.h"
index d86ddb2421ecc64fae0f0a0fb1cc8aae01414773..38cbd29dbcec32994bbbe14f8cc1c261d64810ff 100644 (file)
@@ -29,7 +29,6 @@
 
 #import "BlockExceptions.h"
 #import "DocLoader.h"
 
 #import "BlockExceptions.h"
 #import "DocLoader.h"
-#import "FoundationExtras.h"
 #import "FrameLoader.h"
 #import "FrameMac.h"
 #import "KURL.h"
 #import "FrameLoader.h"
 #import "FrameMac.h"
 #import "KURL.h"
index 29e5c2703e3af5f5d77f4626817dce030bf8d561..63e7ee4358878ca8592310bc161bd269165b1baf 100644 (file)
@@ -1,3 +1,30 @@
+2006-10-30  Darin Adler  <darin@apple.com>
+
+        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.
+
 2006-10-29  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
 2006-10-29  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
index 4d63aed7309f28a618d0ccc3e290964b048560c2..73ba401b2cbc8048b2b41f350684ead11db7c3bb 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import <WebKit/WebHistoryItemPrivate.h>
-
+#import "WebHistoryItemPrivate.h"
+
+#import "WebFrameBridge.h"
+#import "WebFrameInternal.h"
+#import "WebFrameView.h"
+#import "WebHTMLViewInternal.h"
+#import "WebIconDatabase.h"
+#import "WebKitLogging.h"
+#import "WebKitNSStringExtras.h"
+#import "WebNSDictionaryExtras.h"
+#import "WebNSObjectExtras.h"
+#import "WebNSURLExtras.h"
+#import "WebNSURLRequestExtras.h"
+#import "WebNSViewExtras.h"
+#import "WebPluginController.h"
 #import <JavaScriptCore/Assertions.h>
 #import <JavaScriptCore/Assertions.h>
-#import <WebKit/WebFrameBridge.h>
-#import <WebKit/WebFrameInternal.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebHTMLViewInternal.h>
-#import <WebKit/WebIconDatabase.h>
-#import <WebKit/WebKitLogging.h>
-#import <WebKit/WebKitNSStringExtras.h>
-#import <WebKit/WebNSDictionaryExtras.h>
-#import <WebKit/WebNSObjectExtras.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSURLRequestExtras.h>
-#import <WebKit/WebNSViewExtras.h>
-#import <WebKit/WebPluginController.h>
+#import <WebCore/PageState.h>
+#import <WebCore/WebCorePageState.h>
 #import <WebKitSystemInterface.h>
 
 // Private keys used in the WebHistoryItem's dictionary representation.
 #import <WebKitSystemInterface.h>
 
 // Private keys used in the WebHistoryItem's dictionary representation.
@@ -713,9 +715,8 @@ static NSTimer *_pageCacheReleaseTimer = nil;
                 [HTMLView close];
         }
 
                 [HTMLView close];
         }
 
-        id pageState = [pageCache objectForKey:WebCorePageCacheStateKey];
-        if ([pageState respondsToSelector:@selector(close)])
-            [pageState performSelector:@selector(close)];
+        if (WebCorePageState *pageState = [pageCache objectForKey:WebCorePageCacheStateKey])
+            [pageState impl]->clear();
     }
 }
 
     }
 }
 
index 398a23a3d1ec72ab7e3214e7de9b299dcd613a35..a02f99bc1f6615e2eab1870583a80e2ecef25ec3 100644 (file)
@@ -570,16 +570,6 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
     return [[_frame _itemForRestoringDocState] documentState];
 }
 
     return [[_frame _itemForRestoringDocState] documentState];
 }
 
-- (BOOL)saveDocumentToPageCache:(id)documentInfo
-{
-    WebHistoryItem *item = [_frame _itemForSavingDocState];
-    if (![item hasPageCache]) {
-        return NO;
-    }
-    [[item pageCache] setObject:documentInfo forKey:WebCorePageCacheStateKey];
-    return YES;
-}
-
 - (NSString *)userAgentForURL:(NSURL *)URL
 {
     return [[self webView] userAgentForURL:URL];
 - (NSString *)userAgentForURL:(NSURL *)URL
 {
     return [[self webView] userAgentForURL:URL];
index 2cb7db4de58d3925c5d7a7fdfd0047af8ef68ce3..d0a1bd98d684fd3f9745db14ccb4ff7a9c32052b 100644 (file)
@@ -109,7 +109,7 @@ private:
     virtual void dispatchDidHandleOnloadEvents();
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
     virtual void dispatchDidCancelClientRedirect();
     virtual void dispatchDidHandleOnloadEvents();
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
     virtual void dispatchDidCancelClientRedirect();
-    virtual void dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval, NSDate *);
+    virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate);
     virtual void dispatchDidChangeLocationWithinPage();
     virtual void dispatchWillClose();
     virtual void dispatchDidReceiveIcon(NSImage *);
     virtual void dispatchDidChangeLocationWithinPage();
     virtual void dispatchWillClose();
     virtual void dispatchDidReceiveIcon(NSImage *);
index 6830bf1f614e998520fc92a3c188f9b8d72c9123..37adc42b53fb788556ab6623028d6e4217a2828b 100644 (file)
@@ -35,6 +35,7 @@
 
 #import "WebBackForwardList.h"
 #import "WebDataSourceInternal.h"
 
 #import "WebBackForwardList.h"
 #import "WebDataSourceInternal.h"
+#import "WebDefaultResourceLoadDelegate.h"
 #import "WebDocumentInternal.h"
 #import "WebDocumentLoaderMac.h"
 #import "WebDownloadInternal.h"
 #import "WebDocumentInternal.h"
 #import "WebDocumentLoaderMac.h"
 #import "WebDownloadInternal.h"
 #import "WebScriptDebugServerPrivate.h"
 #import "WebUIDelegate.h"
 #import "WebViewInternal.h"
 #import "WebScriptDebugServerPrivate.h"
 #import "WebUIDelegate.h"
 #import "WebViewInternal.h"
+#import <WebCore/Document.h>
+#import <WebCore/DocumentLoader.h>
+#import <WebCore/FormState.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameLoaderTypes.h>
 #import <WebCore/FrameMac.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameLoaderTypes.h>
 #import <WebCore/FrameMac.h>
+#import <WebCore/PageState.h>
 #import <WebCore/FrameTree.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformString.h>
 #import <WebCore/FrameTree.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformString.h>
+#import <WebCore/ResourceLoader.h>
 #import <WebCore/WebCoreFrameBridge.h>
 #import <WebCore/WebCoreFrameBridge.h>
+#import <WebCore/WebCorePageState.h>
 #import <WebCore/WebDataProtocol.h>
 #import <WebCore/WebDataProtocol.h>
-#import <WebCore/DocumentLoader.h>
-#import <WebCore/FormState.h>
-#import <WebCore/ResourceLoader.h>
 #import <WebKit/DOMElement.h>
 #import <WebKit/DOMElement.h>
-#import <WebKit/WebDefaultResourceLoadDelegate.h>
-#import <WebKit/WebDocumentLoaderMac.h>
-#import <WebKit/WebResourceLoadDelegate.h>
-#import <WebKit/WebViewInternal.h>
 #import <WebKitSystemInterface.h>
 #import <WebKitSystemInterface.h>
-#import <objc/objc-runtime.h>
 #import <wtf/PassRefPtr.h>
 
 using namespace WebCore;
 #import <wtf/PassRefPtr.h>
 
 using namespace WebCore;
@@ -163,7 +162,16 @@ void WebFrameLoaderClient::invalidateCurrentItemPageCache()
     // When we are pre-commit, the currentItem is where the pageCache data resides
     WebHistoryItem *currentItem = m_webFrame->_private->currentItem;
     NSDictionary *pageCache = [currentItem pageCache];
     // When we are pre-commit, the currentItem is where the pageCache data resides
     WebHistoryItem *currentItem = m_webFrame->_private->currentItem;
     NSDictionary *pageCache = [currentItem pageCache];
-    [m_webFrame->_private->bridge invalidatePageCache:pageCache];
+    WebCorePageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
+    WebCore::PageState* pageState = [state impl];
+
+    // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach
+    // Somehow the WebCorePageState object is not properly updated, and is holding onto a stale document.
+    // Both Xcode and FileMaker see this crash, Safari does not.
+    ASSERT(!pageState || pageState->document() == core(m_webFrame.get())->document());
+    if (pageState && pageState->document() == core(m_webFrame.get())->document())
+        pageState->clear();
+
     // We're assuming that WebCore invalidates its pageCache state in didNotOpen:pageCache:
     [currentItem setHasPageCache:NO];
 }
     // We're assuming that WebCore invalidates its pageCache state in didNotOpen:pageCache:
     [currentItem setHasPageCache:NO];
 }
@@ -532,13 +540,13 @@ void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
     [[webView _frameLoadDelegateForwarder] webView:webView didCancelClientRedirectForFrame:m_webFrame.get()];
 }
 
     [[webView _frameLoadDelegateForwarder] webView:webView didCancelClientRedirectForFrame:m_webFrame.get()];
 }
 
-void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval delay, NSDate *fireDate)
+void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, double delay, double fireDate)
 {
 {
-    WebView *webView = getWebView(m_webFrame.get());   
+    WebView *webView = getWebView(m_webFrame.get());
     [[webView _frameLoadDelegateForwarder] webView:webView
                          willPerformClientRedirectToURL:URL
                                                   delay:delay
     [[webView _frameLoadDelegateForwarder] webView:webView
                          willPerformClientRedirectToURL:URL
                                                   delay:delay
-                                               fireDate:fireDate
+                                               fireDate:[NSDate dateWithTimeIntervalSince1970:fireDate]
                                                forFrame:m_webFrame.get()];
 }
 
                                                forFrame:m_webFrame.get()];
 }
 
@@ -1124,16 +1132,23 @@ void WebFrameLoaderClient::deliverArchivedResources(Timer<WebFrameLoaderClient>*
 
 bool WebFrameLoaderClient::createPageCache(WebHistoryItem *item)
 {
 
 bool WebFrameLoaderClient::createPageCache(WebHistoryItem *item)
 {
-    [item setHasPageCache:YES];
-    if (![m_webFrame->_private->bridge saveDocumentToPageCache]) {
+    WebCorePageState *pageState = [[WebCorePageState alloc] initWithPage:core(m_webFrame.get())->page()];
+    if (!pageState) {
         [item setHasPageCache:NO];
         [item setHasPageCache:NO];
-        return NO;
+        return false;
     }
     }
+
+    [item setHasPageCache:YES];
     NSMutableDictionary *pageCache = [item pageCache];
     NSMutableDictionary *pageCache = [item pageCache];
-    [pageCache setObject:[NSDate date] forKey: WebPageCacheEntryDateKey];
-    [pageCache setObject:[m_webFrame.get() dataSource] forKey: WebPageCacheDataSourceKey];
-    [pageCache setObject:[m_webFrame->_private->webFrameView documentView] forKey: WebPageCacheDocumentViewKey];
-    return YES;
+
+    [pageCache setObject:pageState forKey:WebCorePageCacheStateKey];
+    [pageCache setObject:[NSDate date] forKey:WebPageCacheEntryDateKey];
+    [pageCache setObject:[m_webFrame.get() dataSource] forKey:WebPageCacheDataSourceKey];
+    [pageCache setObject:[m_webFrame->_private->webFrameView documentView] forKey:WebPageCacheDocumentViewKey];
+
+    [pageState release];
+
+    return true;
 }
 
 WebFramePolicyListener *WebFrameLoaderClient::setUpPolicyListener(FramePolicyFunction function)
 }
 
 WebFramePolicyListener *WebFrameLoaderClient::setUpPolicyListener(FramePolicyFunction function)
index 8e2779a98fd9be8308f3604bab4e5dcf4307426f..9a5fae1e1aff4107ae9baf96b3967d2ffbff53e1 100644 (file)
@@ -1050,7 +1050,19 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (NSColor *)_bodyBackgroundColor
 {
 
 - (NSColor *)_bodyBackgroundColor
 {
-    return core(self)->bodyBackgroundColor();
+    Document* document = core(self)->document();
+    if (!document)
+        return nil;
+    HTMLElement* body = document->body();
+    if (!body)
+        return nil;
+    RenderObject* bodyRenderer = body->renderer();
+    if (!bodyRenderer)
+        return nil;
+    Color color = bodyRenderer->style()->backgroundColor();
+    if (!color.isValid())
+        return nil;
+    return nsColor(color);
 }
 
 - (BOOL)_isFrameSet
 }
 
 - (BOOL)_isFrameSet