Changeset 74282 in webkit


Ignore:
Timestamp:
Dec 17, 2010 11:35:46 AM (13 years ago)
Author:
weinig@apple.com
Message:

WebKit2: Implement a title attribute per frame
https://bugs.webkit.org/show_bug.cgi?id=51266

Reviewed by Darin Adler.

Cache the title of each frame on the WebFrameProxy. Removes
the WebPageProxy's cache of the main frame title to just
access the main frame.

We clear the cached title on new committed loads and on failures
to load.

  • UIProcess/API/C/WKFrame.cpp:

(WKFrameCopyTitle):

  • UIProcess/API/C/WKFrame.h:
  • UIProcess/WebFrameProxy.cpp:

(WebKit::WebFrameProxy::didCommitLoad):
(WebKit::WebFrameProxy::didFailLoad):
(WebKit::WebFrameProxy::didChangeTitle):

  • UIProcess/WebFrameProxy.h:

(WebKit::WebFrameProxy::title):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::pageTitle):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::processDidCrash):

  • UIProcess/WebPageProxy.h:
Location:
trunk/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r74275 r74282  
     12010-12-17  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        WebKit2: Implement a title attribute per frame
     6        https://bugs.webkit.org/show_bug.cgi?id=51266
     7
     8        Cache the title of each frame on the WebFrameProxy. Removes
     9        the WebPageProxy's cache of the main frame title to just
     10        access the main frame.
     11
     12        We clear the cached title on new committed loads and on failures
     13        to load.
     14
     15        * UIProcess/API/C/WKFrame.cpp:
     16        (WKFrameCopyTitle):
     17        * UIProcess/API/C/WKFrame.h:
     18        * UIProcess/WebFrameProxy.cpp:
     19        (WebKit::WebFrameProxy::didCommitLoad):
     20        (WebKit::WebFrameProxy::didFailLoad):
     21        (WebKit::WebFrameProxy::didChangeTitle):
     22        * UIProcess/WebFrameProxy.h:
     23        (WebKit::WebFrameProxy::title):
     24        * UIProcess/WebPageProxy.cpp:
     25        (WebKit::WebPageProxy::close):
     26        (WebKit::WebPageProxy::pageTitle):
     27        (WebKit::WebPageProxy::didReceiveTitleForFrame):
     28        (WebKit::WebPageProxy::processDidCrash):
     29        * UIProcess/WebPageProxy.h:
     30
    1312010-12-16  Darin Adler  <darin@apple.com>
    232
  • trunk/WebKit2/UIProcess/API/C/WKFrame.cpp

    r73591 r74282  
    7777}
    7878
     79WKStringRef WKFrameCopyTitle(WKFrameRef frameRef)
     80{
     81    return toCopiedAPI(toImpl(frameRef)->title());
     82}
     83
    7984WKPageRef WKFrameGetPage(WKFrameRef frameRef)
    8085{
  • trunk/WebKit2/UIProcess/API/C/WKFrame.h

    r73591 r74282  
    5050WK_EXPORT WKURLRef WKFrameCopyProvisionalURL(WKFrameRef frame);
    5151WK_EXPORT WKURLRef WKFrameCopyURL(WKFrameRef frame);
    52 
    5352WK_EXPORT WKURLRef WKFrameCopyUnreachableURL(WKFrameRef frame);
    5453
    5554WK_EXPORT WKStringRef WKFrameCopyMIMEType(WKFrameRef frame);
     55WK_EXPORT WKStringRef WKFrameCopyTitle(WKFrameRef frame);
    5656
    5757WK_EXPORT WKPageRef WKFrameGetPage(WKFrameRef frame);
  • trunk/WebKit2/UIProcess/WebFrameProxy.cpp

    r73816 r74282  
    128128void WebFrameProxy::didCommitLoad()
    129129{
    130     // FIXME: Add assertions.
    131130    m_loadState = LoadStateCommitted;
    132131    m_url = m_provisionalURL;
    133132    m_provisionalURL = String();
     133    m_title = String();
    134134}
    135135
     
    143143{
    144144    m_loadState = LoadStateFinished;
     145    m_title = String();
    145146}
    146147
     
    150151}
    151152
    152 void WebFrameProxy::didReceiveTitle(const String&)
     153void WebFrameProxy::didChangeTitle(const String& title)
    153154{
     155    m_title = title;
    154156}
    155157
  • trunk/WebKit2/UIProcess/WebFrameProxy.h

    r73591 r74282  
    8585    const String& mimeType() const { return m_MIMEType; }
    8686
     87    const String& title() const { return m_title; }
     88
    8789    void setCertificateInfo(PassRefPtr<WebCertificateInfo>);
    8890    WebCertificateInfo* certificateInfo() const { return m_certificateInfo.get(); }
     
    101103    void didFailLoad();
    102104    void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.
    103     void didReceiveTitle(const String&);
     105    void didChangeTitle(const String&);
    104106
    105107    void receivedPolicyDecision(WebCore::PolicyAction, uint64_t listenerID);
     
    118120    String m_unreachableURL;
    119121    String m_MIMEType;
     122    String m_title;
    120123    bool m_isFrameSet;
    121124    RefPtr<WebCertificateInfo> m_certificateInfo;
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r74275 r74282  
    239239    }
    240240
    241     m_pageTitle = String();
    242241    m_toolTip = String();
    243242
     
    624623}
    625624
     625String WebPageProxy::pageTitle() const
     626{
     627    // Return the null string if there is no main frame (e.g. nothing has been loaded in the page yet, WebProcess has
     628    // crashed, page has been closed).
     629    if (!m_mainFrame)
     630        return String();
     631
     632    return m_mainFrame->title();
     633}
     634
    626635void WebPageProxy::setUserAgent(const String& userAgent)
    627636{
     
    10151024
    10161025    WebFrameProxy* frame = process()->webFrame(frameID);
    1017 
    1018     frame->didReceiveTitle(title);
    1019 
    1020     // Cache the title for the main frame in the page.
    1021     if (frame == m_mainFrame)
    1022         m_pageTitle = title;
    1023 
     1026    frame->didChangeTitle(title);
     1027   
    10241028    m_loaderClient.didReceiveTitleForFrame(this, title, frame, userData.get());
    10251029}
     
    17151719    }
    17161720
    1717     m_pageTitle = String();
    17181721    m_toolTip = String();
    17191722
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r74275 r74282  
    202202#endif
    203203
    204     const String& pageTitle() const { return m_pageTitle; }
     204    String pageTitle() const;
    205205    const String& toolTip() const { return m_toolTip; }
    206206
     
    436436    RefPtr<WebFrameProxy> m_mainFrame;
    437437    RefPtr<WebFrameProxy> m_focusedFrame;
    438     String m_pageTitle;
    439438
    440439    String m_userAgent;
Note: See TracChangeset for help on using the changeset viewer.