Title: [115727] trunk
Revision
115727
Author
kenn...@webkit.org
Date
2012-05-01 08:30:30 -0700 (Tue, 01 May 2012)

Log Message

[Qt] Add an experimental extension to set the min. contents width
https://bugs.webkit.org/show_bug.cgi?id=85281

Reviewed by Antonio Gomes.

Source/WebKit2:

Add the experimental property preferredMinimumContentsWidth: which
can be used to set the minimum contents width when not overriden by
the page itself.

Default value is set to 0, which defines normal [desktop] behaviour.

* Shared/WebPreferencesStore.h:
(WebKit):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewExperimental::preferredMinimumContentsWidth):
(QQuickWebViewExperimental::setPreferredMinimumContentsWidth):
* UIProcess/API/qt/qquickwebview_p.h:

Tools:

* MiniBrowser/qt/qml/BrowserWindow.qml:

Set the value of preferredMinimumContentsWidth to 980.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (115726 => 115727)


--- trunk/Source/WebKit2/ChangeLog	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-01 15:30:30 UTC (rev 115727)
@@ -1,5 +1,25 @@
 2012-05-01  Kenneth Rohde Christiansen  <kenn...@webkit.org>
 
+        [Qt] Add an experimental extension to set the min. contents width
+        https://bugs.webkit.org/show_bug.cgi?id=85281
+
+        Reviewed by Antonio Gomes.
+
+        Add the experimental property preferredMinimumContentsWidth: which
+        can be used to set the minimum contents width when not overriden by
+        the page itself.
+
+        Default value is set to 0, which defines normal [desktop] behaviour.
+
+        * Shared/WebPreferencesStore.h:
+        (WebKit):
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewExperimental::preferredMinimumContentsWidth):
+        (QQuickWebViewExperimental::setPreferredMinimumContentsWidth):
+        * UIProcess/API/qt/qquickwebview_p.h:
+
+2012-05-01  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
         [Qt] Stop repeating timers which should only fire once
         https://bugs.webkit.org/show_bug.cgi?id=85277
 

Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (115726 => 115727)


--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h	2012-05-01 15:30:30 UTC (rev 115727)
@@ -128,7 +128,7 @@
     macro(MinimumLogicalFontSize, minimumLogicalFontSize, UInt32, uint32_t, 9) \
     macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \
     macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \
-    macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 980) \
+    macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 0) \
     macro(DeviceDPI, deviceDPI, UInt32, uint32_t, 240) \
     macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 480) \
     macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 854) \

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (115726 => 115727)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-05-01 15:30:30 UTC (rev 115727)
@@ -894,6 +894,34 @@
     d->m_useDefaultContentItemSize = enable;
 }
 
+/*!
+   \brief Minimum contents width when not overriden by the page itself.
+
+   Unless the page defines how contents should be laid out, using e.g.
+   the viewport meta tag, it is laid out given the width of the viewport
+   (in CSS units).
+
+   This setting can be used to enforce a minimum width when the page
+   does not define a width itself. This is useful for laying out pages
+   designed for big screens, commonly knows as desktop pages, on small
+   devices.
+
+   The default value is 0, but the value of 980 is recommented for small
+   screens as it provides a good trade off between legitable pages and
+   non-broken content.
+ */
+int QQuickWebViewExperimental::preferredMinimumContentsWidth() const
+{
+    Q_D(const QQuickWebView);
+    return d->webPageProxy->pageGroup()->preferences()->layoutFallbackWidth();
+}
+
+void QQuickWebViewExperimental::setPreferredMinimumContentsWidth(int width)
+{
+    Q_D(QQuickWebView);
+    d->webPageProxy->pageGroup()->preferences()->setLayoutFallbackWidth(width);
+}
+
 void QQuickWebViewExperimental::setFlickableViewportEnabled(bool enable)
 {
     s_flickableViewportEnabled = enable;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (115726 => 115727)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-05-01 15:30:30 UTC (rev 115727)
@@ -250,6 +250,7 @@
 
     Q_PROPERTY(bool transparentBackground WRITE setTransparentBackground READ transparentBackground)
     Q_PROPERTY(bool useDefaultContentItemSize WRITE setUseDefaultContentItemSize READ useDefaultContentItemSize)
+    Q_PROPERTY(int preferredMinimumContentsWidth WRITE setPreferredMinimumContentsWidth READ preferredMinimumContentsWidth)
 
     Q_PROPERTY(QWebNavigationHistory* navigationHistory READ navigationHistory CONSTANT FINAL)
     Q_PROPERTY(QDeclarativeComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
@@ -316,6 +317,9 @@
     bool useDefaultContentItemSize() const;
     void setUseDefaultContentItemSize(bool enable);
 
+    int preferredMinimumContentsWidth() const;
+    void setPreferredMinimumContentsWidth(int);
+
     // C++ only
     bool renderToOffscreenBuffer() const;
     void setRenderToOffscreenBuffer(bool enable);

Modified: trunk/Tools/ChangeLog (115726 => 115727)


--- trunk/Tools/ChangeLog	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Tools/ChangeLog	2012-05-01 15:30:30 UTC (rev 115727)
@@ -1,3 +1,14 @@
+2012-05-01  Kenneth Rohde Christiansen  <kenn...@webkit.org>
+
+        [Qt] Add an experimental extension to set the min. contents width
+        https://bugs.webkit.org/show_bug.cgi?id=85281
+
+        Reviewed by Antonio Gomes.
+
+        * MiniBrowser/qt/qml/BrowserWindow.qml:
+
+        Set the value of preferredMinimumContentsWidth to 980.
+
 2012-04-30  Ojan Vafai  <o...@chromium.org>
 
         Fix tests to not depend on the actual list of builders at build.chromium.org.

Modified: trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml (115726 => 115727)


--- trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml	2012-05-01 15:18:09 UTC (rev 115726)
+++ trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml	2012-05-01 15:30:30 UTC (rev 115727)
@@ -327,6 +327,7 @@
                 webView.loadHtml("Failed to load " + loadRequest.url, "", loadRequest.url)
         }
 
+        experimental.preferredMinimumContentsWidth: 980
         experimental.itemSelector: ItemSelector { }
         experimental.alertDialog: AlertDialog { }
         experimental.confirmDialog: ConfirmDialog { }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to