Diff
Modified: trunk/Source/WebKit2/ChangeLog (163331 => 163332)
--- trunk/Source/WebKit2/ChangeLog 2014-02-03 23:27:19 UTC (rev 163331)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-03 23:33:20 UTC (rev 163332)
@@ -1,3 +1,31 @@
+2014-02-03 Anders Carlsson <[email protected]>
+
+ NavigationState should be a PageLoadState::Observer
+ https://bugs.webkit.org/show_bug.cgi?id=128130
+
+ Reviewed by Darin Adler.
+
+ This will make it easier to provide load related KVO properties on WKWebView.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ * UIProcess/API/Cocoa/WKWebViewInternal.h: Added.
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationState):
+ (WebKit::NavigationState::~NavigationState):
+ (WebKit::NavigationState::willChangeIsLoading):
+ (WebKit::NavigationState::didChangeIsLoading):
+ (WebKit::NavigationState::willChangeTitle):
+ (WebKit::NavigationState::didChangeTitle):
+ (WebKit::NavigationState::willChangeActiveURL):
+ (WebKit::NavigationState::didChangeActiveURL):
+ (WebKit::NavigationState::willChangeHasOnlySecureContent):
+ (WebKit::NavigationState::didChangeHasOnlySecureContent):
+ (WebKit::NavigationState::willChangeEstimatedProgress):
+ (WebKit::NavigationState::didChangeEstimatedProgress):
+ * WebKit2.xcodeproj/project.pbxproj:
+
2014-02-03 Tim Horton <[email protected]>
WebKit2 View Gestures: Two smart magnifications in a row without moving the mouse should zoom out
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (163331 => 163332)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-02-03 23:27:19 UTC (rev 163331)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2014-02-03 23:33:20 UTC (rev 163332)
@@ -24,7 +24,7 @@
*/
#import "config.h"
-#import "WKWebView.h"
+#import "WKWebViewInternal.h"
#if WK_API_ENABLED
@@ -37,18 +37,13 @@
#import <wtf/RetainPtr.h>
#if PLATFORM(IOS)
-#import "WKContentViewInternal.h"
#import "WKScrollView.h"
-#import <UIKit/UIScrollView_Private.h>
-#import <UIKit/_UIWebViewportHandler.h>
static const float minWebViewScale = 0.25;
static const float maxWebViewScale = 5;
static _UIWebViewportConfiguration standardViewportConfiguration = { { UIWebViewportStandardViewportWidth, UIWebViewportGrowsAndShrinksToFitHeight }, UIWebViewportScaleForScalesToFit, minWebViewScale, maxWebViewScale, true
};
-@interface WKWebView () <UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate>
-@end
#endif
#if PLATFORM(MAC) && !PLATFORM(IOS)
@@ -59,8 +54,6 @@
RetainPtr<WKWebViewConfiguration> _configuration;
std::unique_ptr<WebKit::NavigationState> _navigationState;
- RefPtr<WebKit::WebPageProxy> _page;
-
#if PLATFORM(IOS)
RetainPtr<WKScrollView> _scrollView;
RetainPtr<WKContentView> _contentView;
@@ -89,8 +82,6 @@
if (![_configuration processClass])
[_configuration setProcessClass:adoptNS([[WKProcessClass alloc] init]).get()];
- _navigationState = std::make_unique<WebKit::NavigationState>(self);
-
CGRect bounds = self.bounds;
#if PLATFORM(IOS)
@@ -119,6 +110,7 @@
_page = WebKit::toImpl([_wkView pageRef]);
#endif
+ _navigationState = std::make_unique<WebKit::NavigationState>(self);
_page->setPolicyClient(_navigationState->createPolicyClient());
_page->setLoaderClient(_navigationState->createLoaderClient());
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (0 => 163332)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2014-02-03 23:33:20 UTC (rev 163332)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WKWebView.h"
+
+#if WK_API_ENABLED
+
+#import <wtf/RefPtr.h>
+
+#if PLATFORM(IOS)
+#import "WKContentViewInternal.h"
+#import <UIKit/UIScrollView_Private.h>
+#import <UIKit/_UIWebViewportHandler.h>
+#endif
+
+#if PLATFORM(IOS)
+#define WK_WEB_VIEW_PROTOCOLS <UIScrollViewDelegate, WKContentViewDelegate, _UIWebViewportHandlerDelegate>
+#endif
+
+#if !defined(WK_WEB_VIEW_PROTOCOLS)
+#define WK_WEB_VIEW_PROTOCOLS
+#endif
+
+namespace WebKit {
+class WebPageProxy;
+}
+
+@interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
+
+@package
+ RefPtr<WebKit::WebPageProxy> _page;
+}
+@end
+
+#endif
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h (163331 => 163332)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h 2014-02-03 23:27:19 UTC (rev 163331)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.h 2014-02-03 23:33:20 UTC (rev 163332)
@@ -34,6 +34,7 @@
#import <wtf/RetainPtr.h>
#import "APILoaderClient.h"
#import "APIPolicyClient.h"
+#import "PageLoadState.h"
#import "WeakObjCPtr.h"
@class WKNavigation;
@@ -42,7 +43,7 @@
namespace WebKit {
-class NavigationState {
+class NavigationState : private PageLoadState::Observer {
public:
explicit NavigationState(WKWebView *);
~NavigationState();
@@ -86,6 +87,21 @@
NavigationState& m_navigationState;
};
+ // PageLoadState::Observer
+ virtual void willChangeIsLoading() override;
+ virtual void didChangeIsLoading() override;
+ virtual void willChangeTitle() override;
+ virtual void didChangeTitle() override;
+ virtual void willChangeActiveURL() override;
+ virtual void didChangeActiveURL() override;
+ virtual void willChangeHasOnlySecureContent() override;
+ virtual void didChangeHasOnlySecureContent() override;
+ virtual void willChangeEstimatedProgress() override;
+ virtual void didChangeEstimatedProgress() override;
+
+ WKWebView *m_webView;
+ WeakObjCPtr<id <WKNavigationDelegate> > m_navigationDelegate;
+
struct {
bool webViewDecidePolicyForNavigationActionDecisionHandler : 1;
bool webViewDecidePolicyForNavigationResponseDecisionHandler : 1;
@@ -98,9 +114,6 @@
bool webViewDidFailNavigationWithError : 1;
} m_navigationDelegateMethods;
- WKWebView *m_webView;
- WeakObjCPtr<id <WKNavigationDelegate> > m_navigationDelegate;
-
HashMap<uint64_t, RetainPtr<WKNavigation>> m_navigations;
};
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (163331 => 163332)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-02-03 23:27:19 UTC (rev 163331)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2014-02-03 23:33:20 UTC (rev 163332)
@@ -30,17 +30,25 @@
#import "WKNavigationDelegate.h"
#import "WKNavigationInternal.h"
+#import "WKWebViewInternal.h"
+#import "PageLoadState.h"
#import "WebFrameProxy.h"
+#import "WebPageProxy.h"
namespace WebKit {
NavigationState::NavigationState(WKWebView *webView)
- : m_navigationDelegateMethods()
+ : m_webView(webView)
+ , m_navigationDelegateMethods()
{
+ ASSERT(m_webView->_page);
+
+ m_webView->_page->pageLoadState().addObserver(*this);
}
NavigationState::~NavigationState()
{
+ m_webView->_page->pageLoadState().removeObserver(*this);
}
std::unique_ptr<API::LoaderClient> NavigationState::createLoaderClient()
@@ -295,6 +303,46 @@
[navigationDelegate webView:m_navigationState.m_webView didFailNavigation:navigation withError:error];
}
+void NavigationState::willChangeIsLoading()
+{
+}
+
+void NavigationState::didChangeIsLoading()
+{
+}
+
+void NavigationState::willChangeTitle()
+{
+}
+
+void NavigationState::didChangeTitle()
+{
+}
+
+void NavigationState::willChangeActiveURL()
+{
+}
+
+void NavigationState::didChangeActiveURL()
+{
+}
+
+void NavigationState::willChangeHasOnlySecureContent()
+{
+}
+
+void NavigationState::didChangeHasOnlySecureContent()
+{
+}
+
+void NavigationState::willChangeEstimatedProgress()
+{
+}
+
+void NavigationState::didChangeEstimatedProgress()
+{
+}
+
} // namespace WebKit
#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (163331 => 163332)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-02-03 23:27:19 UTC (rev 163331)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2014-02-03 23:33:20 UTC (rev 163332)
@@ -190,6 +190,7 @@
1A64230912DD09EB00CAAE2C /* DrawingAreaProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */; };
1A64245E12DE29A100CAAE2C /* UpdateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A64245C12DE29A100CAAE2C /* UpdateInfo.h */; };
1A64245F12DE29A100CAAE2C /* UpdateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */; };
+ 1A66BF8F18A052ED002071B4 /* WKWebViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */; };
1A6F9F9011E13EFC00DB1371 /* CommandLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */; };
1A6F9FB711E1408500DB1371 /* CommandLineMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */; };
1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */; };
@@ -1837,6 +1838,7 @@
1A64230712DD09EB00CAAE2C /* DrawingAreaProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaProxyMessages.h; sourceTree = "<group>"; };
1A64245C12DE29A100CAAE2C /* UpdateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateInfo.h; sourceTree = "<group>"; };
1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UpdateInfo.cpp; sourceTree = "<group>"; };
+ 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewInternal.h; sourceTree = "<group>"; };
1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommandLine.h; sourceTree = "<group>"; };
1A6F9FB611E1408500DB1371 /* CommandLineMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommandLineMac.cpp; sourceTree = "<group>"; };
1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginView.cpp; sourceTree = "<group>"; };
@@ -4295,6 +4297,7 @@
1A3CC16418906ACF001E6ED8 /* WKWebView.mm */,
1ADF59191890528E0043C145 /* WKWebViewConfiguration.h */,
1ADF59181890528E0043C145 /* WKWebViewConfiguration.mm */,
+ 1A66BF8E18A052ED002071B4 /* WKWebViewInternal.h */,
);
path = Cocoa;
sourceTree = "<group>";
@@ -6773,6 +6776,7 @@
BC407606124FF0270068F20A /* WKString.h in Headers */,
7C9D1537184584DA009D3918 /* WKBrowsingContextGroupInternal.h in Headers */,
373CEAD81859553F008C363D /* WKPagePolicyClientInternal.h in Headers */,
+ 1A66BF8F18A052ED002071B4 /* WKWebViewInternal.h in Headers */,
BC40761A124FF0370068F20A /* WKStringCF.h in Headers */,
759CCD591808F1690078E8A8 /* WebOriginDataManagerProxyChangeClient.h in Headers */,
BC9099801256A98200083756 /* WKStringPrivate.h in Headers */,