[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

bdakin at apple.com bdakin at apple.com
Wed Dec 22 15:05:40 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6df87f49bc6e298d0c26dcc1808a1f266c20ce9a
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 27 21:46:36 2010 +0000

    Fix for https://bugs.webkit.org/show_bug.cgi?id=48385 Add WebKit
    SPI to scale a WebView
    -and corresponding-
    <rdar://problem/8107667>
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    This patch adds SPI to Mac WebKit that scales the page by the given
    scale factor. The scale factor is factored into the RenderStyle's
    transform.
    
    Set the current pageScale for the document.
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::styleForDocument):
    
    Frame keeps track of the page scale factor. When
    scalePage() is called, it modifies the RenderView's style to
    include a transform of the appropriate scale and forces a style
    recalc.
    * page/Frame.cpp:
    (WebCore::Frame::Frame):
    (WebCore::Frame::scalePage):
    * page/Frame.h:
    (WebCore::Frame::pageScaleFactor):
    * WebCore.exp.in:
    
    Add a scale to the transformation matrix.
    * rendering/style/RenderStyle.cpp:
    (WebCore::RenderStyle::setPageScaleTransform):
    * rendering/style/RenderStyle.h:
    
    WebKit/mac:
    
    This patch adds SPI to Mac WebKit that scales the page by the given
    scale factor.
    
    * WebView/WebView.mm:
    (-[WebView _scaleWebView:]):
    (-[WebView _viewScaleFactor]):
    * WebView/WebViewPrivate.h:
    
    WebKit2:
    
    This patch adds SPI to Mac WebKit that scales the page by the given
    scale factor.
    
    Implement scaleWebView(), which tells WebCore::Frame to scale, and
    viewScaleFactor() which returns the current scale factor.
    * Shared/API/c/WKSharedAPICast.h:
    * UIProcess/API/C/WKPage.cpp:
    (WKPageScaleWebView):
    (WKPageGetViewScaleFactor):
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::WebPageProxy):
    (WebKit::WebPageProxy::scaleWebView):
    * UIProcess/WebPageProxy.h:
    (WebKit::WebPageProxy::viewScaleFactor):
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::scaleWebView):
    (WebKit::WebPage::viewScaleFactor):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebPage/WebPage.messages.in:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70716 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e244fc7..40fee0b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-10-27  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=48385 Add WebKit 
+        SPI to scale a WebView
+        -and corresponding-
+        <rdar://problem/8107667>
+
+        This patch adds SPI to Mac WebKit that scales the page by the given 
+        scale factor. The scale factor is factored into the RenderStyle's 
+        transform.
+
+        Set the current pageScale for the document.
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::styleForDocument):
+
+        Frame keeps track of the page scale factor. When 
+        scalePage() is called, it modifies the RenderView's style to 
+        include a transform of the appropriate scale and forces a style 
+        recalc.
+        * page/Frame.cpp:
+        (WebCore::Frame::Frame):
+        (WebCore::Frame::scalePage):
+        * page/Frame.h:
+        (WebCore::Frame::pageScaleFactor):
+        * WebCore.exp.in:
+
+        Add a scale to the transformation matrix.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::setPageScaleTransform):
+        * rendering/style/RenderStyle.h:
+
 2010-10-27  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 0cb8ac1..0be1b65 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -625,6 +625,7 @@ __ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementEPmPb
 __ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
 __ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE
 __ZN7WebCore5Frame9nodeImageEPNS_4NodeE
+__ZN7WebCore5Frame9scalePageEf
 __ZN7WebCore5FrameD1Ev
 __ZN7WebCore5Image12supportsTypeERKN3WTF6StringE
 __ZN7WebCore5Image20loadPlatformResourceEPKc
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index d61c7ea..e9bedb2 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -21239,6 +21239,7 @@
 			isa = PBXProject;
 			buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
 			compatibilityVersion = "Xcode 2.4";
+			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 90d9319..b902f59 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1112,6 +1112,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
     documentStyle->setDisplay(BLOCK);
     documentStyle->setVisuallyOrdered(document->visuallyOrdered());
     documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
+    documentStyle->setPageScaleTransform(frame ? frame->pageScaleFactor() : 1);
     
     Element* docElement = document->documentElement();
     RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index b76828b..8909755 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -159,6 +159,7 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
     , m_lifeSupportTimer(this, &Frame::lifeSupportTimerFired)
     , m_pageZoomFactor(parentPageZoomFactor(this))
     , m_textZoomFactor(parentTextZoomFactor(this))
+    , m_pageScaleFactor(1)
 #if ENABLE(ORIENTATION_EVENTS)
     , m_orientation(0)
 #endif
@@ -963,4 +964,26 @@ void Frame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor
     }
 }
 
+void Frame::scalePage(float scale)
+{
+    if (m_pageScaleFactor == scale)
+        return;
+
+    m_pageScaleFactor = scale;
+
+    Document* document = this->document();
+    if (!document)
+        return;
+
+    if (document->renderer())
+        document->renderer()->setNeedsLayout(true);
+
+    document->recalcStyle(Node::Force);
+
+    if (FrameView* view = this->view()) {
+        if (document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
+            view->layout();
+    }
+}
+
 } // namespace WebCore
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index 8d10d8e..59e1556 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -144,6 +144,9 @@ namespace WebCore {
         float textZoomFactor() const { return m_textZoomFactor; }
         void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor);
 
+        void scalePage(float scale);
+        float pageScaleFactor() const { return m_pageScaleFactor; }
+
 #if ENABLE(ORIENTATION_EVENTS)
         // Orientation is the interface orientation in degrees. Some examples are:
         //  0 is straight up; -90 is when the device is rotated 90 clockwise;
@@ -215,6 +218,8 @@ namespace WebCore {
         float m_pageZoomFactor;
         float m_textZoomFactor;
 
+        float m_pageScaleFactor;
+
 #if ENABLE(ORIENTATION_EVENTS)
         int m_orientation;
 #endif
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index b56bb1e..68c9186 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -27,6 +27,7 @@
 #include "FontSelector.h"
 #include "RenderArena.h"
 #include "RenderObject.h"
+#include "ScaleTransformOperation.h"
 #include "StyleImage.h"
 #include <wtf/StdLibExtras.h>
 #include <algorithm>
@@ -680,6 +681,17 @@ void RenderStyle::applyTransform(TransformationMatrix& transform, const IntSize&
     }
 }
 
+void RenderStyle::setPageScaleTransform(float scale)
+{
+    if (scale == 1)
+        return;
+    TransformOperations transform;
+    transform.operations().append(ScaleTransformOperation::create(scale, scale, ScaleTransformOperation::SCALE));
+    setTransform(transform);
+    setTransformOriginX(Length(0, Fixed));
+    setTransformOriginY(Length(0, Fixed));
+}
+
 void RenderStyle::setTextShadow(ShadowData* val, bool add)
 {
     ASSERT(!val || (!val->spread() && val->style() == Normal));
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 9aae33f..d01425a 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -713,6 +713,7 @@ public:
 
     enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
     void applyTransform(TransformationMatrix&, const IntSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
+    void setPageScaleTransform(float);
 
     bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
     // End CSS3 Getters
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 8c320da..66e1b29 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,20 @@
+2010-10-27  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=48385 Add WebKit 
+        SPI to scale a WebView
+        -and corresponding-
+        <rdar://problem/8107667>
+
+        This patch adds SPI to Mac WebKit that scales the page by the given 
+        scale factor.
+
+        * WebView/WebView.mm:
+        (-[WebView _scaleWebView:]):
+        (-[WebView _viewScaleFactor]):
+        * WebView/WebViewPrivate.h:
+
 2010-10-27  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 5a4e268..f3a2499 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -144,6 +144,7 @@
 #import <WebCore/PageGroup.h>
 #import <WebCore/PlatformMouseEvent.h>
 #import <WebCore/ProgressTracker.h>
+#import <WebCore/RenderView.h>
 #import <WebCore/RenderWidget.h>
 #import <WebCore/ResourceHandle.h>
 #import <WebCore/RuntimeApplicationChecks.h>
@@ -2625,6 +2626,24 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
     SchemeRegistry::registerURLSchemeAsSecure(scheme);
 }
 
+- (void)_scaleWebView:(float)scale
+{
+    Frame* coreFrame = [self _mainCoreFrame];
+    if (!coreFrame)
+        return;
+
+    coreFrame->scalePage(scale);
+}
+
+- (float)_viewScaleFactor
+{
+    Frame* coreFrame = [self _mainCoreFrame];
+    if (!coreFrame)
+        return 1;
+
+    return coreFrame->pageScaleFactor();
+}
+
 @end
 
 @implementation _WebSafeForwarder
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index d371ede..b951689 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -542,6 +542,9 @@ Could be worth adding to the API.
 + (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
 + (void)_registerURLSchemeAsSecure:(NSString *)scheme;
 
+- (void)_scaleWebView:(float)scale;
+- (float)_viewScaleFactor;
+
 @end
 
 @interface WebView (WebViewPrintingPrivate)
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 7c029b2..519a241 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,33 @@
+2010-10-27  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=48385 Add WebKit 
+        SPI to scale a WebView
+        -and corresponding-
+        <rdar://problem/8107667>
+
+        This patch adds SPI to Mac WebKit that scales the page by the given 
+        scale factor.
+
+        Implement scaleWebView(), which tells WebCore::Frame to scale, and 
+        viewScaleFactor() which returns the current scale factor.
+        * Shared/API/c/WKSharedAPICast.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageScaleWebView):
+        (WKPageGetViewScaleFactor):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::scaleWebView):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::viewScaleFactor):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaleWebView):
+        (WebKit::WebPage::viewScaleFactor):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2010-10-27  Jessie Berlin  <jberlin at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 3d6aa1a..6446a12 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -208,6 +208,16 @@ void WKPageSetPageAndTextZoomFactors(WKPageRef pageRef, double pageZoomFactor, d
     toImpl(pageRef)->setPageAndTextZoomFactors(pageZoomFactor, textZoomFactor);
 }
 
+void WKPageScaleWebView(WKPageRef pageRef, double scale)
+{
+    toImpl(pageRef)->scaleWebView(scale);
+}
+
+double WKPageGetViewScaleFactor(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->viewScaleFactor();
+}
+
 void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindDirection findDirection, WKFindOptions findOptions, unsigned maxMatchCount)
 {
     toImpl(pageRef)->findString(toImpl(string)->string(), toFindDirection(findDirection), toFindOptions(findOptions), maxMatchCount);
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index b0fe943..de6493d 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -236,6 +236,9 @@ WK_EXPORT double WKPageGetPageZoomFactor(WKPageRef page);
 WK_EXPORT void WKPageSetPageZoomFactor(WKPageRef page, double zoomFactor);
 WK_EXPORT void WKPageSetPageAndTextZoomFactors(WKPageRef page, double pageZoomFactor, double textZoomFactor);
 
+WK_EXPORT void WKPageScaleWebView(WKPageRef page, double scale);
+WK_EXPORT double WKPageGetViewScaleFactor(WKPageRef page);
+
 // Find.
 enum {
     kWKFindDirectionForward,
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index e3e0f80..0a5a836 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -83,6 +83,7 @@ WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, uint64_t pageID)
     , m_backForwardList(WebBackForwardList::create(this))
     , m_textZoomFactor(1)
     , m_pageZoomFactor(1)
+    , m_viewScaleFactor(1)
     , m_isValid(true)
     , m_isClosed(false)
     , m_pageID(pageID)
@@ -531,6 +532,18 @@ void WebPageProxy::setPageAndTextZoomFactors(double pageZoomFactor, double textZ
     process()->send(Messages::WebPage::SetPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor), m_pageID); 
 }
 
+void WebPageProxy::scaleWebView(double scale)
+{
+    if (!isValid())
+        return;
+
+    if (m_viewScaleFactor == scale)
+        return;
+
+    m_viewScaleFactor = scale;
+    process()->send(Messages::WebPage::ScaleWebView(scale), m_pageID);
+}
+
 void WebPageProxy::findString(const String& string, FindDirection findDirection, FindOptions findOptions, unsigned maxMatchCount)
 {
     process()->send(Messages::WebPage::FindString(string, findDirection, findOptions, maxMatchCount), m_pageID);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index b45ae97..fb89847 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -184,6 +184,9 @@ public:
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
 
+    void scaleWebView(double scale);
+    double viewScaleFactor() const { return m_viewScaleFactor; }
+
     // Find.
     void findString(const String&, FindDirection, FindOptions, unsigned maxMatchCount);
     void hideFindUI();
@@ -361,6 +364,7 @@ private:
 
     double m_textZoomFactor;
     double m_pageZoomFactor;
+    double m_viewScaleFactor;
     
     // If the process backing the web page is alive and kicking.
     bool m_isValid;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 53af956..5bcd639 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -437,6 +437,22 @@ void WebPage::setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFa
     return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor));
 }
 
+void WebPage::scaleWebView(double scale)
+{
+    Frame* frame = m_mainFrame->coreFrame();
+    if (!frame)
+        return;
+    frame->scalePage(scale);
+}
+
+double WebPage::viewScaleFactor() const
+{
+    Frame* frame = m_mainFrame->coreFrame();
+    if (!frame)
+        return 1;
+    return frame->pageScaleFactor();
+}
+
 void WebPage::installPageOverlay(PassOwnPtr<PageOverlay> pageOverlay)
 {
     m_pageOverlay = pageOverlay;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 8083b0b..277d06b 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -145,6 +145,9 @@ public:
     void setPageZoomFactor(double);
     void setPageAndTextZoomFactors(double pageZoomFactor, double textZoomFactor);
 
+    void scaleWebView(double scale);
+    double viewScaleFactor() const;
+
     void stopLoading();
 
 #if USE(ACCELERATED_COMPOSITING)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.messages.in b/WebKit2/WebProcess/WebPage/WebPage.messages.in
index ff2f5bd..f076371 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -69,6 +69,8 @@ messages -> WebPage {
     SetPageZoomFactor(double zoomFactor)
     SetTextZoomFactor(double zoomFactor)
 
+    ScaleWebView(double scale)
+
     # Find.
     FindString(WTF::String string, uint32_t findDirection, uint32_t findOptions, unsigned maxMatchCount)
     HideFindUI()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list