2011-01-24 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 02:38:10 +0000 (02:38 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jan 2011 02:38:10 +0000 (02:38 +0000)
        Reviewed by Dan Bernstein.

        Reset the page scale factor on standard frame loads
        https://bugs.webkit.org/show_bug.cgi?id=53058
        <rdar://problem/8908844>

        Add a symbol needed by WebKit2.

        * WebCore.exp.in:
2011-01-24  Anders Carlsson  <andersca@apple.com>

        Reviewed by Dan Bernstein.

        Reset the page scale factor on standard frame loads
        https://bugs.webkit.org/show_bug.cgi?id=53058
        <rdar://problem/8908844>

        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::scaleWebView):
        Don't set m_viewScaleFactor here. It will be set in viewScaleFactorDidChange.

        (WebKit::WebPageProxy::viewScaleFactorDidChange):
        Update m_viewScaleFactor.

        * UIProcess/WebPageProxy.h:
        Add viewScaleFactorDidChange.

        * UIProcess/WebPageProxy.messages.in:
        Add ViewScaleFactorDidChange message.

        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
        Set the scale factor.

        (WebKit::WebFrameLoaderClient::restoreViewState):
        Inform the UI process about the new view scale factor.

        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::scaleWebView):
        Send a ViewScaleFactorDidChange message.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76561 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit/mac/WebView/WebHTMLView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp

index 8e4c74446672da08d9b2acc82d9dc6ccf391e2c9..5de637b44f33edd3af677ca53139a02d0ca1a0bc 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-24  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Reset the page scale factor on standard frame loads
+        https://bugs.webkit.org/show_bug.cgi?id=53058
+        <rdar://problem/8908844>
+
+        Add a symbol needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2011-01-24  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Eric Seidel.
index eabcaa9f79b1ef74134537dbf4012676418a9ec8..106b8f4df90ad5afefc44eee61f30203b6349518 100644 (file)
@@ -980,6 +980,7 @@ __ZNK7WebCore11HistoryItem12isTargetItemEv
 __ZNK7WebCore11HistoryItem12redirectURLsEv
 __ZNK7WebCore11HistoryItem14alternateTitleEv
 __ZNK7WebCore11HistoryItem15lastVisitedTimeEv
+__ZNK7WebCore11HistoryItem15pageScaleFactorEv
 __ZNK7WebCore11HistoryItem17originalURLStringEv
 __ZNK7WebCore11HistoryItem20getTransientPropertyERKN3WTF6StringE
 __ZNK7WebCore11HistoryItem21encodeBackForwardTreeERN3WTF7EncoderE
index 35b3defe8344339d9c082dc4f9e403b53149ba23..bfa0944f99077aa25bea762ce6461363e29a2132 100644 (file)
@@ -1733,6 +1733,14 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     }
 }
 
+- (BOOL)mouseDownCanMoveWindow
+{
+    BOOL result = [super mouseDownCanMoveWindow];
+
+    NSLog(@"%@, %@ %d", self, NSStringFromSelector(_cmd), result);
+    return result;
+}
+
 - (void)_handleAutoscrollForMouseDragged:(NSEvent *)event 
 { 
     [self autoscroll:event]; 
index cf342a28eca6428c7cf885c31d1f43b4de34bb6c..dfbece13bfd4da3eea94c013305fc9ef6eb0897d 100644 (file)
@@ -1,3 +1,35 @@
+2011-01-24  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Reset the page scale factor on standard frame loads
+        https://bugs.webkit.org/show_bug.cgi?id=53058
+        <rdar://problem/8908844>
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::scaleWebView):
+        Don't set m_viewScaleFactor here. It will be set in viewScaleFactorDidChange.
+
+        (WebKit::WebPageProxy::viewScaleFactorDidChange):
+        Update m_viewScaleFactor.
+
+        * UIProcess/WebPageProxy.h:
+        Add viewScaleFactorDidChange.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add ViewScaleFactorDidChange message.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+        Set the scale factor.
+
+        (WebKit::WebFrameLoaderClient::restoreViewState):
+        Inform the UI process about the new view scale factor.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaleWebView):
+        Send a ViewScaleFactorDidChange message.
+
 2011-01-24  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders Carlsson.
index e7b42775a0c74f0f614ca44c965d9a1f0b92f2f0..ab1ea33767cd5dafd0c5e088ed2abe3079ac7ff7 100644 (file)
@@ -890,7 +890,6 @@ void WebPageProxy::scaleWebView(double scale, const IntPoint& origin)
     if (!isValid())
         return;
 
-    m_viewScaleFactor = scale;
     process()->send(Messages::WebPage::ScaleWebView(scale, origin), m_pageID);
 }
 
@@ -920,6 +919,11 @@ void WebPageProxy::setFixedLayoutSize(const IntSize& size)
     process()->send(Messages::WebPage::SetFixedLayoutSize(size), m_pageID);
 }
 
+void WebPageProxy::viewScaleFactorDidChange(double scaleFactor)
+{
+    m_viewScaleFactor = scaleFactor;
+}
+
 void WebPageProxy::findString(const String& string, FindOptions options, unsigned maxMatchCount)
 {
     process()->send(Messages::WebPage::FindString(string, options, maxMatchCount), m_pageID);
index 7b80029dc1cb5674fa7b5bc71fc98a78722c17a2..184f85bf3a5a49d5728431387ace02bc75a4983e 100644 (file)
@@ -260,6 +260,8 @@ public:
     void sendAccessibilityPresenterToken(const CoreIPC::DataReference&);
 #endif
 
+    void viewScaleFactorDidChange(double);
+
     // Find.
     void findString(const String&, FindOptions, unsigned maxMatchCount);
     void hideFindUI();
index 8d26dbd880b18cf6bf7170864ed0ae8fd4291d00..ea16cc48393ba22f3431b661883b777aae0a1a97 100644 (file)
@@ -119,6 +119,8 @@ messages -> WebPageProxy {
 
     DidReceiveAccessibilityPageToken(CoreIPC::DataReference data)
 
+    ViewScaleFactorDidChange(double scaleFactor)
+
 #if PLATFORM(MAC)
     # Keyboard support messages
     InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
@@ -189,7 +191,7 @@ messages -> WebPageProxy {
     GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
     LearnWord(WTF::String word);
     IgnoreWord(WTF::String word);
-    
+
     # Drag and drop messages
     DidPerformDragControllerAction(uint64_t resultOperation)
 #if PLATFORM(MAC)
index 49ce240772e3b7ab1197c3b42fba38cdc92ecb50..ecfede0a07f979020261a50dfcae9ca161ad7020 100644 (file)
@@ -57,6 +57,7 @@
 #include <WebCore/FrameView.h>
 #include <WebCore/HTMLAppletElement.h>
 #include <WebCore/HTMLFormElement.h>
+#include <WebCore/HistoryItem.h>
 #include <WebCore/MIMETypeRegistry.h>
 #include <WebCore/MouseEvent.h>
 #include <WebCore/Page.h>
@@ -426,7 +427,17 @@ void WebFrameLoaderClient::dispatchDidCommitLoad()
     webPage->sandboxExtensionTracker().didCommitProvisionalLoad(m_frame);
 
     // Notify the UIProcess.
+
     webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), response.mimeType(), m_frameHasCustomRepresentation, PlatformCertificateInfo(response), InjectedBundleUserMessageEncoder(userData.get())));
+
+    // Restore the page scale factor.
+    double newPageScaleFactor = m_frame->coreFrame()->pageScaleFactor();
+    
+    // Only restore the scale factor for standard frame loads (of the main frame).
+    if (m_frame->isMainFrame() && m_frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard)
+        newPageScaleFactor = 1.0;
+
+    webPage->scaleWebView(newPageScaleFactor, IntPoint());
 }
 
 void WebFrameLoaderClient::dispatchDidFailProvisionalLoad(const ResourceError& error)
@@ -1003,7 +1014,9 @@ void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*)
 
 void WebFrameLoaderClient::restoreViewState()
 {
-    notImplemented();
+    // Inform the UI process of the scale factor.
+    double scaleFactor = m_frame->coreFrame()->loader()->history()->currentItem()->pageScaleFactor();
+    m_frame->page()->send(Messages::WebPageProxy::ViewScaleFactorDidChange(scaleFactor));
 }
 
 void WebFrameLoaderClient::provisionalLoadStarted()
index e5c581f15f913bca50079efe514bf526b6292064..9ab3b2680aa21d7bc8287ff548d563faa41624cd 100644 (file)
@@ -614,6 +614,8 @@ void WebPage::scaleWebView(double scale, const IntPoint& origin)
     if (!frame)
         return;
     frame->scalePage(scale, origin);
+
+    send(Messages::WebPageProxy::ViewScaleFactorDidChange(scale));
 }
 
 double WebPage::viewScaleFactor() const