Changeset 16440 in webkit


Ignore:
Timestamp:
Sep 18, 2006 7:21:52 PM (18 years ago)
Author:
beidson
Message:

WebCore:

Reviewed by Anders

<rdar://problem/3028061> - WebKit never updates favicon
The WebKit enforced expiration date for icons has worked for some time, but the
move to the new Icon Loader broke the "always get the icon if the user refreshes the page"
functionality. This patch fixes that up, along with some other architectural improvements,
the main one being that WebCore::Document now contains an iconURL for the Frame to query if needed.

  • bridge/mac/FrameMac.h: Added isLoadTypeReload()
  • bridge/mac/FrameMac.mm: (WebCore::FrameMac::isLoadTypeReload): Implementation, calls into the bridge
  • bridge/mac/WebCoreFrameBridge.h: Added isLoadTypeReload:
  • bridge/win/FrameWin.h: Added isLoadTypeReload() for temporary link stub
  • dom/Document.h: Added m_iconURL (WebCore::Document::iconURL): Added (WebCore::Document::setIconURL): Ditto
  • html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::process): Sets the iconURL in the Document instead of the Frame
  • page/Frame.cpp: (WebCore::Frame::iconURL): Calculates the iconURL based on the document, then the default favicon.ico url (WebCore::Frame::endIfNotLoading): Checks for the load type - always loads icon on Reload
  • page/Frame.h: Nuked setIconURL(), added isLoadTypeReload()
  • page/FramePrivate.h: Nuked IconURL
  • platform/win/TemporaryLinkStubs.cpp: (FrameWin::isLoadTypeReload):

WebKit:

Reviewed by Anders

Implement a bridge method so WebCore can find the reload type of a frame load

  • WebCoreSupport/WebFrameBridge.m: (-[WebFrameBridge isLoadTypeReload]):
Location:
trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r16439 r16440  
     12006-09-18  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders
     4
     5        <rdar://problem/3028061> - WebKit never updates favicon
     6        The WebKit enforced expiration date for icons has worked for some time, but the
     7        move to the new Icon Loader broke the "always get the icon if the user refreshes the page"
     8        functionality.  This patch fixes that up, along with some other architectural improvements,
     9        the main one being that WebCore::Document now contains an iconURL for the Frame to query if needed.
     10
     11        * bridge/mac/FrameMac.h: Added isLoadTypeReload()
     12        * bridge/mac/FrameMac.mm:
     13        (WebCore::FrameMac::isLoadTypeReload): Implementation, calls into the bridge
     14        * bridge/mac/WebCoreFrameBridge.h: Added isLoadTypeReload:
     15        * bridge/win/FrameWin.h: Added isLoadTypeReload() for temporary link stub
     16        * dom/Document.h: Added m_iconURL
     17        (WebCore::Document::iconURL): Added
     18        (WebCore::Document::setIconURL): Ditto
     19        * html/HTMLLinkElement.cpp:
     20        (WebCore::HTMLLinkElement::process): Sets the iconURL in the Document instead of the Frame
     21        * page/Frame.cpp:
     22        (WebCore::Frame::iconURL): Calculates the iconURL based on the document, then the default favicon.ico url
     23        (WebCore::Frame::endIfNotLoading): Checks for the load type - always loads icon on Reload
     24        * page/Frame.h: Nuked setIconURL(), added isLoadTypeReload()
     25        * page/FramePrivate.h: Nuked IconURL
     26        * platform/win/TemporaryLinkStubs.cpp:
     27        (FrameWin::isLoadTypeReload):
     28
    1292006-09-18  Sam Weinig  <sam.weinig@gmail.com>
    230
  • trunk/WebCore/bridge/mac/FrameMac.h

    r16423 r16440  
    325325    virtual void stopRedirectionTimer();
    326326    virtual void cleanupPluginObjects();
     327    virtual bool isLoadTypeReload();
    327328   
    328329private:
  • trunk/WebCore/bridge/mac/FrameMac.mm

    r16368 r16440  
    35713571}
    35723572
    3573 }
     3573bool FrameMac::isLoadTypeReload()
     3574{
     3575    return [_bridge isLoadTypeReload];
     3576}
     3577
     3578}
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r16386 r16440  
    689689- (void)notifyIconChanged:(NSURL*)iconURL;
    690690- (NSURL*)originalRequestURL;
     691- (BOOL)isLoadTypeReload;
    691692@end
    692693
  • trunk/WebCore/bridge/win/FrameWin.h

    r16423 r16440  
    127127    bool keyPress(const PlatformKeyboardEvent&);
    128128    virtual KURL originalRequestURL() const;
     129   
     130protected:
     131    virtual bool isLoadTypeReload();
    129132
    130133private:
  • trunk/WebCore/dom/Document.cpp

    r16411 r16440  
    34823482}
    34833483
    3484 }
     3484
     3485String Document::iconURL()
     3486{
     3487    return m_iconURL;
     3488}
     3489
     3490void Document::setIconURL(const String& iconURL, const String& type)
     3491{
     3492    // FIXME - <rdar://problem/4727645> - At some point in the future, we might actually honor the "type"
     3493    if (m_iconURL.isEmpty())
     3494        m_iconURL = iconURL;
     3495    else if (!type.isEmpty())
     3496        m_iconURL = iconURL;
     3497}
     3498
     3499}
  • trunk/WebCore/dom/Document.h

    r16348 r16440  
    599599    bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
    600600
     601    String iconURL();
     602    void setIconURL(const String& iconURL, const String& type);
    601603protected:
    602604    CSSStyleSelector* m_styleSelector;
     
    608610    DeprecatedString m_baseURL;
    609611    String m_baseTarget;
    610 
     612   
    611613    RefPtr<DocumentType> m_docType;
    612614    RefPtr<DOMImplementation> m_implementation;
     
    813815    bool m_createRenderers;
    814816    bool m_inPageCache;
     817    String m_iconURL;
    815818};
    816819
  • trunk/WebCore/html/HTMLDocument.cpp

    r16405 r16440  
    423423 
    424424}
    425 
    426 }
     425   
     426}
  • trunk/WebCore/html/HTMLDocument.h

    r16245 r16440  
    6666
    6767    typedef HashMap<StringImpl*, int> NameCountMap;
    68 
     68   
    6969protected:
    7070    HTMLElement* bodyElement;
  • trunk/WebCore/html/HTMLLinkElement.cpp

    r16405 r16440  
    153153
    154154    String type = m_type.lower();
    155    
    156     Frame* frame = document()->frame();
    157155
    158156    // IE extension: location of small icon for locationbar / bookmarks
    159     if (frame && m_isIcon && !m_url.isEmpty() && !frame->tree()->parent())
    160         frame->setIconURL(m_url, type);
     157    // We'll record this URL per document, even if we later only use it in top level frames
     158    if (m_isIcon && !m_url.isEmpty())
     159        document()->setIconURL(m_url, type);
    161160
    162161    // Stylesheet
  • trunk/WebCore/page/Frame.cpp

    r16423 r16440  
    232232       
    233233    // If we have an iconURL from a Link element, return that
    234     if (!d->m_iconURL.isEmpty())
    235         return KURL(d->m_iconURL.deprecatedString());
     234    if (!document()->iconURL().isEmpty())
     235        return KURL(document()->iconURL().deprecatedString());
    236236       
    237237    // Don't return a favicon iconURL unless we're http or https
     
    244244    url.setPath("/favicon.ico");
    245245    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;
    255246}
    256247
     
    783774    IconDatabase* sharedIconDatabase = IconDatabase::sharedIconDatabase();
    784775    // If we already have an unexpired icon, we won't kick off a load but we *will* map the appropriate URLs to it
    785     if (sharedIconDatabase->hasEntryForIconURL(url) && !sharedIconDatabase->isIconExpiredForIconURL(url)) {
     776    if (sharedIconDatabase->hasEntryForIconURL(url) && !isLoadTypeReload() && !sharedIconDatabase->isIconExpiredForIconURL(url)) {
    786777        commitIconURLToIconDatabase();
    787778        return;
  • trunk/WebCore/page/Frame.h

    r16423 r16440  
    108108
    109109  KURL iconURL();
    110   void setIconURL(const String& url, const String& type);
    111110  void commitIconURLToIconDatabase();
    112111 
     
    591590
    592591  virtual void redirectionTimerFired(Timer<Frame>*);
     592 
     593  virtual bool isLoadTypeReload() = 0;
    593594
    594595public:
  • trunk/WebCore/page/FramePrivate.h

    r16363 r16440  
    174174        String m_referrer;
    175175
    176         String m_iconURL;
    177 
    178176        struct SubmitForm {
    179177            const char* submitAction;
  • trunk/WebCore/platform/win/TemporaryLinkStubs.cpp

    r16436 r16440  
    183183void FrameWin::issuePasteAndMatchStyleCommand() { notImplemented(); }
    184184KURL FrameWin::originalRequestURL() const { return KURL(); }
     185bool FrameWin::isLoadTypeReload() { notImplemented(); return false; }
    185186
    186187bool BrowserExtensionWin::canRunModal() { notImplemented(); return 0; }
  • trunk/WebKit/ChangeLog

    r16438 r16440  
     12006-09-18  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Anders
     4
     5        Implement a bridge method so WebCore can find the reload type of a frame load
     6
     7        * WebCoreSupport/WebFrameBridge.m:
     8        (-[WebFrameBridge isLoadTypeReload]):
     9
    1102006-09-18  Sam Weinig  <sam.weinig@gmail.com>
    211
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.m

    r16395 r16440  
    17141714}
    17151715
     1716- (BOOL)isLoadTypeReload
     1717{
     1718    return [_frame _loadType] == WebFrameLoadTypeReload;
     1719}
     1720
     1721
     1722
    17161723@end
Note: See TracChangeset for help on using the changeset viewer.