- Revision
- 117870
- Author
- [email protected]
- Date
- 2012-05-21 19:04:58 -0700 (Mon, 21 May 2012)
Log Message
<rdar://problem/11460336> and https://bugs.webkit.org/show_bug.cgi?id=87061
WKPageGetScaleFactor can return 0.0 after a session is restored
Reviewed by Beth Dakin.
Source/WebKit2:
API test WKPageGetScaleFactorNotZero added.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::restoreViewState): Tell the UI Process the scale factor
is 1.0 if it has never been manually set.
Tools:
Loads a simple page, creates a session from it, restores that session, then
queries the page scale factor for the appropriate value of 1.0.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp: Added.
(TestWebKitAPI):
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::createSessionState):
(TestWebKitAPI::TEST):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (117869 => 117870)
--- trunk/Source/WebKit2/ChangeLog 2012-05-22 01:55:25 UTC (rev 117869)
+++ trunk/Source/WebKit2/ChangeLog 2012-05-22 02:04:58 UTC (rev 117870)
@@ -1,3 +1,16 @@
+2012-05-21 Brady Eidson <[email protected]>
+
+ <rdar://problem/11460336> and https://bugs.webkit.org/show_bug.cgi?id=87061
+ WKPageGetScaleFactor can return 0.0 after a session is restored
+
+ Reviewed by Beth Dakin.
+
+ API test WKPageGetScaleFactorNotZero added.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::restoreViewState): Tell the UI Process the scale factor
+ is 1.0 if it has never been manually set.
+
2012-05-21 Anders Carlsson <[email protected]>
Flash player buttons do not work when page is zoomed in
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (117869 => 117870)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-05-22 01:55:25 UTC (rev 117869)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-05-22 02:04:58 UTC (rev 117870)
@@ -1128,6 +1128,10 @@
{
// Inform the UI process of the scale factor.
double scaleFactor = m_frame->coreFrame()->loader()->history()->currentItem()->pageScaleFactor();
+
+ // A scale factor of 0.0 means the history item actually has the "default scale factor" of 1.0.
+ if (!scaleFactor)
+ scaleFactor = 1.0;
m_frame->page()->send(Messages::WebPageProxy::PageScaleFactorDidChange(scaleFactor));
// FIXME: This should not be necessary. WebCore should be correctly invalidating
Modified: trunk/Tools/ChangeLog (117869 => 117870)
--- trunk/Tools/ChangeLog 2012-05-22 01:55:25 UTC (rev 117869)
+++ trunk/Tools/ChangeLog 2012-05-22 02:04:58 UTC (rev 117870)
@@ -1,3 +1,21 @@
+2012-05-21 Brady Eidson <[email protected]>
+
+ <rdar://problem/11460336> and https://bugs.webkit.org/show_bug.cgi?id=87061
+ WKPageGetScaleFactor can return 0.0 after a session is restored
+
+ Reviewed by Beth Dakin.
+
+ Loads a simple page, creates a session from it, restores that session, then
+ queries the page scale factor for the appropriate value of 1.0.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp: Added.
+ (TestWebKitAPI):
+ (TestWebKitAPI::didFinishLoadForFrame):
+ (TestWebKitAPI::setPageLoaderClient):
+ (TestWebKitAPI::createSessionState):
+ (TestWebKitAPI::TEST):
+
2012-05-21 Hugo Parente Lima <[email protected]>
[WK2] Remove a useless #if on Tools/WebKitTestRunner/TestController.cpp
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (117869 => 117870)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-05-22 01:55:25 UTC (rev 117869)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2012-05-22 02:04:58 UTC (rev 117870)
@@ -44,6 +44,7 @@
5142B2731517C8C800C32B19 /* ContextMenuCanCopyURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */; };
517E7DFC15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */; };
517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
+ 51E93017156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */; };
51FBBB4D1513D4E900822738 /* WebViewCanPasteURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */; };
51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */; };
51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */; };
@@ -247,6 +248,7 @@
5142B2721517C89100C32B19 /* ContextMenuCanCopyURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = ContextMenuCanCopyURL.html; sourceTree = "<group>"; };
517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
+ 51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageGetScaleFactorNotZero.cpp; sourceTree = "<group>"; };
51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewCanPasteURL.mm; sourceTree = "<group>"; };
51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem_Bundle.cpp; sourceTree = "<group>"; };
51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem.cpp; sourceTree = "<group>"; };
@@ -558,6 +560,7 @@
76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */,
BC901E221492ADCE0074A667 /* WKConnection.cpp */,
BC901E311492AF390074A667 /* WKConnection_Bundle.cpp */,
+ 51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */,
BC7B619A1299FE9E00D174A4 /* WKPreferences.cpp */,
BC90995D12567BC100083756 /* WKString.cpp */,
BC9099931256ACF100083756 /* WKStringJSString.cpp */,
@@ -879,6 +882,7 @@
76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */,
E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */,
F6F49C6915545C8E0007F39D /* DOMWindowExtensionNoCache.cpp in Sources */,
+ 51E93017156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp (0 => 117870)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/WKPageGetScaleFactorNotZero.cpp 2012-05-22 02:04:58 UTC (rev 117870)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+
+namespace TestWebKitAPI {
+
+static bool didFinishLoad;
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
+{
+ didFinishLoad = true;
+}
+
+static void setPageLoaderClient(WKPageRef page)
+{
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+ loaderClient.version = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+
+ WKPageSetPageLoaderClient(page, &loaderClient);
+}
+
+static WKRetainPtr<WKDataRef> createSessionState(WKContextRef context)
+{
+ PlatformWebView webView(context);
+ setPageLoaderClient(webView.page());
+
+ WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ return adoptWK(WKPageCopySessionState(webView.page(), 0, 0));
+}
+
+TEST(WebKit2, WKPageGetScaleFactorNotZero)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+
+ PlatformWebView webView(context.get());
+ setPageLoaderClient(webView.page());
+
+ WKRetainPtr<WKDataRef> data = ""
+ EXPECT_NOT_NULL(data);
+
+ WKPageRestoreFromSessionState(webView.page(), data.get());
+ Util::run(&didFinishLoad);
+
+ EXPECT_TRUE(WKPageGetScaleFactor(webView.page()) == 1.0);
+}
+
+} // namespace TestWebKitAPI