Expose Fixed Layout Size mode to Chromium's WebKit API
authorfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2011 20:37:17 +0000 (20:37 +0000)
committerfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2011 20:37:17 +0000 (20:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66568

Reviewed by Darin Fisher.

* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::isFixedLayoutModeEnabled):
(WebKit::WebViewImpl::enableFixedLayoutMode):
(WebKit::WebViewImpl::fixedLayoutSize):
(WebKit::WebViewImpl::setFixedLayoutSize):
* src/WebViewImpl.h:

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

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebView.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h

index ac00ed2fb4def27bbe3dbbb2f0183a619ea08ce9..efe745a5e3eaea36bc6f9e88269b6d2fd08b8c8c 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-19  Fady Samuel  <fsamuel@chromium.org>
+
+        Expose Fixed Layout Size mode to Chromium's WebKit API
+        https://bugs.webkit.org/show_bug.cgi?id=66568
+
+        Reviewed by Darin Fisher.
+
+        * public/WebView.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::isFixedLayoutModeEnabled):
+        (WebKit::WebViewImpl::enableFixedLayoutMode):
+        (WebKit::WebViewImpl::fixedLayoutSize):
+        (WebKit::WebViewImpl::setFixedLayoutSize):
+        * src/WebViewImpl.h:
+
 2011-08-17  Adrienne Walker  <enne@google.com>
 
         [chromium] Split tiler into main thread / compositor thread versions
index 89c132538b3d80a5646d5ac49db02cd1d575f55d..1797dc51a6217094c11956624b074821d9f652f0 100644 (file)
@@ -213,6 +213,18 @@ public:
     virtual void scalePage(float scaleFactor, WebPoint origin) = 0;
 
 
+    // Fixed Layout --------------------------------------------------------
+
+    // In fixed layout mode, the layout of the page is independent of the
+    // view port size, given by WebWidget::size().
+
+    virtual bool isFixedLayoutModeEnabled() const = 0;
+    virtual void enableFixedLayoutMode(bool enable) = 0;
+
+    virtual WebSize fixedLayoutSize() const = 0;
+    virtual void setFixedLayoutSize(const WebSize&) = 0;
+
+
     // Media ---------------------------------------------------------------
 
     // Performs the specified action on the node at the given location.
index 80115dd68a5582a87dc7322e214e91f08a77b7ce..7b2b4e419ce0056cacef6b37ed4d62f57cd356f0 100644 (file)
@@ -1862,6 +1862,54 @@ void WebViewImpl::scalePage(float scaleFactor, WebPoint origin)
     frame->scalePage(scaleFactor, origin);
 }
 
+bool WebViewImpl::isFixedLayoutModeEnabled() const
+{
+    if (!page())
+        return false;
+
+    Frame* frame = page()->mainFrame();
+    if (!frame)
+        return false;
+
+    return frame->view()->useFixedLayout();
+}
+
+void WebViewImpl::enableFixedLayoutMode(bool enable)
+{
+    if (!page())
+        return;
+
+    Frame* frame = page()->mainFrame();
+    if (!frame)
+        return;
+
+    frame->view()->setUseFixedLayout(enable);
+}
+
+WebSize WebViewImpl::fixedLayoutSize() const
+{
+    if (!page())
+        return WebSize();
+
+    Frame* frame = page()->mainFrame();
+    if (!frame)
+        return WebSize();
+
+    return frame->view()->fixedLayoutSize();
+}
+
+void WebViewImpl::setFixedLayoutSize(const WebSize& layoutSize)
+{
+    if (!page())
+        return;
+
+    Frame* frame = page()->mainFrame();
+    if (!frame)
+        return;
+
+    frame->view()->setFixedLayoutSize(layoutSize);
+}
+
 void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action,
                                            const WebPoint& location)
 {
index c4b6c6a058d2aeec32a0f7ac26470d3badd6f7e2..c7cd12b6704dc956204b1047536cbda1bb16649c 100644 (file)
@@ -157,6 +157,10 @@ public:
                                    double maximumZoomLevel);
     virtual float pageScaleFactor() const;
     virtual void scalePage(float scaleFactor, WebPoint origin);
+    virtual bool isFixedLayoutModeEnabled() const;
+    virtual void enableFixedLayoutMode(bool enable);
+    virtual WebSize fixedLayoutSize() const;
+    virtual void setFixedLayoutSize(const WebSize&);
     virtual void performMediaPlayerAction(
         const WebMediaPlayerAction& action,
         const WebPoint& location);