Changeset 17438 in webkit
- Timestamp:
- Oct 30, 2006 9:20:05 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r17435 r17438 1 2006-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 1 45 2006-10-29 Maciej Stachowiak <mjs@apple.com> 2 46 -
trunk/WebCore/WebCore.exp
r17431 r17438 114 114 .objc_class_name_WebCoreKeyGenerator 115 115 .objc_class_name_WebCorePageBridge 116 .objc_class_name_WebCorePageState 116 117 .objc_class_name_WebCoreScriptDebugger 117 118 .objc_class_name_WebCoreSettings … … 180 181 __ZN7WebCore4KURLC1EP5NSURL 181 182 __ZN7WebCore4Page16setDefersLoadingEb 183 __ZN7WebCore5Frame11clearTimersEv 182 184 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE 183 185 __ZN7WebCore5Frame12canCachePageEv 184 186 __ZN7WebCore5Frame12ownerElementEv 187 __ZN7WebCore5Frame13pauseTimeoutsEv 185 188 __ZN7WebCore5Frame14scrollToAnchorERKNS_4KURLE 186 189 __ZN7WebCore5Frame17setWindowHasFocusEb 187 190 __ZN7WebCore5Frame20hitTestResultAtPointERKNS_8IntPointEb 191 __ZN7WebCore5Frame20saveWindowPropertiesEPN3KJS15SavedPropertiesE 188 192 __ZN7WebCore5Frame20setSelectionFromNoneEv 189 193 __ZN7WebCore5Frame21setProhibitsScrollingEb 194 __ZN7WebCore5Frame22saveLocationPropertiesEPN3KJS15SavedPropertiesE 195 __ZN7WebCore5Frame23saveInterpreterBuiltinsERN3KJS13SavedBuiltinsE 190 196 __ZN7WebCore5Frame26isSelectionInPasswordFieldEv 191 197 __ZN7WebCore5Frame6indentEv … … 195 201 __ZN7WebCore6StringC1EP8NSString 196 202 __ZN7WebCore6StringC1EPKc 203 __ZN7WebCore7nsColorERKNS_5ColorE 197 204 __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE 205 __ZN7WebCore8Document4bodyEv 198 206 __ZN7WebCore8FrameMac10mouseMovedEP7NSEvent 199 207 __ZN7WebCore8FrameMac10wheelEventEP7NSEvent … … 217 225 __ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE 218 226 __ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE 227 __ZN7WebCore9PageState5clearEv 219 228 __ZN7WebCore9TimerBase4stopEv 220 229 __ZN7WebCore9TimerBase5startEdd … … 265 274 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv 266 275 __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv 276 __ZNK7WebCore5Frame3urlEv 267 277 __ZNK7WebCore5Frame4pageEv 268 278 __ZNK7WebCore5Frame4treeEv … … 276 286 __ZNK7WebCore8FrameMac14selectionImageEb 277 287 __ZNK7WebCore8FrameMac17eventMayStartDragEP7NSEvent 278 __ZNK7WebCore8FrameMac19bodyBackgroundColorEv279 288 __ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv 280 289 __ZNK7WebCore9FloatRectcv6CGRectEv -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r17435 r17438 1509 1509 93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */; }; 1510 1510 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, ); }; }; 1511 1513 93E47C5C09BE2BBB0019C5C1 /* PageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */; }; 1512 1514 93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E62D990985F41600E1B5E3 /* SystemTime.h */; }; … … 1539 1541 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851502DE375901EA4122 /* DeprecatedPtrListImpl.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1540 1542 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, ); }; }; 1542 1544 93F1998208245E59001E9ABC /* DeprecatedPtrList.h in Headers */ = {isa = PBXBuildFile; fileRef = F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1543 1545 93F1998308245E59001E9ABC /* DeprecatedPtrQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786AD02DE3B8601EA4122 /* DeprecatedPtrQueue.h */; }; … … 4396 4398 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoader.cpp; sourceTree = "<group>"; }; 4397 4399 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>"; }; 4398 4402 93E47C5B09BE2BBB0019C5C1 /* PageMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PageMac.mm; sourceTree = "<group>"; }; 4399 4403 93E62D990985F41600E1B5E3 /* SystemTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemTime.h; sourceTree = "<group>"; }; … … 6477 6481 65FEA86809833ADE00BED4AB /* Page.cpp */, 6478 6482 65A21467097A329100B9050A /* Page.h */, 6483 93E22A720AF5E94C00D48324 /* PageState.h */, 6484 93E22A6E0AF5E94100D48324 /* PageState.cpp */, 6479 6485 65D1C1C909932B22000CB324 /* Plugin.h */, 6480 6486 F587863A02DE3A1401EA4122 /* Settings.h */, … … 10483 10489 930500200AF025D300FFF491 /* ClipboardAccessPolicy.h in Headers */, 10484 10490 9307F1D80AF2D59000DBA31A /* HitTestResult.h in Headers */, 10491 93E22A730AF5E94C00D48324 /* PageState.h in Headers */, 10485 10492 658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */, 10486 10493 6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */, … … 11717 11724 654F68880AF1B7C50065BDD6 /* CachedResourceMac.mm in Sources */, 11718 11725 9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */, 11719 11726 6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */, 11720 11727 932E16090AF578340025F408 /* FrameLoader.cpp in Sources */, 11721 11728 93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */, … … 11724 11731 93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */, 11725 11732 93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */, 11733 93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */, 11726 11734 ); 11727 11735 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/objc/DOMHTML.mm
r16947 r17438 32 32 #import "DOMPrivate.h" 33 33 #import "DocumentFragment.h" 34 #import "FoundationExtras.h"35 34 #import "FrameView.h" 36 35 #import "HTMLDocument.h" -
trunk/WebCore/bridge/mac/FrameMac.h
r17408 r17438 29 29 #import "ClipboardAccessPolicy.h" 30 30 #import "Frame.h" 31 #import "IntRect.h"32 31 #import "PlatformMouseEvent.h" 33 32 #import "StringHash.h" … … 37 36 38 37 namespace KJS { 39 class PausedTimeouts;40 class SavedProperties;41 class SavedBuiltins;42 class ScheduledAction;43 38 namespace Bindings { 44 39 class Instance; … … 49 44 #ifdef __OBJC__ 50 45 51 @class WebCorePageState;52 46 @class NSArray; 53 47 @class NSAttributedString; 54 @class NSColor;55 48 @class NSDictionary; 56 49 @class NSEvent; … … 60 53 @class NSMenu; 61 54 @class NSMutableDictionary; 62 @class NSResponder;63 55 @class NSString; 64 56 @class NSView; … … 68 60 #else 69 61 70 class WebCorePageState;71 62 class NSArray; 72 63 class NSAttributedString; 73 class NSColor;74 64 class NSDictionary; 75 65 class NSEvent; … … 79 69 class NSMenu; 80 70 class NSMutableDictionary; 81 class NSResponder;82 71 class NSString; 83 72 class NSView; … … 93 82 94 83 class ClipboardMac; 95 class DocumentFragment;96 84 class EditorClient; 97 class FramePrivate;98 85 class HTMLTableCellElement; 99 class RenderObject;100 class RenderStyle;101 86 class VisiblePosition; 102 103 struct DashboardRegionValue;104 87 105 88 enum SelectionDirection { … … 234 217 235 218 virtual String overrideMediaType() const; 236 237 NSColor* bodyBackgroundColor() const;238 219 239 220 WebCoreKeyboardUIMode keyboardUIMode() const; -
trunk/WebCore/bridge/mac/FrameMac.mm
r17431 r17438 38 38 #import "DOMInternal.h" 39 39 #import "DOMWindow.h" 40 #import " TextResourceDecoder.h"40 #import "DocumentLoader.h" 41 41 #import "Event.h" 42 42 #import "EventNames.h" … … 73 73 #import "RenderView.h" 74 74 #import "ResourceHandle.h" 75 #import "SystemTime.h" 75 76 #import "TextIterator.h" 77 #import "TextResourceDecoder.h" 76 78 #import "WebCoreEditCommand.h" 77 79 #import "WebCoreFrameBridge.h" 78 #import "WebCorePageState.h"79 80 #import "WebCoreSystemInterface.h" 80 81 #import "WebCoreViewFactory.h" 81 82 #import "WebDashboardRegion.h" 82 #import "DocumentLoader.h"83 83 #import "WebScriptObjectPrivate.h" 84 84 #import "csshelper.h" … … 708 708 // Don't report history navigations, just actual redirection. 709 709 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(); 712 711 loader()->clientRedirected(KURL(d->m_redirectURL).getNSURL(), 713 712 d->m_delayRedirect, fireDate, d->m_redirectLockHistory, d->m_executingJavaScriptFormAction); 714 [fireDate release];715 713 } 716 714 } … … 2711 2709 } 2712 2710 2713 NSColor *FrameMac::bodyBackgroundColor() const2714 {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 2723 2711 WebCoreKeyboardUIMode FrameMac::keyboardUIMode() const 2724 2712 { -
trunk/WebCore/bridge/mac/WebCoreAXObject.mm
r17402 r17438 31 31 #import "EventNames.h" 32 32 #import "FontData.h" 33 #import "FoundationExtras.h"34 33 #import "FrameMac.h" 35 34 #import "HTMLAreaElement.h" -
trunk/WebCore/bridge/mac/WebCoreFrameBridge.h
r17435 r17438 205 205 - (void)addData:(NSData *)data; 206 206 207 - (void)invalidatePageCache:(NSDictionary *)pageCache;208 209 207 - (void)saveDocumentState; 210 208 - (void)restoreDocumentState; 211 212 - (BOOL)saveDocumentToPageCache;213 209 214 210 - (void)clearFrame; … … 467 463 DOMElement:(DOMElement *)element; 468 464 - (void)redirectDataToPlugin:(NSView *)pluginView; 469 470 - (BOOL)saveDocumentToPageCache:(id)documentInfo;471 465 472 466 - (int)getObjectCacheSize; -
trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm
r17431 r17438 41 41 #import "EditorClient.h" 42 42 #import "FloatRect.h" 43 #import "FoundationExtras.h"44 43 #import "FrameLoader.h" 45 44 #import "FrameLoaderClient.h" … … 75 74 #import "WebCoreEditCommand.h" 76 75 #import "WebCorePageBridge.h" 77 #import "WebCorePageState.h"78 76 #import "WebCoreSettings.h" 79 77 #import "WebCoreSystemInterface.h" … … 93 91 #import <JavaScriptCore/date_object.h> 94 92 #import <JavaScriptCore/runtime_root.h> 95 #import <kjs/SavedBuiltins.h>96 93 97 94 @class NSView; … … 434 431 } 435 432 436 - (void)invalidatePageCache:(NSDictionary *)pageCache437 {438 // We might have made a page cache item, but now we're bailing out due to an error before we ever439 // transitioned to the new page (before WebFrameState==commit). The goal here is to restore any state440 // 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::detach448 // Somehow the WebCorePageState object is not properly updated, and is holding onto a stale document449 // 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 WebCore451 ASSERT(!state || ([state document] == doc));452 if ([state document] == doc)453 [state invalidate];454 }455 456 433 - (void)saveDocumentState 457 434 { … … 492 469 return NO; 493 470 return m_frame->scrollOverflow((ScrollDirection)direction, (ScrollGranularity)granularity); 494 }495 496 - (BOOL)saveDocumentToPageCache497 {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:doc518 URL:m_frame->url()519 windowProperties:windowProperties520 locationProperties:locationProperties521 interpreterBuiltins:interpreterBuiltins522 pausedTimeouts:m_frame->pauseTimeouts()];523 524 BOOL result = [self saveDocumentToPageCache:pageState];525 526 [pageState release];527 528 return result;529 471 } 530 472 -
trunk/WebCore/bridge/mac/WebCorePageState.h
r15438 r17438 1 1 /* 2 * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 namespace KJS {27 class SavedBuiltins;28 class SavedProperties;29 class PausedTimeouts;30 }31 32 26 namespace WebCore { 33 class Document; 34 class KURL; 35 class Node; 27 class Page; 28 class PageState; 36 29 } 37 30 38 31 @interface WebCorePageState : NSObject 39 32 { 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; 48 34 } 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; 61 37 @end -
trunk/WebCore/bridge/mac/WebCorePageState.mm
r15269 r17438 1 1 /* 2 * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #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" 34 33 35 34 using namespace WebCore; 36 using namespace KJS;37 35 38 36 @implementation WebCorePageState 39 37 40 - (id)initWith Document:(Document *)doc URL:(const KURL &)u windowProperties:(SavedProperties *)wp locationProperties:(SavedProperties *)lp interpreterBuiltins:(SavedBuiltins *)ib pausedTimeouts:(PausedTimeouts *)pt38 - (id)initWithPage:(Page*)page 41 39 { 42 [super init]; 40 self = [super init]; 41 if (!self) 42 return nil; 43 43 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; 106 48 } 107 49 108 [self clear]; 50 m_impl = WebCore::PageState::create(page).releaseRef(); 51 return self; 109 52 } 110 53 111 54 - (void)dealloc 112 55 { 113 ASSERT(closed);56 m_impl->deref(); 114 57 [super dealloc]; 115 58 } … … 117 60 - (void)finalize 118 61 { 119 ASSERT(closed);62 m_impl->deref(); 120 63 [super finalize]; 121 64 } 122 65 123 - ( void)close66 - (WebCore::PageState*)impl 124 67 { 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; 182 69 } 183 70 -
trunk/WebCore/bridge/mac/WebCoreSettings.mm
r16760 r17438 28 28 #import "WebCoreSettings.h" 29 29 30 #import "FoundationExtras.h"31 30 #import "Settings.h" 32 31 #import "Page.h" -
trunk/WebCore/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
r17257 r17438 29 29 #import "KRenderingDeviceQuartz.h" 30 30 31 #import "FoundationExtras.h"32 31 #import "GraphicsContext.h" 33 32 #include "KCanvasMarker.h" -
trunk/WebCore/loader/FrameLoader.h
r17435 r17438 42 42 #ifdef __OBJC__ 43 43 44 @class WebCorePageState;45 46 44 @class NSData; 47 @class NSDate;48 45 @class NSDictionary; 49 46 @class NSError; … … 56 53 @class NSURLResponse; 57 54 58 @protocol WebCoreResourceLoader;59 @protocol WebCoreResourceHandle;60 61 55 #else 62 56 63 class WebCorePageState;64 65 57 class NSData; 66 class NSDate;67 58 class NSDictionary; 68 59 class NSError; 69 60 class NSEvent; 70 61 class NSMutableURLRequest; 71 class NSString;72 62 class NSURL; 73 63 class NSURLAuthenticationChallenge; … … 89 79 class FrameLoadRequest; 90 80 class FrameLoaderClient; 81 class PageState; 91 82 class KURL; 92 83 class MainResourceLoader; … … 283 274 void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress); 284 275 #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); 286 277 void commitProvisionalLoad(NSDictionary *pageCache); 287 278 bool shouldReload(NSURL *currentURL, NSURL *destinationURL); … … 369 360 370 361 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&); 375 363 void opened(); 376 364 -
trunk/WebCore/loader/FrameLoaderClient.h
r17431 r17438 113 113 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() = 0; 114 114 virtual void dispatchDidCancelClientRedirect() = 0; 115 virtual void dispatchWillPerformClientRedirect(NSURL *URL, double , NSDate *) = 0;115 virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate) = 0; 116 116 virtual void dispatchDidChangeLocationWithinPage() = 0; 117 117 virtual void dispatchWillClose() = 0; -
trunk/WebCore/loader/mac/FrameLoaderMac.mm
r17435 r17438 33 33 #import "DOMElementInternal.h" 34 34 #import "Document.h" 35 #import "DocumentLoader.h" 35 36 #import "Element.h" 37 #import "FormDataStream.h" 38 #import "FormState.h" 36 39 #import "FrameLoadRequest.h" 37 40 #import "FrameLoaderClient.h" 38 41 #import "FrameMac.h" 39 42 #import "FramePrivate.h" 43 #import "PageState.h" 40 44 #import "FrameTree.h" 41 45 #import "HTMLNames.h" 42 46 #import "LoaderNSURLExtras.h" 43 47 #import "LoaderNSURLRequestExtras.h" 48 #import "MainResourceLoader.h" 44 49 #import "Page.h" 45 50 #import "Plugin.h" 46 51 #import "ResourceResponse.h" 47 52 #import "ResourceResponseMac.h" 53 #import "SubresourceLoader.h" 48 54 #import "WebCoreFrameBridge.h" 49 55 #import "WebCoreIconDatabaseBridge.h" … … 51 57 #import "WebCoreSystemInterface.h" 52 58 #import "WebDataProtocol.h" 53 #import "DocumentLoader.h"54 #import "FormDataStream.h"55 #import "FormState.h"56 #import "MainResourceLoader.h"57 #import "SubresourceLoader.h"58 59 #import <kjs/JSLock.h> 59 60 #import <wtf/Assertions.h> … … 713 714 NSURL *failedURL = [m_provisionalDocumentLoader->originalRequestCopy() URL]; 714 715 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); 715 723 m_client->invalidateCurrentItemPageCache(); 716 724 … … 741 749 } 742 750 743 void FrameLoader::clientRedirected(NSURL *URL, double seconds, NSDate *date, bool lockHistory, bool isJavaScriptFormAction)744 { 745 m_client->dispatchWillPerformClientRedirect(URL, seconds, date);751 void FrameLoader::clientRedirected(NSURL *URL, double seconds, double fireDate, bool lockHistory, bool isJavaScriptFormAction) 752 { 753 m_client->dispatchWillPerformClientRedirect(URL, seconds, fireDate); 746 754 747 755 // Remember that we sent a redirect notification to the frame load delegate so that when we commit … … 820 828 } 821 829 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 { 830 void FrameLoader::open(PageState& state) 831 { 832 ASSERT(m_frame->page()->mainFrame() == m_frame); 833 847 834 FramePrivate* d = m_frame->d; 848 835 849 // It's safe to assume none of the WebCorePageState methods will raise850 // exceptions, since WebCorePageState is implemented by WebCore and851 // does not throw852 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 861 836 m_frame->cancelRedirection(); 862 837 … … 874 849 d->m_kjsDefaultStatusBarText = String(); 875 850 } 876 851 852 KURL URL = state.URL(); 853 877 854 if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty()) 878 855 URL.setPath("/"); … … 885 862 m_frame->clear(); 886 863 887 doc->setInPageCache(false); 864 Document* document = state.document(); 865 document->setInPageCache(false); 888 866 889 867 d->m_bCleared = false; … … 892 870 d->m_referrer = URL.url(); 893 871 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(); 899 877 900 878 m_frame->updatePolicyBaseURL(); 901 879 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()); 910 881 911 882 m_frame->checkCompleted(); … … 945 916 void FrameLoader::commitProvisionalLoad(NSDictionary *pageCache) 946 917 { 947 bool reload = m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadAllowingStaleData;948 949 918 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; 950 951 NSURLResponse *response = pdl->response();952 953 NSDictionary *headers = [response isKindOfClass:[NSHTTPURLResponse class]]954 ? [(NSHTTPURLResponse *)response allHeaderFields] : nil;955 919 956 920 if (m_loadType != FrameLoadTypeReplace) … … 969 933 clientRedirectCancelledOrFinished(false); 970 934 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 } 980 957 opened(); 981 958 } -
trunk/WebCore/platform/mac/FontMac.mm
r16502 r17438 30 30 #import "FontData.h" 31 31 #import "FontFallbackList.h" 32 #import "FoundationExtras.h"33 32 #import "GlyphBuffer.h" 34 33 #import "GraphicsContext.h" -
trunk/WebCore/platform/mac/WidgetMac.mm
r16987 r17438 29 29 #import "Cursor.h" 30 30 #import "Font.h" 31 #import "FoundationExtras.h"32 31 #import "GraphicsContext.h" 33 32 #import "BlockExceptions.h" -
trunk/WebCore/platform/network/mac/ResourceHandleMac.mm
r17435 r17438 30 30 #import "BlockExceptions.h" 31 31 #import "DocLoader.h" 32 #import "FoundationExtras.h"33 32 #import "FrameLoader.h" 34 33 #import "FrameMac.h" -
trunk/WebKit/ChangeLog
r17435 r17438 1 2006-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 1 28 2006-10-29 Maciej Stachowiak <mjs@apple.com> 2 29 -
trunk/WebKit/History/WebHistoryItem.m
r17408 r17438 27 27 */ 28 28 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" 31 44 #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> 45 47 #import <WebKitSystemInterface.h> 46 48 … … 714 716 } 715 717 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(); 719 720 } 720 721 } -
trunk/WebKit/WebCoreSupport/WebFrameBridge.mm
r17435 r17438 571 571 } 572 572 573 - (BOOL)saveDocumentToPageCache:(id)documentInfo574 {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 583 573 - (NSString *)userAgentForURL:(NSURL *)URL 584 574 { -
trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.h
r17431 r17438 110 110 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); 111 111 virtual void dispatchDidCancelClientRedirect(); 112 virtual void dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval, NSDate *);112 virtual void dispatchWillPerformClientRedirect(NSURL *URL, double interval, double fireDate); 113 113 virtual void dispatchDidChangeLocationWithinPage(); 114 114 virtual void dispatchWillClose(); -
trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm
r17433 r17438 36 36 #import "WebBackForwardList.h" 37 37 #import "WebDataSourceInternal.h" 38 #import "WebDefaultResourceLoadDelegate.h" 38 39 #import "WebDocumentInternal.h" 39 40 #import "WebDocumentLoaderMac.h" … … 59 60 #import "WebUIDelegate.h" 60 61 #import "WebViewInternal.h" 62 #import <WebCore/Document.h> 63 #import <WebCore/DocumentLoader.h> 64 #import <WebCore/FormState.h> 61 65 #import <WebCore/FrameLoader.h> 62 66 #import <WebCore/FrameLoaderTypes.h> 63 67 #import <WebCore/FrameMac.h> 68 #import <WebCore/PageState.h> 64 69 #import <WebCore/FrameTree.h> 65 70 #import <WebCore/Page.h> 66 71 #import <WebCore/PlatformString.h> 72 #import <WebCore/ResourceLoader.h> 67 73 #import <WebCore/WebCoreFrameBridge.h> 74 #import <WebCore/WebCorePageState.h> 68 75 #import <WebCore/WebDataProtocol.h> 69 #import <WebCore/DocumentLoader.h>70 #import <WebCore/FormState.h>71 #import <WebCore/ResourceLoader.h>72 76 #import <WebKit/DOMElement.h> 73 #import <WebKit/WebDefaultResourceLoadDelegate.h>74 #import <WebKit/WebDocumentLoaderMac.h>75 #import <WebKit/WebResourceLoadDelegate.h>76 #import <WebKit/WebViewInternal.h>77 77 #import <WebKitSystemInterface.h> 78 #import <objc/objc-runtime.h>79 78 #import <wtf/PassRefPtr.h> 80 79 … … 164 163 WebHistoryItem *currentItem = m_webFrame->_private->currentItem; 165 164 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 167 175 // We're assuming that WebCore invalidates its pageCache state in didNotOpen:pageCache: 168 176 [currentItem setHasPageCache:NO]; … … 533 541 } 534 542 535 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, NSTimeInterval delay, NSDate *fireDate)536 { 537 WebView *webView = getWebView(m_webFrame.get()); 543 void WebFrameLoaderClient::dispatchWillPerformClientRedirect(NSURL *URL, double delay, double fireDate) 544 { 545 WebView *webView = getWebView(m_webFrame.get()); 538 546 [[webView _frameLoadDelegateForwarder] webView:webView 539 547 willPerformClientRedirectToURL:URL 540 548 delay:delay 541 fireDate: fireDate549 fireDate:[NSDate dateWithTimeIntervalSince1970:fireDate] 542 550 forFrame:m_webFrame.get()]; 543 551 } … … 1125 1133 bool WebFrameLoaderClient::createPageCache(WebHistoryItem *item) 1126 1134 { 1135 WebCorePageState *pageState = [[WebCorePageState alloc] initWithPage:core(m_webFrame.get())->page()]; 1136 if (!pageState) { 1137 [item setHasPageCache:NO]; 1138 return false; 1139 } 1140 1127 1141 [item setHasPageCache:YES]; 1128 if (![m_webFrame->_private->bridge saveDocumentToPageCache]) {1129 [item setHasPageCache:NO];1130 return NO;1131 }1132 1142 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; 1137 1152 } 1138 1153 -
trunk/WebKit/WebView/WebFrame.mm
r17433 r17438 1051 1051 - (NSColor *)_bodyBackgroundColor 1052 1052 { 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); 1054 1066 } 1055 1067
Note: See TracChangeset
for help on using the changeset viewer.