Changeset 16360 in webkit
- Timestamp:
- Sep 14, 2006, 12:20:47 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r16359 r16360 1 2006-09-13 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Maciej 4 5 Icon loads now take place in WebCore 6 7 * WebCore.xcodeproj/project.pbxproj: 8 * bridge/BrowserExtension.h: 9 * bridge/mac/BrowserExtensionMac.h: 10 * bridge/mac/BrowserExtensionMac.mm: 11 - Moved enforcement of a Mozilla Favicon extension elsewhere 12 13 * bridge/mac/FrameMac.h: 14 * bridge/mac/FrameMac.mm: 15 (WebCore::FrameMac::originalRequestURL): 16 - Added accessor to "original request URL" 17 18 * bridge/mac/WebCoreFrameBridge.h: 19 - Removed methods to set the iconURL as all loading is now done in WebCore 20 - Added call throughs to notify WebKit an Icon is done loading, and a to get the original request URL 21 22 * html/HTMLLinkElement.cpp: 23 (WebCore::HTMLLinkElement::process): 24 - Moved enforcement of a Mozilla Favicon extension elsewhere 25 26 * loader/icon/IconDatabase.cpp: 27 (WebCore::IconDatabase::setIconURLForPageURL): 28 - Changed an ASSERT to correctly handle a sketchy (invalid) situation 29 30 * loader/icon/IconLoader.h: Added. 31 * loader/icon/IconLoader.cpp: Added. 32 (IconLoader::IconLoader): 33 (IconLoader::createForFrame): 34 - Static factory method with a private constructor to enforce 35 "you MUST have a Frame to create an IconLoader" semantics 36 (IconLoader::~IconLoader): 37 (IconLoader::startLoading): 38 (IconLoader::stopLoading): 39 (IconLoader::receivedData): 40 - ResourceLoaderClient delegate 41 (IconLoader::receivedAllData): 42 - Ditto 43 44 * loader/mac/IconLoaderMac.mm: Added. 45 (IconLoader::receivedResponse): 46 (IconLoader::notifyIconChanged): 47 - For now, these are platform specific methods 48 - One to get the HTTP response code of an icon load 49 - The other to call through to the app when the icon has changed (loaded) 50 51 * page/Frame.h: 52 * page/Frame.cpp: 53 (WebCore::Frame::iconURL): 54 (WebCore::Frame::setIconURL): 55 - Frame objects now have an inherent icon URL and a way to calculate/access it 56 (WebCore::Frame::endIfNotLoading): 57 - This is where we actually kick off the IconLoader 58 (WebCore::Frame::stop): 59 - Added call to stop loading the icon 60 61 * page/FramePrivate.h: 62 (WebCore::FramePrivate::FramePrivate): 63 (WebCore::FramePrivate::~FramePrivate): 64 - Added the icon URL as a private member 65 - Added the IconLoader as a private member, and clean it up on deletion 66 67 * platform/mac/ResourceLoaderMac.mm: 68 (WebCore::ResourceLoader::start): Added a valuable ASSERT 69 1 70 2006-09-13 David Hyatt <hyatt@apple.com> 2 71 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r16343 r16360 255 255 5126E6C00A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */; }; 256 256 51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 51386EE60AB4F0D5004AF79E /* IntSizeHash.h */; }; 257 513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; }; 258 513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; }; 257 259 5186C0560A9C21470034FE94 /* IconDataCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5186C0550A9C21470034FE94 /* IconDataCache.cpp */; }; 260 51A1D2C60AB69120000D732C /* IconLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A1D2C50AB69120000D732C /* IconLoaderMac.mm */; }; 258 261 51D3EA160A3D24D300BADA35 /* SQLDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */; }; 259 262 51D3EA170A3D24D300BADA35 /* SQLDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */; }; … … 2704 2707 5126E6BE0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreIconDatabaseBridge.mm; sourceTree = "<group>"; }; 2705 2708 51386EE60AB4F0D5004AF79E /* IntSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntSizeHash.h; sourceTree = "<group>"; }; 2709 513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; }; 2710 513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; }; 2706 2711 5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2707 2712 5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 2708 2713 5186C0550A9C21470034FE94 /* IconDataCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDataCache.cpp; sourceTree = "<group>"; }; 2714 51A1D2C50AB69120000D732C /* IconLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IconLoaderMac.mm; sourceTree = "<group>"; }; 2709 2715 51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SQLDatabase.cpp; sourceTree = "<group>"; }; 2710 2716 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SQLDatabase.h; sourceTree = "<group>"; }; … … 5298 5304 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */, 5299 5305 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */, 5306 513F14520AB634C400094DDF /* IconLoader.h */, 5307 513F14510AB634C400094DDF /* IconLoader.cpp */, 5300 5308 51D3EA140A3D24D300BADA35 /* SQLDatabase.h */, 5301 5309 51D3EA130A3D24D300BADA35 /* SQLDatabase.cpp */, … … 6026 6034 93A1EA9F0A5634C9006960A0 /* ImageDocumentMac.mm */, 6027 6035 F587850302DE375901EA4122 /* LoaderFunctionsMac.mm */, 6036 51A1D2C50AB69120000D732C /* IconLoaderMac.mm */, 6028 6037 ); 6029 6038 path = mac; … … 8416 8425 51386EE70AB4F0D5004AF79E /* IntSizeHash.h in Headers */, 8417 8426 06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */, 8427 513F14540AB634C400094DDF /* IconLoader.h in Headers */, 8418 8428 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */, 8419 8429 066C77310AB603FD00238CC4 /* RenderFileUploadControl.h in Headers */, … … 8571 8581 isa = PBXProject; 8572 8582 buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */; 8573 compatibilityVersion = "Xcode 2.4";8574 8583 hasScannedForEncodings = 1; 8575 8584 knownRegions = ( … … 8586 8595 projectDirPath = ""; 8587 8596 projectRoot = ""; 8588 shouldCheckCompatibility = 1;8589 8597 targets = ( 8590 8598 93F198A508245E59001E9ABC /* WebCore */, … … 9623 9631 85E9E0A60AB3A0C700069CD0 /* DOMXPathResult.mm in Sources */, 9624 9632 06E81EEC0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm in Sources */, 9633 513F14530AB634C400094DDF /* IconLoader.cpp in Sources */, 9634 51A1D2C60AB69120000D732C /* IconLoaderMac.mm in Sources */, 9625 9635 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */, 9626 9636 066C77300AB603FD00238CC4 /* RenderFileUploadControl.cpp in Sources */, -
trunk/WebCore/bridge/BrowserExtension.h
r14669 r16360 61 61 virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*&) = 0; 62 62 63 virtual void setIconURL(const KURL&) = 0;64 virtual void setTypedIconURL(const KURL&, const String& type) = 0;65 66 63 virtual int getHistoryLength() = 0; 67 64 virtual void goBackOrForward(int distance) = 0; -
trunk/WebCore/bridge/mac/BrowserExtensionMac.h
r14669 r16360 40 40 Frame*& part); 41 41 42 virtual void setIconURL(const KURL&);43 virtual void setTypedIconURL(const KURL&, const String& type);44 45 42 virtual int getHistoryLength(); 46 43 virtual void goBackOrForward(int distance); -
trunk/WebCore/bridge/mac/BrowserExtensionMac.mm
r14669 r16360 140 140 } 141 141 142 void BrowserExtensionMac::setIconURL(const KURL &url)143 {144 BEGIN_BLOCK_OBJC_EXCEPTIONS;145 [m_frame->bridge() setIconURL:url.getNSURL()];146 END_BLOCK_OBJC_EXCEPTIONS;147 }148 149 void BrowserExtensionMac::setTypedIconURL(const KURL &url, const String &type)150 {151 BEGIN_BLOCK_OBJC_EXCEPTIONS;152 [m_frame->bridge() setIconURL:url.getNSURL() withType:type];153 END_BLOCK_OBJC_EXCEPTIONS;154 }155 156 142 int BrowserExtensionMac::getHistoryLength() 157 143 { -
trunk/WebCore/bridge/mac/FrameMac.h
r16353 r16360 319 319 320 320 NSEvent* currentEvent() { return _currentEvent; } 321 321 KURL originalRequestURL() const; 322 322 323 protected: 323 324 virtual void startRedirectionTimer(); -
trunk/WebCore/bridge/mac/FrameMac.mm
r16329 r16360 3564 3564 } 3565 3565 3566 } 3566 KURL FrameMac::originalRequestURL() const 3567 { 3568 return [_bridge originalRequestURL]; 3569 } 3570 3571 } -
trunk/WebCore/bridge/mac/WebCoreFrameBridge.h
r16245 r16360 530 530 - (void)setStatusText:(NSString *)status; 531 531 532 - (void)setIconURL:(NSURL *)URL;533 - (void)setIconURL:(NSURL *)URL withType:(NSString *)string;534 535 532 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL 536 533 referrer:(NSString *)referrer … … 693 690 - (NSString*)imageTitleForFilename:(NSString*)filename size:(NSSize)size; 694 691 692 - (void)notifyIconChanged:(NSURL*)iconURL; 693 - (NSURL*)originalRequestURL; 695 694 @end 696 695 -
trunk/WebCore/html/HTMLLinkElement.cpp
r14779 r16360 157 157 158 158 // IE extension: location of small icon for locationbar / bookmarks 159 if (frame && m_isIcon && !m_url.isEmpty() && !frame->tree()->parent()) { 160 if (!type.isEmpty()) // Mozilla extension to IE extension: icon specified with type 161 frame->browserExtension()->setTypedIconURL(KURL(m_url.deprecatedString()), type); 162 else 163 frame->browserExtension()->setIconURL(KURL(m_url.deprecatedString())); 164 } 159 if (frame && m_isIcon && !m_url.isEmpty() && !frame->tree()->parent()) 160 frame->setIconURL(m_url, type); 165 161 166 162 // Stylesheet -
trunk/WebCore/loader/icon/IconDatabase.cpp
r16295 r16360 622 622 { 623 623 ASSERT(!iconURL.isEmpty()); 624 ASSERT(!pageURL.isEmpty()); 624 if (pageURL.isEmpty()) 625 return false; 625 626 626 627 // If the urls already map to each other, bail. -
trunk/WebCore/page/Frame.cpp
r16322 r16360 28 28 #include "config.h" 29 29 #include "Frame.h" 30 #include "FrameMac.h" 30 31 #include "FramePrivate.h" 31 32 … … 54 55 #include "HTMLObjectElement.h" 55 56 #include "HTMLViewSourceDocument.h" 57 #include "IconDatabase.h" 58 #include "IconLoader.h" 56 59 #include "ImageDocument.h" 57 60 #include "MediaFeatureNames.h" … … 222 225 delete d; 223 226 d = 0; 227 } 228 229 KURL Frame::iconURL() 230 { 231 // If this isn't a top level frame, return nothing 232 if (tree() && tree()->parent()) 233 return ""; 234 235 // If we have an iconURL from a Link element, return that 236 if (!d->m_iconURL.isEmpty()) 237 return KURL(d->m_iconURL.deprecatedString()); 238 239 // Don't return a favicon iconURL unless we're http or https 240 if (d->m_url.protocol() != "http" && d->m_url.protocol() != "https") 241 return ""; 242 243 KURL url = d->m_url; 244 url.setPath("/favicon.ico"); 245 return url; 246 } 247 248 void Frame::setIconURL(const String& url, const String& type) 249 { 250 // FIXME - <rdar://problem/4727645> - At some point in the future, we might actually honor the "type" 251 if (d->m_iconURL.isEmpty()) 252 d->m_iconURL = url; 253 else if (!type.isEmpty()) 254 d->m_iconURL = url; 224 255 } 225 256 … … 715 746 // last one to complete. 716 747 checkCompleted(); 748 749 // Don't load an icon if - 750 // 1) This is not the main frame 751 // 2) The database is disabled 752 // 3) We have no valid icon URL 753 // 4) We already have an unexpired icon 754 755 if (tree()->parent()) 756 return; 757 758 // FIXME - <rdar://problem/4729797> - To honor #2, we need to add the isEnabled() flag to WebCore::IconDatabase 759 760 String url(iconURL().url()); 761 if (url.isEmpty()) 762 return; 763 764 IconDatabase* sharedIconDatabase = IconDatabase::sharedIconDatabase(); 765 if (sharedIconDatabase->hasEntryForIconURL(url) && !sharedIconDatabase->isIconExpiredForIconURL(url)) 766 return; 767 768 if (!d->m_iconLoader) 769 d->m_iconLoader = IconLoader::createForFrame(this); 770 d->m_iconLoader->startLoading(); 717 771 } 718 772 … … 729 783 // last one to complete. 730 784 checkCompleted(); 785 if (d->m_iconLoader) 786 d->m_iconLoader->stopLoading(); 731 787 } 732 788 -
trunk/WebCore/page/Frame.h
r16353 r16360 106 106 void didExplicitOpen(); 107 107 108 KURL iconURL(); 109 void setIconURL(const String& url, const String& type); 110 108 111 Page* page() const; 109 112 void pageDestroyed(); … … 526 529 virtual void urlSelected(const DeprecatedString& url, const String& target); 527 530 virtual void urlSelected(const ResourceRequest&, const String& target); 528 529 531 530 532 // Methods with platform-specific overrides (and no base class implementation). … … 803 805 804 806 KURL url() const; 807 805 808 void setResourceRequest(const ResourceRequest& request); 806 809 const ResourceRequest& resourceRequest() const; -
trunk/WebCore/page/FramePrivate.h
r16250 r16360 35 35 #include "Frame.h" 36 36 #include "FrameTree.h" 37 #include "IconLoader.h" 37 38 #include "SelectionController.h" 38 39 #include "StringHash.h" … … 45 46 class Decoder; 46 47 class UserStyleSheetLoader; 48 class IconLoader; 47 49 48 50 enum RedirectionScheduled { … … 97 99 , m_lifeSupportTimer(thisFrame, &Frame::lifeSupportTimerFired) 98 100 , m_userStyleSheetLoader(0) 101 , m_iconLoader(0) 99 102 , m_autoscrollTimer(thisFrame, &Frame::autoscrollTimerFired) 100 103 , m_autoscrollLayer(0) … … 113 116 delete m_extension; 114 117 delete m_jscript; 118 delete m_iconLoader; 115 119 } 116 120 … … 169 173 170 174 String m_referrer; 175 176 String m_iconURL; 171 177 172 178 struct SubmitForm { … … 213 219 214 220 UserStyleSheetLoader* m_userStyleSheetLoader; 221 IconLoader* m_iconLoader; 215 222 216 223 Timer<Frame> m_autoscrollTimer; -
trunk/WebCore/platform/mac/ResourceLoaderMac.mm
r16250 r16360 59 59 bool ResourceLoader::start(DocLoader* docLoader) 60 60 { 61 ASSERT(docLoader); 62 61 63 FrameMac* frame = Mac(docLoader->frame()); 62 64 if (!frame) { -
trunk/WebKit/ChangeLog
r16349 r16360 1 2006-09-13 Brady Eidson <beidson@apple.com> 2 3 Reviewed by Maciej 4 5 Add infrastructure to support icon loads taking place in WebCore 6 Will remove WebKit icon loaders in a later patch 7 8 * WebCoreSupport/WebFrameBridge.m: 9 (-[WebFrameBridge notifyIconChanged:]): 10 (-[WebFrameBridge originalRequestURL]): 11 - Nuked two old, obsolete methods 12 - Added bridge for notifying of an icon change 13 - Added bridge for getting the "original request URL" which is still needed 14 until that info is available in the WebCore loaders 15 16 * WebView/WebDataSource.m: 17 (-[WebDataSource _loadIcon]): 18 - Empty body just for now, as it still gets called - next patch will prune all the old impl out 19 1 20 2006-09-13 Timothy Hatcher <timothy@apple.com> 2 21 -
trunk/WebKit/WebCoreSupport/WebFrameBridge.m
r15799 r16360 40 40 #import "WebFrameInternal.h" 41 41 #import "WebFrameLoadDelegate.h" 42 #import "WebFrameLoader.h" 42 43 #import "WebFrameViewInternal.h" 43 44 #import "WebHTMLRepresentationPrivate.h" 44 45 #import "WebHTMLViewInternal.h" 45 46 #import "WebHistoryItemPrivate.h" 47 #import "WebIconDatabase.h" 48 #import <WebKit/WebIconDatabasePrivate.h> 46 49 #import "WebJavaPlugIn.h" 47 50 #import "WebJavaScriptTextInputPanel.h" … … 683 686 // change its focus-displaying state, but isn't otherwise notified. 684 687 [(WebHTMLView *)[[_frame frameView] documentView] _formControlIsResigningFirstResponder:formControl]; 685 }686 687 - (void)setIconURL:(NSURL *)URL688 {689 [[self dataSource] _setIconURL:URL];690 }691 692 - (void)setIconURL:(NSURL *)URL withType:(NSString *)type693 {694 [[self dataSource] _setIconURL:URL withType:type];695 688 } 696 689 … … 1711 1704 } 1712 1705 1706 - (void)notifyIconChanged:(NSURL*)iconURL 1707 { 1708 ASSERT([[WebIconDatabase sharedIconDatabase] _isEnabled]); 1709 ASSERT(_frame == [[_frame webView] mainFrame]); 1710 1711 [[_frame webView] _willChangeValueForKey:_WebMainFrameIconKey]; 1712 1713 NSImage *icon = [[WebIconDatabase sharedIconDatabase] iconForURL:[[[[_frame _frameLoader] activeDataSource] _URL] _web_originalDataAsString] withSize:WebIconSmallSize]; 1714 1715 [[[_frame webView] _frameLoadDelegateForwarder] webView:[_frame webView] 1716 didReceiveIcon:icon 1717 forFrame:_frame]; 1718 1719 [[_frame webView] _didChangeValueForKey:_WebMainFrameIconKey]; 1720 } 1721 1722 - (NSURL*)originalRequestURL 1723 { 1724 return [[[[_frame _frameLoader] activeDataSource] initialRequest] URL]; 1725 } 1726 1713 1727 @end -
trunk/WebKit/WebView/WebDataSource.m
r16271 r16360 190 190 - (void)_loadIcon 191 191 { 192 // Don't load an icon if 1) this is not the main frame 2) we ended in error193 // 3) they aren't saved by the DB194 if ([self webFrame] != [[self _webView] mainFrame] || _private->mainDocumentError || ![[WebIconDatabase sharedIconDatabase] _isEnabled])195 return;196 197 if (!_private->iconURL) {198 // No icon URL from the LINK tag so try the server's root.199 // This is only really a feature of http or https, so don't try this with other protocols.200 NSString *scheme = [[self _URL] scheme];201 if([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]){202 _private->iconURL = [[[NSURL _web_URLWithDataAsString:@"/favicon.ico"203 relativeToURL:[self _URL]] absoluteURL] retain];204 }205 }206 207 if (_private->iconURL != nil) {208 // If we have the icon already, we'll still see if we're manually reloading or if the icon is expired209 // If so, kick off a reload of the icon210 // If we don't have the icon already, kick off the initial load211 if ([[WebIconDatabase sharedIconDatabase] _hasEntryForIconURL:[_private->iconURL _web_originalDataAsString]]) {212 [[_private->webFrame _frameLoader] _updateIconDatabaseWithURL:_private->iconURL];213 if ([[self webFrame] _loadType] == WebFrameLoadTypeReload || [[WebIconDatabase sharedIconDatabase] isIconExpiredForIconURL:[_private->iconURL _web_originalDataAsString]])214 [[WebIconDatabase sharedIconDatabase] loadIconFromURL:[_private->iconURL _web_originalDataAsString]];215 else216 [[_private->webFrame _frameLoader] _notifyIconChanged:_private->iconURL];217 } else {218 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_private->iconURL];219 [[self webFrame] _addExtraFieldsToRequest:request mainResource:YES alwaysFromRequest:NO];220 [[_private->webFrame _frameLoader] loadIconWithRequest:request];221 [request release];222 }223 }224 192 } 225 193
Note:
See TracChangeset
for help on using the changeset viewer.