[Qt][WK2] Add preferredMinimumContentsWidth to the viewport info in MiniBrowser.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2012 10:12:40 +0000 (10:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2012 10:12:40 +0000 (10:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88327

Patch by Michael Brüning <michael.bruning@nokia.com> on 2012-06-06
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewExperimental::setPreferredMinimumContentsWidth):
* UIProcess/API/qt/qquickwebview_p.h:

Tools:

* MiniBrowser/qt/MiniBrowser.qrc: Added contents_width.png.
* MiniBrowser/qt/icons/contents_width.png: Added.
* MiniBrowser/qt/qml/BrowserWindow.qml: Added button for toggling preferredMinimumContentsWidth.
* MiniBrowser/qt/qml/ViewportInfoItem.qml: Added display of preferredMinimumContentsWidth.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Tools/ChangeLog
Tools/MiniBrowser/qt/MiniBrowser.qrc
Tools/MiniBrowser/qt/icons/contents_width.png [new file with mode: 0644]
Tools/MiniBrowser/qt/qml/BrowserWindow.qml
Tools/MiniBrowser/qt/qml/ViewportInfoItem.qml

index b8945ac..e56aaa3 100644 (file)
@@ -1,3 +1,14 @@
+2012-06-06  Michael Brüning  <michael.bruning@nokia.com>
+
+        [Qt][WK2] Add preferredMinimumContentsWidth to the viewport info in MiniBrowser.
+        https://bugs.webkit.org/show_bug.cgi?id=88327
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewExperimental::setPreferredMinimumContentsWidth):
+        * UIProcess/API/qt/qquickwebview_p.h:
+
 2012-06-06  Tim Horton  <timothy_horton@apple.com>
 
         WebPage::windowIsVisible is incorrect during resumePainting
index 8adf2dd..8ef1356 100644 (file)
@@ -961,7 +961,13 @@ int QQuickWebViewExperimental::preferredMinimumContentsWidth() const
 void QQuickWebViewExperimental::setPreferredMinimumContentsWidth(int width)
 {
     Q_D(QQuickWebView);
-    d->webPageProxy->pageGroup()->preferences()->setLayoutFallbackWidth(width);
+    WebPreferences* webPreferences = d->webPageProxy->pageGroup()->preferences();
+
+    if (width == webPreferences->layoutFallbackWidth())
+        return;
+
+    webPreferences->setLayoutFallbackWidth(width);
+    emit preferredMinimumContentsWidthChanged();
 }
 
 void QQuickWebViewExperimental::setFlickableViewportEnabled(bool enable)
index 5e5099d..548b0cb 100644 (file)
@@ -248,7 +248,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
 
     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(int preferredMinimumContentsWidth WRITE setPreferredMinimumContentsWidth READ preferredMinimumContentsWidth NOTIFY preferredMinimumContentsWidthChanged)
 
     Q_PROPERTY(QWebNavigationHistory* navigationHistory READ navigationHistory CONSTANT FINAL)
     Q_PROPERTY(QQmlComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
@@ -354,6 +354,7 @@ Q_SIGNALS:
     void enterFullScreenRequested();
     void exitFullScreenRequested();
     void userScriptsChanged();
+    void preferredMinimumContentsWidthChanged();
 
 private:
     QQuickWebView* q_ptr;
index 542880e..09be3f8 100644 (file)
@@ -1,3 +1,15 @@
+2012-06-06  Michael Brüning  <michael.bruning@nokia.com>
+
+        [Qt][WK2] Add preferredMinimumContentsWidth to the viewport info in MiniBrowser.
+        https://bugs.webkit.org/show_bug.cgi?id=88327
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * MiniBrowser/qt/MiniBrowser.qrc: Added contents_width.png.
+        * MiniBrowser/qt/icons/contents_width.png: Added.
+        * MiniBrowser/qt/qml/BrowserWindow.qml: Added button for toggling preferredMinimumContentsWidth.
+        * MiniBrowser/qt/qml/ViewportInfoItem.qml: Added display of preferredMinimumContentsWidth.
+
 2012-06-05  Jon Lee  <jonlee@apple.com>
 
         Buildbot fix.
index b5490be..37fb9a3 100644 (file)
@@ -2,6 +2,7 @@
     <qresource prefix="/">
         <file>icons/checkbox_checked.png</file>
         <file>icons/checkbox_unchecked.png</file>
+        <file>icons/contents_width.png</file>
         <file>icons/favicon.png</file>
         <file>icons/folder.png</file>
         <file>icons/info.png</file>
diff --git a/Tools/MiniBrowser/qt/icons/contents_width.png b/Tools/MiniBrowser/qt/icons/contents_width.png
new file mode 100644 (file)
index 0000000..f2a79eb
Binary files /dev/null and b/Tools/MiniBrowser/qt/icons/contents_width.png differ
index a42a2e9..77b6c36 100644 (file)
@@ -192,6 +192,27 @@ Rectangle {
             }
 
             Rectangle {
+                id: preferredMininumContentsWidthButton
+                height: parent.height
+                width: height
+                color: "#efefef"
+                opacity: { webView.experimental.preferredMinimumContentsWidth === 0 ? 0.1 : 0.6 }
+                radius: 6
+
+                Image {
+                    anchors.centerIn: parent
+                    source: "../icons/contents_width.png"
+                }
+
+                MouseArea {
+                    anchors.fill: parent
+                    onClicked: {
+                        webView.experimental.preferredMinimumContentsWidth = webView.experimental.preferredMinimumContentsWidth === 0 ? 980 : 0
+                    }
+                }
+            }
+
+            Rectangle {
                 id: touchEventsButton
                 height: parent.height
                 width: height
@@ -380,5 +401,6 @@ Rectangle {
         }
         visible: false
         test : webView.experimental.test
+        preferredMinimumContentsWidth: webView.experimental.preferredMinimumContentsWidth
     }
 }
index 88ac012..860a734 100644 (file)
@@ -3,6 +3,7 @@ import QtWebKit 3.0
 
 Rectangle {
     property var test
+    property var preferredMinimumContentsWidth
 
     color: "black"
     opacity: 0.8
@@ -73,8 +74,15 @@ Rectangle {
             color: parent.fontColor
         }
         Text {
-            id: scalableLabel
+            id: preferredMinimumContentsWidthLabel
             anchors.top: layoutSizeLabel.bottom
+            text: "Preferred minimum contents width: " + preferredMinimumContentsWidth
+            font.family: parent.fontFamily
+            color: parent.fontColor
+        }
+        Text {
+            id: scalableLabel
+            anchors.top: preferredMinimumContentsWidthLabel.bottom
             anchors.topMargin: 30
             text: "View " + (test.isScalable ? "is " : "is not " ) + "scalable."
             font.family: parent.fontFamily