[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

mitz at apple.com mitz at apple.com
Fri Jan 21 15:11:36 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 4063ec7c842443786a43b5c109aab7cad0b7f190
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 8 23:47:39 2011 +0000

    In WebKit2, page zooming does not work with PDF
    https://bugs.webkit.org/show_bug.cgi?id=52113
    
    Reviewed by Maciej Stachowiak.
    
    * UIProcess/API/C/WKPage.cpp:
    (WKPageSupportsTextZoom): Added. Returns whether the page currently supports text-only zoom.
    * UIProcess/API/C/WKPage.h:
    * UIProcess/API/mac/PDFViewController.h: Made pdfDocumentClass() private and declared new
    member functions.
    * UIProcess/API/mac/PDFViewController.mm:
    (WebKit::PDFViewController::zoomFactor): Added.
    (WebKit::PDFViewController::setZoomFactor): Added.
    * UIProcess/API/mac/PageClientImpl.h:
    * UIProcess/API/mac/PageClientImpl.mm:
    (WebKit::PageClientImpl::customRepresentationZoomFactor): Added. Calls through to the WKView.
    (WebKit::PageClientImpl::setCustomRepresentationZoomFactor): Ditto.
    * UIProcess/API/mac/WKView.mm:
    (-[WKView _customRepresentationZoomFactor]): Added. Calls through to the PDFViewController.
    (-[WKView _setCustomRepresentationZoomFactor:]): Ditto.
    * UIProcess/API/mac/WKViewInternal.h:
    * UIProcess/API/qt/qwkpage_p.h:
    (QWKPagePrivate::customRepresentationZoomFactor): Added.
    (QWKPagePrivate::setCustomRepresentationZoomFactor): Added.
    * UIProcess/PageClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::WebPageProxy): Coding style fix.
    (WebKit::WebPageProxy::supportsTextZoom): Added. Returns false if the main frame has a custom
    representation or is a standalone image, true otherwise.
    (WebKit::WebPageProxy::setTextZoomFactor): Bail out if the main frame has a custom representation.
    (WebKit::WebPageProxy::pageZoomFactor): If the main frame has a custom representation, get the
    zoom factor from the page client.
    (WebKit::WebPageProxy::setPageZoomFactor): If the main frame has a custom representation, have
    the client set the zoom factor.
    (WebKit::WebPageProxy::setPageAndTextZoomFactors): Ditto.
    * UIProcess/WebPageProxy.h:
    (WebKit::WebPageProxy::textZoomFactor): Changed to return 1 if the main frame has a custom
    representation.
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::customRepresentationZoomFactor): Added.
    (WebKit::WebView::setCustomRepresentationZoomFactor): Added.
    * UIProcess/win/WebView.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75331 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7e842c7..0700aaa 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,48 @@
+2011-01-08  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        In WebKit2, page zooming does not work with PDF
+        https://bugs.webkit.org/show_bug.cgi?id=52113
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSupportsTextZoom): Added. Returns whether the page currently supports text-only zoom.
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/API/mac/PDFViewController.h: Made pdfDocumentClass() private and declared new
+        member functions.
+        * UIProcess/API/mac/PDFViewController.mm:
+        (WebKit::PDFViewController::zoomFactor): Added.
+        (WebKit::PDFViewController::setZoomFactor): Added.
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::customRepresentationZoomFactor): Added. Calls through to the WKView.
+        (WebKit::PageClientImpl::setCustomRepresentationZoomFactor): Ditto.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _customRepresentationZoomFactor]): Added. Calls through to the PDFViewController.
+        (-[WKView _setCustomRepresentationZoomFactor:]): Ditto.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/API/qt/qwkpage_p.h:
+        (QWKPagePrivate::customRepresentationZoomFactor): Added.
+        (QWKPagePrivate::setCustomRepresentationZoomFactor): Added.
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy): Coding style fix.
+        (WebKit::WebPageProxy::supportsTextZoom): Added. Returns false if the main frame has a custom
+        representation or is a standalone image, true otherwise.
+        (WebKit::WebPageProxy::setTextZoomFactor): Bail out if the main frame has a custom representation.
+        (WebKit::WebPageProxy::pageZoomFactor): If the main frame has a custom representation, get the
+        zoom factor from the page client.
+        (WebKit::WebPageProxy::setPageZoomFactor): If the main frame has a custom representation, have
+        the client set the zoom factor.
+        (WebKit::WebPageProxy::setPageAndTextZoomFactors): Ditto.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::textZoomFactor): Changed to return 1 if the main frame has a custom
+        representation.
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::customRepresentationZoomFactor): Added.
+        (WebKit::WebView::setCustomRepresentationZoomFactor): Added.
+        * UIProcess/win/WebView.h:
+
 2011-01-08  Jeff Miller  <jeffm at apple.com>
 
         Reviewed by Jon Honeycutt.
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 0720ca1..6b30d51 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -235,6 +235,11 @@ double WKPageGetTextZoomFactor(WKPageRef pageRef)
     return toImpl(pageRef)->textZoomFactor();
 }
 
+bool WKPageSupportsTextZoom(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->supportsTextZoom();
+}
+
 void WKPageSetTextZoomFactor(WKPageRef pageRef, double zoomFactor)
 {
     toImpl(pageRef)->setTextZoomFactor(zoomFactor);
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index a827a33..4d89178 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -295,6 +295,7 @@ typedef bool (*WKPageSessionStateFilterCallback)(WKPageRef page, WKStringRef val
 WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback);
 WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData);
 
+WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page);
 WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page);
 WK_EXPORT void WKPageSetTextZoomFactor(WKPageRef page, double zoomFactor);
 WK_EXPORT double WKPageGetPageZoomFactor(WKPageRef page);
diff --git a/WebKit2/UIProcess/API/mac/PDFViewController.h b/WebKit2/UIProcess/API/mac/PDFViewController.h
index 15043bd..2c4a235 100644
--- a/WebKit2/UIProcess/API/mac/PDFViewController.h
+++ b/WebKit2/UIProcess/API/mac/PDFViewController.h
@@ -51,7 +51,9 @@ public:
     WKView* wkView() const { return m_wkView; }
     void setPDFDocumentData(const String& mimeType, const CoreIPC::DataReference&);
 
-    static Class pdfDocumentClass();
+    double zoomFactor() const;
+    void setZoomFactor(double);
+
     static Class pdfPreviewViewClass();
 
     NSPrintOperation *makePrintOperation(NSPrintInfo *);
@@ -59,6 +61,7 @@ public:
 private:
     explicit PDFViewController(WKView *wkView);
 
+    static Class pdfDocumentClass();
     static NSBundle* pdfKitBundle();
 
     WKView* m_wkView;
diff --git a/WebKit2/UIProcess/API/mac/PDFViewController.mm b/WebKit2/UIProcess/API/mac/PDFViewController.mm
index e01d0b3..7c41640 100644
--- a/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -151,6 +151,16 @@ void PDFViewController::setPDFDocumentData(const String& mimeType, const CoreIPC
     [m_pdfView setDocument:pdfDocument.get()];
 }
 
+double PDFViewController::zoomFactor() const
+{
+    return [m_pdfView scaleFactor];
+}
+
+void PDFViewController::setZoomFactor(double zoomFactor)
+{
+    [m_pdfView setScaleFactor:zoomFactor];
+}
+
 Class PDFViewController::pdfDocumentClass()
 {
     static Class pdfDocumentClass = [pdfKitBundle() classNamed:@"PDFDocument"];
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.h b/WebKit2/UIProcess/API/mac/PageClientImpl.h
index e26f591..888129c 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -81,6 +81,9 @@ private:
     virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
     virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
 
+    virtual double customRepresentationZoomFactor();
+    virtual void setCustomRepresentationZoomFactor(double);
+
     WKView* m_wkView;
     RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
 };
diff --git a/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index dac6e47..b401078 100644
--- a/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -291,4 +291,14 @@ void PageClientImpl::didFinishLoadingDataForCustomRepresentation(const CoreIPC::
     [m_wkView _didFinishLoadingDataForCustomRepresentation:dataReference];
 }
 
+double PageClientImpl::customRepresentationZoomFactor()
+{
+    return [m_wkView _customRepresentationZoomFactor];
+}
+
+void PageClientImpl::setCustomRepresentationZoomFactor(double zoomFactor)
+{
+    [m_wkView _setCustomRepresentationZoomFactor:zoomFactor];
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 3b4e1f9..1186d55 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1536,4 +1536,20 @@ static bool isViewVisible(NSView *view)
     _data->_pdfViewController->setPDFDocumentData(_data->_page->mainFrame()->mimeType(), dataReference);
 }
 
+- (double)_customRepresentationZoomFactor
+{
+    if (!_data->_pdfViewController)
+        return 1;
+
+    return _data->_pdfViewController->zoomFactor();
+}
+
+- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor
+{
+    if (!_data->_pdfViewController)
+        return;
+
+    _data->_pdfViewController->setZoomFactor(zoomFactor);
+}
+
 @end
diff --git a/WebKit2/UIProcess/API/mac/WKViewInternal.h b/WebKit2/UIProcess/API/mac/WKViewInternal.h
index 544573c..8cc72d6 100644
--- a/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -57,5 +57,7 @@ namespace WebKit {
 
 - (void)_setPageHasCustomRepresentation:(BOOL)pageHasCustomRepresentation;
 - (void)_didFinishLoadingDataForCustomRepresentation:(const CoreIPC::DataReference&)dataReference;
+- (double)_customRepresentationZoomFactor;
+- (void)_setCustomRepresentationZoomFactor:(double)zoomFactor;
 
 @end
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 9c443fc..b0d0a30 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -69,6 +69,8 @@ public:
 
     virtual void didCommitLoadForMainFrame(bool useCustomRepresentation);
     virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+    virtual double customRepresentationZoomFactor() { return 1; }
+    virtual void setCustomRepresentationZoomFactor(double) { }
 
     void paint(QPainter* painter, QRect);
 
diff --git a/WebKit2/UIProcess/PageClient.h b/WebKit2/UIProcess/PageClient.h
index e197d71..40decc1 100644
--- a/WebKit2/UIProcess/PageClient.h
+++ b/WebKit2/UIProcess/PageClient.h
@@ -101,6 +101,8 @@ public:
     // Custom representations.
     virtual void didCommitLoadForMainFrame(bool useCustomRepresentation) = 0;
     virtual void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&) = 0;
+    virtual double customRepresentationZoomFactor() = 0;
+    virtual void setCustomRepresentationZoomFactor(double) = 0;
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 3be40d8..a5985dd 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -96,7 +96,7 @@ WebPageProxy::WebPageProxy(WebContext* context, WebPageGroup* pageGroup, uint64_
     , m_pageGroup(pageGroup)
     , m_mainFrame(0)
     , m_userAgent(standardUserAgent())
-    , m_estimatedProgress(0.0)
+    , m_estimatedProgress(0)
     , m_isInWindow(false)
     , m_backForwardList(WebBackForwardList::create(this))
     , m_textZoomFactor(1)
@@ -742,11 +742,26 @@ void WebPageProxy::restoreFromSessionStateData(WebData*)
 }
 #endif
 
+bool WebPageProxy::supportsTextZoom() const
+{
+    if (m_mainFrameHasCustomRepresentation)
+        return false;
+
+    // FIXME: This should also return false for standalone media and plug-in documents.
+    if (!m_mainFrame || m_mainFrame->isDisplayingStandaloneImageDocument())
+        return false;
+
+    return true;
+}
+ 
 void WebPageProxy::setTextZoomFactor(double zoomFactor)
 {
     if (!isValid())
         return;
 
+    if (m_mainFrameHasCustomRepresentation)
+        return;
+
     if (m_textZoomFactor == zoomFactor)
         return;
 
@@ -754,11 +769,21 @@ void WebPageProxy::setTextZoomFactor(double zoomFactor)
     process()->send(Messages::WebPage::SetTextZoomFactor(m_textZoomFactor), m_pageID); 
 }
 
+double WebPageProxy::pageZoomFactor() const
+{
+    return m_mainFrameHasCustomRepresentation ? m_pageClient->customRepresentationZoomFactor() : m_pageZoomFactor;
+}
+
 void WebPageProxy::setPageZoomFactor(double zoomFactor)
 {
     if (!isValid())
         return;
 
+    if (m_mainFrameHasCustomRepresentation) {
+        m_pageClient->setCustomRepresentationZoomFactor(zoomFactor);
+        return;
+    }
+
     if (m_pageZoomFactor == zoomFactor)
         return;
 
@@ -771,6 +796,11 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
     if (!isValid())
         return;
 
+    if (m_mainFrameHasCustomRepresentation) {
+        m_pageClient->setCustomRepresentationZoomFactor(pageZoomFactor);
+        return;
+    }
+
     if (m_pageZoomFactor == pageZoomFactor && m_textZoomFactor == textZoomFactor)
         return;
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 3e0a406..e3d7ffe 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -226,9 +226,10 @@ public:
     PassRefPtr<WebData> sessionStateData(WebPageProxySessionStateFilterCallback, void* context) const;
     void restoreFromSessionStateData(WebData*);
 
-    double textZoomFactor() const { return m_textZoomFactor; }
+    bool supportsTextZoom() const;
+    double textZoomFactor() const { return m_mainFrameHasCustomRepresentation ? 1 : m_textZoomFactor; }
     void setTextZoomFactor(double);
-    double pageZoomFactor() const { return m_pageZoomFactor; }
+    double pageZoomFactor() const;
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
 
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index 282f76f..092826a 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -981,6 +981,15 @@ void WebView::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataRef
 {
 }
 
+double WebView::customRepresentationZoomFactor()
+{
+    return 1;
+}
+
+void WebView::setCustomRepresentationZoomFactor(double)
+{
+}
+
 void WebView::setIsInWindow(bool isInWindow)
 {
     m_page->setIsInWindow(isInWindow);
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index 3216154..f502973 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -130,6 +130,8 @@ private:
 
     void didCommitLoadForMainFrame(bool useCustomRepresentation);
     void didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference&);
+    virtual double customRepresentationZoomFactor();
+    virtual void setCustomRepresentationZoomFactor(double);
 
     virtual HWND nativeWindow();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list