Changeset 73412 in webkit


Ignore:
Timestamp:
Dec 6, 2010 4:33:18 PM (13 years ago)
Author:
weinig@apple.com
Message:

Generalize didChangeLocationWithinPageForFrame for all same document navigations
https://bugs.webkit.org/show_bug.cgi?id=50584

Reviewed by Anders Carlsson.

WebKit2:

  • Rename didChangeLocationWithinPageForFrame callbacks to didSameDocumentNavigationForFrame
  • Add WKSameDocumentNavigationType to didChangeLocationWithinPageForFrame.
  • Call didSameDocumentNavigationForFrame for HTML session state changes.
  • Shared/API/c/WKPageLoadTypes.h: Added.
  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toAPI):
Moved WKFrameNavigationType here from WKPage.h and add WKSameDocumentNavigationType.

  • Shared/SameDocumentNavigationType.h: Added.
  • UIProcess/API/C/WKAPICast.h:

Moved WKFrameNavigationType conversion from here.

  • UIProcess/API/C/WKPage.h:
  • UIProcess/API/qt/qwkpage.cpp:

(QWKPage::QWKPage):
Update comment.

  • UIProcess/WebFrameProxy.cpp:

(WebKit::WebFrameProxy::didSameDocumentNavigation):

  • UIProcess/WebFrameProxy.h:
  • UIProcess/WebLoaderClient.cpp:

(WebKit::WebLoaderClient::didSameDocumentNavigationForFrame):

  • UIProcess/WebLoaderClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • WebProcess/InjectedBundle/API/c/WKBundlePage.h:
  • WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:

(WebKit::InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame):

  • WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:

Pipe new name through.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
Call didChangeLocationWithinPageForFrame for session state changes.

  • WebKit2.pro:
  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
  • win/WebKit2Generated.make:

Add new files.

WebKitTools:

  • MiniBrowser/mac/BrowserWindowController.m:

(didSameDocumentNavigationForFrame):
(-[BrowserWindowController awakeFromNib]):
(-[BrowserWindowController didSameDocumentNavigationForFrame:]):

  • TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp:

(TestWebKitAPI::didSameDocumentNavigationForFrame):
(TestWebKitAPI::TEST):

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didSameDocumentNavigationForFrame):

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::initialize):

Location:
trunk
Files:
2 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r73410 r73412  
     12010-12-06  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Generalize didChangeLocationWithinPageForFrame for all same document navigations
     6        https://bugs.webkit.org/show_bug.cgi?id=50584
     7
     8          - Rename didChangeLocationWithinPageForFrame callbacks to didSameDocumentNavigationForFrame
     9          - Add WKSameDocumentNavigationType to didChangeLocationWithinPageForFrame.
     10          - Call didSameDocumentNavigationForFrame for HTML session state changes.
     11
     12        * Shared/API/c/WKPageLoadTypes.h: Added.
     13        * Shared/API/c/WKSharedAPICast.h:
     14        (WebKit::toAPI):
     15        Moved WKFrameNavigationType here from WKPage.h and add WKSameDocumentNavigationType.
     16
     17        * Shared/SameDocumentNavigationType.h: Added.
     18        * UIProcess/API/C/WKAPICast.h:
     19        Moved WKFrameNavigationType conversion from here.
     20
     21        * UIProcess/API/C/WKPage.h:
     22        * UIProcess/API/qt/qwkpage.cpp:
     23        (QWKPage::QWKPage):
     24        Update comment.
     25
     26        * UIProcess/WebFrameProxy.cpp:
     27        (WebKit::WebFrameProxy::didSameDocumentNavigation):
     28        * UIProcess/WebFrameProxy.h:
     29        * UIProcess/WebLoaderClient.cpp:
     30        (WebKit::WebLoaderClient::didSameDocumentNavigationForFrame):
     31        * UIProcess/WebLoaderClient.h:
     32        * UIProcess/WebPageProxy.cpp:
     33        (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
     34        * UIProcess/WebPageProxy.h:
     35        * UIProcess/WebPageProxy.messages.in:
     36        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     37        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
     38        (WebKit::InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame):
     39        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
     40        Pipe new name through.
     41
     42        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     43        (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
     44        (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
     45        (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
     46        (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
     47        Call didChangeLocationWithinPageForFrame for session state changes.
     48
     49        * WebKit2.pro:
     50        * WebKit2.xcodeproj/project.pbxproj:
     51        * win/WebKit2.vcproj:
     52        * win/WebKit2Generated.make:
     53        Add new files.
     54
    1552010-12-06  Jessie Berlin  <jberlin@apple.com>
    256
  • trunk/WebKit2/Shared/API/c/WKSharedAPICast.h

    r73267 r73412  
    2727#define WKSharedAPICast_h
    2828
     29#include "SameDocumentNavigationType.h"
    2930#include "WKBase.h"
    3031#include "WKContextMenuItemTypes.h"
     
    3233#include "WKFindOptions.h"
    3334#include "WKGeometry.h"
     35#include "WKPageLoadTypes.h"
    3436#include "WebError.h"
    3537#include "WebEvent.h"
     
    3941#include "WebURL.h"
    4042#include <WebCore/ContextMenuItem.h>
     43#include <WebCore/FloatRect.h>
     44#include <WebCore/FrameLoaderTypes.h>
     45#include <WebCore/IntPoint.h>
    4146#include <WebCore/IntRect.h>
    42 #include <WebCore/FloatRect.h>
    43 #include <WebCore/IntPoint.h>
    4447#include <wtf/TypeTraits.h>
    4548
     
    646649}
    647650
     651inline WKFrameNavigationType toAPI(WebCore::NavigationType type)
     652{
     653    WKFrameNavigationType wkType = kWKFrameNavigationTypeOther;
     654
     655    switch (type) {
     656    case WebCore::NavigationTypeLinkClicked:
     657        wkType = kWKFrameNavigationTypeLinkClicked;
     658        break;
     659    case WebCore::NavigationTypeFormSubmitted:
     660        wkType = kWKFrameNavigationTypeFormSubmitted;
     661        break;
     662    case WebCore::NavigationTypeBackForward:
     663        wkType = kWKFrameNavigationTypeBackForward;
     664        break;
     665    case WebCore::NavigationTypeReload:
     666        wkType = kWKFrameNavigationTypeReload;
     667        break;
     668    case WebCore::NavigationTypeFormResubmitted:
     669        wkType = kWKFrameNavigationTypeFormResubmitted;
     670        break;
     671    case WebCore::NavigationTypeOther:
     672        wkType = kWKFrameNavigationTypeOther;
     673        break;
     674    }
     675   
     676    return wkType;
     677}
     678
     679inline WKSameDocumentNavigationType toAPI(SameDocumentNavigationType type)
     680{
     681    WKFrameNavigationType wkType = kWKSameDocumentNavigationAnchorNavigation;
     682
     683    switch (type) {
     684    case SameDocumentNavigationAnchorNavigation:
     685        wkType = kWKSameDocumentNavigationAnchorNavigation;
     686        break;
     687    case SameDocumentNavigationSessionStatePush:
     688        wkType = kWKSameDocumentNavigationSessionStatePush;
     689        break;
     690    case SameDocumentNavigationSessionStateReplace:
     691        wkType = kWKSameDocumentNavigationSessionStateReplace;
     692        break;
     693    case SameDocumentNavigationSessionStatePop:
     694        wkType = kWKSameDocumentNavigationSessionStatePop;
     695        break;
     696    }
     697   
     698    return wkType;
     699}
     700
    648701} // namespace WebKit
    649702
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r73281 r73412  
    3333#include "WKPreferencesPrivate.h"
    3434#include "WKSharedAPICast.h"
    35 #include <WebCore/FrameLoaderTypes.h>
    3635
    3736namespace WebKit {
     
    7675
    7776/* Enum conversions */
    78 
    79 inline WKFrameNavigationType toAPI(WebCore::NavigationType type)
    80 {
    81     WKFrameNavigationType wkType = kWKFrameNavigationTypeOther;
    82 
    83     switch (type) {
    84     case WebCore::NavigationTypeLinkClicked:
    85         wkType = kWKFrameNavigationTypeLinkClicked;
    86         break;
    87     case WebCore::NavigationTypeFormSubmitted:
    88         wkType = kWKFrameNavigationTypeFormSubmitted;
    89         break;
    90     case WebCore::NavigationTypeBackForward:
    91         wkType = kWKFrameNavigationTypeBackForward;
    92         break;
    93     case WebCore::NavigationTypeReload:
    94         wkType = kWKFrameNavigationTypeReload;
    95         break;
    96     case WebCore::NavigationTypeFormResubmitted:
    97         wkType = kWKFrameNavigationTypeFormResubmitted;
    98         break;
    99     case WebCore::NavigationTypeOther:
    100         wkType = kWKFrameNavigationTypeOther;
    101         break;
    102     }
    103    
    104     return wkType;
    105 }
    10677
    10778inline CacheModel toCacheModel(WKCacheModel wkCacheModel)
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r73336 r73412  
    3232#include <WebKit2/WKGeometry.h>
    3333#include <WebKit2/WKNativeEvent.h>
     34#include <WebKit2/WKPageLoadTypes.h>
    3435
    3536#ifndef __cplusplus
     
    4041extern "C" {
    4142#endif
    42 
    43 enum {
    44     kWKFrameNavigationTypeLinkClicked = 0,
    45     kWKFrameNavigationTypeFormSubmitted = 1,
    46     kWKFrameNavigationTypeBackForward = 2,
    47     kWKFrameNavigationTypeReload = 3,
    48     kWKFrameNavigationTypeFormResubmitted = 4,
    49     kWKFrameNavigationTypeOther = 5
    50 };
    51 typedef uint32_t WKFrameNavigationType;
    5243
    5344// FrameLoad Client
     
    5950typedef void (*WKPageDidFinishLoadForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
    6051typedef void (*WKPageDidFailLoadWithErrorForFrameCallback)(WKPageRef page, WKFrameRef frame, WKErrorRef error, WKTypeRef userData, const void *clientInfo);
    61 typedef void (*WKPageDidChangeLocationWithinPageForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     52typedef void (*WKPageDidSameDocumentNavigationForFrameCallback)(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo);
    6253typedef void (*WKPageDidReceiveTitleForFrameCallback)(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
    6354typedef void (*WKPageDidFirstLayoutForFrameCallback)(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo);
     
    9283    WKPageDidFinishLoadForFrameCallback                                 didFinishLoadForFrame;
    9384    WKPageDidFailLoadWithErrorForFrameCallback                          didFailLoadWithErrorForFrame;
    94     WKPageDidChangeLocationWithinPageForFrameCallback                   didChangeLocationWithinPageForFrame;
     85    WKPageDidSameDocumentNavigationForFrameCallback                     didSameDocumentNavigationForFrame;
    9586    WKPageDidReceiveTitleForFrameCallback                               didReceiveTitleForFrame;
    9687    WKPageDidFirstLayoutForFrameCallback                                didFirstLayoutForFrame;
  • trunk/WebKit2/UIProcess/API/qt/qwkpage.cpp

    r73336 r73412  
    318318        qt_wk_didFinishLoadForFrame,
    319319        qt_wk_didFailLoadWithErrorForFrame,
    320         0, /* didChangeLocationWithinPageForFrame */
     320        0, /* didSameDocumentNavigationForFrame */
    321321        qt_wk_didReceiveTitleForFrame,
    322322        qt_wk_didFirstLayoutForFrame,
  • trunk/WebKit2/UIProcess/WebFrameProxy.cpp

    r73336 r73412  
    116116}
    117117
    118 void WebFrameProxy::didChangeURLWithoutNavigation(const String& url)
     118void WebFrameProxy::didSameDocumentNavigation(const String& url)
    119119{
    120120    m_url = url;
  • trunk/WebKit2/UIProcess/WebFrameProxy.h

    r73336 r73412  
    9696    void didFinishLoad();
    9797    void didFailLoad();
    98     void didChangeURLWithoutNavigation(const String&); // eg. anchor navigation, session state change.
     98    void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.
    9999    void didReceiveTitle(const String&);
    100100
  • trunk/WebKit2/UIProcess/WebLoaderClient.cpp

    r73336 r73412  
    8989}
    9090
    91 void WebLoaderClient::didChangeLocationWithinPageForFrame(WebPageProxy* page, WebFrameProxy* frame, APIObject* userData)
    92 {
    93     if (!m_client.didChangeLocationWithinPageForFrame)
    94         return;
    95 
    96     m_client.didChangeLocationWithinPageForFrame(toAPI(page), toAPI(frame), toAPI(userData), m_client.clientInfo);
     91void WebLoaderClient::didSameDocumentNavigationForFrame(WebPageProxy* page, WebFrameProxy* frame, SameDocumentNavigationType type, APIObject* userData)
     92{
     93    if (!m_client.didSameDocumentNavigationForFrame)
     94        return;
     95
     96    m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), toAPI(userData), m_client.clientInfo);
    9797}
    9898
  • trunk/WebKit2/UIProcess/WebLoaderClient.h

    r73336 r73412  
    2828
    2929#include "APIClient.h"
     30#include "SameDocumentNavigationType.h"
    3031#include "WKPage.h"
    3132#include <wtf/Forward.h>
     
    5354    void didFinishLoadForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
    5455    void didFailLoadWithErrorForFrame(WebPageProxy*, WebFrameProxy*, const WebCore::ResourceError&, APIObject*);
    55     void didChangeLocationWithinPageForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
     56    void didSameDocumentNavigationForFrame(WebPageProxy*, WebFrameProxy*, SameDocumentNavigationType, APIObject*);
    5657    void didReceiveTitleForFrame(WebPageProxy*, const String&, WebFrameProxy*, APIObject*);
    5758    void didFirstLayoutForFrame(WebPageProxy*, WebFrameProxy*, APIObject*);
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r73336 r73412  
    863863}
    864864
    865 void WebPageProxy::didChangeLocationWithinPageForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
    866 {
    867     RefPtr<APIObject> userData;
    868     WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context());
    869     if (!arguments->decode(messageDecoder))
    870         return;
    871 
    872     WebFrameProxy* frame = process()->webFrame(frameID);
    873     frame->didChangeURLWithoutNavigation(url);
    874 
    875     m_loaderClient.didChangeLocationWithinPageForFrame(this, frame, userData.get());
     865void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
     866{
     867    RefPtr<APIObject> userData;
     868    WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context());
     869    if (!arguments->decode(messageDecoder))
     870        return;
     871
     872    WebFrameProxy* frame = process()->webFrame(frameID);
     873    frame->didSameDocumentNavigation(url);
     874
     875    m_loaderClient.didSameDocumentNavigationForFrame(this, frame, static_cast<SameDocumentNavigationType>(opaqueSameDocumentNavigationType), userData.get());
    876876}
    877877
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r73336 r73412  
    284284    void didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
    285285    void didFailLoadForFrame(uint64_t frameID, const WebCore::ResourceError&, CoreIPC::ArgumentDecoder*);
    286     void didChangeLocationWithinPageForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
     286    void didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t sameDocumentNavigationType, const String&, CoreIPC::ArgumentDecoder*);
    287287    void didReceiveTitleForFrame(uint64_t frameID, const String&, CoreIPC::ArgumentDecoder*);
    288288    void didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder*);
  • trunk/WebKit2/UIProcess/WebPageProxy.messages.in

    r73336 r73412  
    8787    DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
    8888    DidRunInsecureContentForFrame(uint64_t frameID, WebKit::InjectedBundleUserMessageEncoder userData)
    89     DidChangeLocationWithinPageForFrame(uint64_t frameID, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
     89    DidSameDocumentNavigationForFrame(uint64_t frameID, uint32_t type, WTF::String url, WebKit::InjectedBundleUserMessageEncoder userData)
    9090
    9191    FrameDidBecomeFrameSet(uint64_t frameID, bool value)
  • trunk/WebKit2/WebKit2.pro

    r73281 r73412  
    219219    Shared/API/c/WKGeometry.h \
    220220    Shared/API/c/WKNumber.h \
     221    Shared/API/c/WKPageLoadTypes.h \
    221222    Shared/API/c/WKSecurityOrigin.h \
    222223    Shared/API/c/WKSerializedScriptValue.h \
     
    242243    Shared/NotImplemented.h \
    243244    Shared/PlatformPopupMenuData.h \
     245    Shared/SameDocumentNavigationType.h \
    244246    Shared/StringPairVector.h \
    245247    Shared/UserMessageCoders.h \
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r73301 r73412  
    328328                BC2652181182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2652141182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp */; };
    329329                BC2652191182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */; };
     330                BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */; };
     331                BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
    330332                BC2DFBA312A761A500E732A3 /* WebPreferencesCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */; };
    331333                BC2E6E871141971500A63B1E /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2E6E771141970C00A63B1E /* RunLoop.cpp */; };
     
    958960                BC2652141182608100243E12 /* ChunkedUpdateDrawingAreaProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkedUpdateDrawingAreaProxy.cpp; sourceTree = "<group>"; };
    959961                BC2652151182608100243E12 /* ChunkedUpdateDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChunkedUpdateDrawingAreaProxy.h; sourceTree = "<group>"; };
     962                BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SameDocumentNavigationType.h; sourceTree = "<group>"; };
     963                BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageLoadTypes.h; sourceTree = "<group>"; };
    960964                BC2DFBA212A761A500E732A3 /* WebPreferencesCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebPreferencesCF.cpp; path = cf/WebPreferencesCF.cpp; sourceTree = "<group>"; };
    961965                BC2E6E771141970C00A63B1E /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
     
    15131517                                BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */,
    15141518                                BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */,
     1519                                BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */,
    15151520                                1AAB4A8C1296F0A20023952F /* SandboxExtension.h */,
    15161521                                BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */,
     
    22382243                                BC4075E5124FF0270068F20A /* WKNumber.cpp */,
    22392244                                BC4075E6124FF0270068F20A /* WKNumber.h */,
     2245                                BC2D021812AC426C00E732A3 /* WKPageLoadTypes.h */,
    22402246                                F634445A12A885E9000612D8 /* WKSecurityOrigin.cpp */,
    22412247                                F634445B12A885E9000612D8 /* WKSecurityOrigin.h */,
     
    26202626                                F634445612A885C8000612D8 /* WebSecurityOrigin.h in Headers */,
    26212627                                F634445D12A885E9000612D8 /* WKSecurityOrigin.h in Headers */,
     2628                                BC2D021712AC41CB00E732A3 /* SameDocumentNavigationType.h in Headers */,
     2629                                BC2D021912AC426C00E732A3 /* WKPageLoadTypes.h in Headers */,
    26222630                        );
    26232631                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r73336 r73412  
    3030#include <WebKit2/WKEvent.h>
    3131#include <WebKit2/WKFindOptions.h>
     32#include <WebKit2/WKPageLoadTypes.h>
    3233
    3334#ifndef __cplusplus
     
    7475typedef void (*WKBundlePageDidFinishDocumentLoadForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
    7576typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo);
    76 typedef void (*WKBundlePageDidChangeLocationWithinPageForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
     77typedef void (*WKBundlePageDidSameDocumentNavigationForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo);
    7778typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
    7879typedef void (*WKBundlePageDidFirstLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
     
    9899    WKBundlePageDidFinishLoadForFrameCallback                           didFinishLoadForFrame;
    99100    WKBundlePageDidFailLoadWithErrorForFrameCallback                    didFailLoadWithErrorForFrame;
    100     WKBundlePageDidChangeLocationWithinPageForFrameCallback             didChangeLocationWithinPageForFrame;
     101    WKBundlePageDidSameDocumentNavigationForFrameCallback               didSameDocumentNavigationForFrame;
    101102    WKBundlePageDidReceiveTitleForFrameCallback                         didReceiveTitleForFrame;
    102103    WKBundlePageDidFirstLayoutForFrame                                  didFirstLayoutForFrame;
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp

    r73336 r73412  
    106106}
    107107
    108 void InjectedBundlePageLoaderClient::didChangeLocationWithinPageForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
    109 {
    110     if (!m_client.didChangeLocationWithinPageForFrame)
    111         return;
    112 
    113     WKTypeRef userDataToPass = 0;
    114     m_client.didChangeLocationWithinPageForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     108void InjectedBundlePageLoaderClient::didSameDocumentNavigationForFrame(WebPage* page, WebFrame* frame, SameDocumentNavigationType type, RefPtr<APIObject>& userData)
     109{
     110    if (!m_client.didSameDocumentNavigationForFrame)
     111        return;
     112
     113    WKTypeRef userDataToPass = 0;
     114    m_client.didSameDocumentNavigationForFrame(toAPI(page), toAPI(frame), toAPI(type), &userDataToPass, m_client.clientInfo);
    115115    userData = adoptRef(toImpl(userDataToPass));
    116116}
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h

    r73336 r73412  
    2828
    2929#include "APIClient.h"
     30#include "SameDocumentNavigationType.h"
    3031#include "WKBundlePage.h"
    3132#include <JavaScriptCore/JSBase.h>
     
    5253    void didFinishLoadForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
    5354    void didFailLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData);
    54     void didChangeLocationWithinPageForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     55    void didSameDocumentNavigationForFrame(WebPage*, WebFrame*, SameDocumentNavigationType, RefPtr<APIObject>& userData);
    5556    void didReceiveTitleForFrame(WebPage*, const String&, WebFrame*, RefPtr<APIObject>& userData);
    5657    void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r73336 r73412  
    279279
    280280    // Notify the bundle client.
    281     webPage->injectedBundleLoaderClient().didChangeLocationWithinPageForFrame(webPage, m_frame, userData);
    282 
    283     // Notify the UIProcess.
    284     webPage->send(Messages::WebPageProxy::DidChangeLocationWithinPageForFrame(m_frame->frameID(), m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
     281    webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationAnchorNavigation, userData);
     282
     283    // Notify the UIProcess.
     284    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
    285285}
    286286
    287287void WebFrameLoaderClient::dispatchDidPushStateWithinPage()
    288288{
    289     notImplemented();
     289    WebPage* webPage = m_frame->page();
     290    if (!webPage)
     291        return;
     292
     293    RefPtr<APIObject> userData;
     294
     295    // Notify the bundle client.
     296    webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePush, userData);
     297
     298    // Notify the UIProcess.
     299    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
    290300}
    291301
    292302void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
    293303{
    294     notImplemented();
     304    WebPage* webPage = m_frame->page();
     305    if (!webPage)
     306        return;
     307
     308    RefPtr<APIObject> userData;
     309
     310    // Notify the bundle client.
     311    webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStateReplace, userData);
     312
     313    // Notify the UIProcess.
     314    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
    295315}
    296316
    297317void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
    298318{
    299     notImplemented();
     319    WebPage* webPage = m_frame->page();
     320    if (!webPage)
     321        return;
     322
     323    RefPtr<APIObject> userData;
     324
     325    // Notify the bundle client.
     326    webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(webPage, m_frame, SameDocumentNavigationSessionStatePop, userData);
     327
     328    // Notify the UIProcess.
     329    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->loader()->url().string(), InjectedBundleUserMessageEncoder(userData.get())));
    300330}
    301331
  • trunk/WebKit2/win/WebKit2.vcproj

    r73281 r73412  
    480480                        </File>
    481481                        <File
     482                                RelativePath="..\Shared\SameDocumentNavigationType.h"
     483                                >
     484                        </File>
     485                        <File
    482486                                RelativePath="..\Shared\StringPairVector.h"
    483487                                >
     
    756760                                <File
    757761                                        RelativePath="..\Shared\API\c\WKNumber.h"
     762                                        >
     763                                </File>
     764                                <File
     765                                        RelativePath="..\Shared\API\c\WKPageLoadTypes.h"
    758766                                        >
    759767                                </File>
  • trunk/WebKit2/win/WebKit2Generated.make

    r73286 r73412  
    2222    xcopy /y /d "..\Shared\API\c\WKMutableDictionary.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    2323    xcopy /y /d "..\Shared\API\c\WKNumber.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     24    xcopy /y /d "..\Shared\API\c\WKPageLoadTypes.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    2425    xcopy /y /d "..\Shared\API\C\WKSecurityOrigin.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
    2526    xcopy /y /d "..\Shared\API\c\WKSerializedScriptValue.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
  • trunk/WebKitTools/ChangeLog

    r73409 r73412  
     12010-12-06  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Generalize didChangeLocationWithinPageForFrame for all same document navigations
     6        https://bugs.webkit.org/show_bug.cgi?id=50584
     7
     8        * MiniBrowser/mac/BrowserWindowController.m:
     9        (didSameDocumentNavigationForFrame):
     10        (-[BrowserWindowController awakeFromNib]):
     11        (-[BrowserWindowController didSameDocumentNavigationForFrame:]):
     12        * TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp:
     13        (TestWebKitAPI::didSameDocumentNavigationForFrame):
     14        (TestWebKitAPI::TEST):
     15        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     16        (WTR::InjectedBundlePage::InjectedBundlePage):
     17        (WTR::InjectedBundlePage::didSameDocumentNavigationForFrame):
     18        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
     19        * WebKitTestRunner/TestController.cpp:
     20        (WTR::TestController::initialize):
     21
    1222010-12-06  Kinuko Yasuda  <kinuko@chromium.org>
    223
  • trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m

    r73336 r73412  
    3939- (void)didFailProvisionalLoadWithErrorForFrame:(WKFrameRef)frame;
    4040- (void)didFailLoadWithErrorForFrame:(WKFrameRef)frame;
    41 - (void)didChangeLocationWithinPageForFrame:(WKFrameRef)frame;
     41- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame;
    4242@end
    4343
     
    285285}
    286286
    287 static void didChangeLocationWithinPageForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
    288 {
    289     [(BrowserWindowController *)clientInfo didChangeLocationWithinPageForFrame:frame];
     287static void didSameDocumentNavigationForFrame(WKPageRef page, WKFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef userData, const void *clientInfo)
     288{
     289    [(BrowserWindowController *)clientInfo didSameDocumentNavigationForFrame:frame];
    290290}
    291291
     
    555555        didFinishLoadForFrame,
    556556        didFailLoadWithErrorForFrame,
    557         didChangeLocationWithinPageForFrame,
     557        didSameDocumentNavigationForFrame,
    558558        didReceiveTitleForFrame,
    559559        didFirstLayoutForFrame,
     
    680680}
    681681
    682 - (void)didChangeLocationWithinPageForFrame:(WKFrameRef)frame
     682- (void)didSameDocumentNavigationForFrame:(WKFrameRef)frame
    683683{
    684684}
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/PageLoadDidChangeLocationWithinPageForFrame.cpp

    r73336 r73412  
    4444
    4545static bool didChangeLocationWithinPage;
    46 static void didChangeLocationWithinPageForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
     46static void didSameDocumentNavigationForFrame(WKPageRef, WKFrameRef, WKSameDocumentNavigationType type, WKTypeRef, const void*)
    4747{
     48    TEST_ASSERT(type == kWKSameDocumentNavigationAnchorNavigation);
    4849    didChangeLocationWithinPage = true;
    4950}
     
    5960    memset(&loaderClient, 0, sizeof(loaderClient));
    6061    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
    61     loaderClient.didChangeLocationWithinPageForFrame = didChangeLocationWithinPageForFrame;
     62    loaderClient.didSameDocumentNavigationForFrame = didSameDocumentNavigationForFrame;
    6263    WKPageSetPageLoaderClient(webView.page(), &loaderClient);
    6364
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r73336 r73412  
    181181        didFinishLoadForFrame,
    182182        didFailLoadWithErrorForFrame,
    183         didChangeLocationWithinPageForFrame,
     183        didSameDocumentNavigationForFrame,
    184184        didReceiveTitleForFrame,
    185185        0,
     
    303303}
    304304
    305 void InjectedBundlePage::didChangeLocationWithinPageForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef*, const void* clientInfo)
    306 {
    307     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didChangeLocationWithinPageForFrame(frame);
     305void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef*, const void* clientInfo)
     306{
     307    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didSameDocumentNavigationForFrame(frame, type);
    308308}
    309309
     
    536536}
    537537
    538 void InjectedBundlePage::didChangeLocationWithinPageForFrame(WKBundleFrameRef frame)
     538void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundleFrameRef frame, WKSameDocumentNavigationType type)
    539539{
    540540}
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r73336 r73412  
    6161    static void didCancelClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
    6262    static void willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef, WKURLRef url, double delay, double date, const void*);
    63     static void didChangeLocationWithinPageForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
     63    static void didSameDocumentNavigationForFrame(WKBundlePageRef, WKBundleFrameRef, WKSameDocumentNavigationType, WKTypeRef*, const void*);
    6464    static void didHandleOnloadEventsForFrame(WKBundlePageRef, WKBundleFrameRef, const void*);
    6565    static void didDisplayInsecureContentForFrame(WKBundlePageRef, WKBundleFrameRef, WKTypeRef*, const void*);
     
    7575    void didCancelClientRedirectForFrame(WKBundleFrameRef);
    7676    void willPerformClientRedirectForFrame(WKBundleFrameRef, WKURLRef url, double delay, double date);
    77     void didChangeLocationWithinPageForFrame(WKBundleFrameRef);
     77    void didSameDocumentNavigationForFrame(WKBundleFrameRef, WKSameDocumentNavigationType);
    7878    void didFinishDocumentLoadForFrame(WKBundleFrameRef);
    7979    void didHandleOnloadEventsForFrame(WKBundleFrameRef);
  • trunk/WebKitTools/WebKitTestRunner/TestController.cpp

    r73336 r73412  
    252252        didFinishLoadForFrame,
    253253        0, // didFailLoadWithErrorForFrame
    254         0, // didChangeLocationWithinPageForFrame
     254        0, // didSameDocumentNavigationForFrame
    255255        0, // didReceiveTitleForFrame
    256256        0, // didFirstLayoutForFrame
Note: See TracChangeset for help on using the changeset viewer.