Diff
Modified: trunk/Source/WebCore/ChangeLog (119974 => 119975)
--- trunk/Source/WebCore/ChangeLog 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebCore/ChangeLog 2012-06-11 13:53:11 UTC (rev 119975)
@@ -1,3 +1,19 @@
+2012-06-11 Kenneth Rohde Christiansen <[email protected]>
+
+ Add QML api for setting device width and height
+ https://bugs.webkit.org/show_bug.cgi?id=88777
+
+ Reviewed by Simon Hausmann.
+
+ Change the default values for deviceWidth/Height to be 0 (unset). The
+ original values were introduced by Qt and 0 makes it possible to
+ detect if a value has never been set and therefore fall back.
+
+ Only Qt depended on the former values.
+
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings):
+
2012-06-11 Csaba Osztrogonác <[email protected]>
[Qt][Win] Fix UString related build problem in Source/WebCore/bridge/qt/qt_instance.cpp
Modified: trunk/Source/WebCore/page/Settings.cpp (119974 => 119975)
--- trunk/Source/WebCore/page/Settings.cpp 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebCore/page/Settings.cpp 2012-06-11 13:53:11 UTC (rev 119975)
@@ -134,8 +134,8 @@
, m_layoutFallbackWidth(980)
, m_devicePixelRatio(1.0)
, m_maximumDecodedImageSize(numeric_limits<size_t>::max())
- , m_deviceWidth(480)
- , m_deviceHeight(854)
+ , m_deviceWidth(0)
+ , m_deviceHeight(0)
, m_sessionStorageQuota(StorageMap::noQuota)
, m_editingBehaviorType(editingBehaviorTypeForPlatform())
, m_maximumHTMLParserDOMTreeDepth(defaultMaximumHTMLParserDOMTreeDepth)
Modified: trunk/Source/WebKit2/ChangeLog (119974 => 119975)
--- trunk/Source/WebKit2/ChangeLog 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/ChangeLog 2012-06-11 13:53:11 UTC (rev 119975)
@@ -1,3 +1,26 @@
+2012-06-11 Kenneth Rohde Christiansen <[email protected]>
+
+ Add QML api for setting device width and height
+ https://bugs.webkit.org/show_bug.cgi?id=88777
+
+ Reviewed by Simon Hausmann.
+
+ Add the new API and set the default values to 0 (unset). The
+ current values were introduced by Qt and only Qt depends on them.
+
+ * Shared/WebPreferencesStore.h:
+ (WebKit):
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewExperimental::deviceWidth):
+ (QQuickWebViewExperimental::setDeviceWidth):
+ (QQuickWebViewExperimental::deviceHeight):
+ (QQuickWebViewExperimental::setDeviceHeight):
+ * UIProcess/API/qt/qquickwebview_p.h:
+ * UIProcess/qt/QtViewportHandler.cpp:
+ (WebKit::QtViewportHandler::viewportItemSizeChanged):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::sendViewportAttributesChanged):
+
2012-06-11 Michael Brüning <[email protected]>
[Qt][WK2] Compute and set cache capacities using the current CacheModel
Modified: trunk/Source/WebKit2/Shared/WebPreferencesStore.h (119974 => 119975)
--- trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/Shared/WebPreferencesStore.h 2012-06-11 13:53:11 UTC (rev 119975)
@@ -134,8 +134,8 @@
macro(DefaultFontSize, defaultFontSize, UInt32, uint32_t, 16) \
macro(DefaultFixedFontSize, defaultFixedFontSize, UInt32, uint32_t, 13) \
macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 980) \
- macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 480) \
- macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 854) \
+ macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 0) \
+ macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 0) \
macro(PDFDisplayMode, pdfDisplayMode, UInt32, uint32_t, 1) \
macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
macro(InspectorAttachedHeight, inspectorAttachedHeight, UInt32, uint32_t, 300) \
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (119974 => 119975)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-06-11 13:53:11 UTC (rev 119975)
@@ -1195,7 +1195,7 @@
If the above is used on a device with device pixel ratio of 1.5, it will be scaled
down but still provide a better looking image.
- */
+*/
double QQuickWebViewExperimental::devicePixelRatio() const
{
@@ -1216,6 +1216,54 @@
/*!
\internal
+ \qmlproperty int WebViewExperimental::deviceWidth
+ \brief The device width used by the viewport calculations.
+
+ The value used when calculation the viewport, eg. what is used for 'device-width' when
+ used in the viewport meta tag. If unset (zero or negative width), the width of the
+ actual viewport is used instead.
+*/
+
+int QQuickWebViewExperimental::deviceWidth() const
+{
+ Q_D(const QQuickWebView);
+ return d->webPageProxy->pageGroup()->preferences()->deviceWidth();
+}
+
+void QQuickWebViewExperimental::setDeviceWidth(int value)
+{
+ Q_D(QQuickWebView);
+ d->webPageProxy->pageGroup()->preferences()->setDeviceWidth(qMax(0, value));
+ emit deviceWidthChanged();
+}
+
+/*!
+ \internal
+
+ \qmlproperty int WebViewExperimental::deviceHeight
+ \brief The device width used by the viewport calculations.
+
+ The value used when calculation the viewport, eg. what is used for 'device-height' when
+ used in the viewport meta tag. If unset (zero or negative height), the height of the
+ actual viewport is used instead.
+*/
+
+int QQuickWebViewExperimental::deviceHeight() const
+{
+ Q_D(const QQuickWebView);
+ return d->webPageProxy->pageGroup()->preferences()->deviceHeight();
+}
+
+void QQuickWebViewExperimental::setDeviceHeight(int value)
+{
+ Q_D(QQuickWebView);
+ d->webPageProxy->pageGroup()->preferences()->setDeviceHeight(qMax(0, value));
+ emit deviceHeightChanged();
+}
+
+/*!
+ \internal
+
\qmlmethod void WebViewExperimental::evaluateJavaScript(string script [, function(result)])
\brief Evaluates the specified _javascript_ and, if supplied, calls a function with the result.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (119974 => 119975)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2012-06-11 13:53:11 UTC (rev 119975)
@@ -248,9 +248,14 @@
Q_PROPERTY(bool transparentBackground WRITE setTransparentBackground READ transparentBackground)
Q_PROPERTY(bool useDefaultContentItemSize WRITE setUseDefaultContentItemSize READ useDefaultContentItemSize)
+
Q_PROPERTY(int preferredMinimumContentsWidth WRITE setPreferredMinimumContentsWidth READ preferredMinimumContentsWidth NOTIFY preferredMinimumContentsWidthChanged)
+ Q_PROPERTY(int deviceWidth WRITE setDeviceWidth READ deviceWidth NOTIFY deviceWidthChanged)
+ Q_PROPERTY(int deviceHeight WRITE setDeviceHeight READ deviceHeight NOTIFY deviceHeightChanged)
+ Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
Q_PROPERTY(QWebNavigationHistory* navigationHistory READ navigationHistory CONSTANT FINAL)
+
Q_PROPERTY(QQmlComponent* alertDialog READ alertDialog WRITE setAlertDialog NOTIFY alertDialogChanged)
Q_PROPERTY(QQmlComponent* confirmDialog READ confirmDialog WRITE setConfirmDialog NOTIFY confirmDialogChanged)
Q_PROPERTY(QQmlComponent* promptDialog READ promptDialog WRITE setPromptDialog NOTIFY promptDialogChanged)
@@ -260,11 +265,11 @@
Q_PROPERTY(QQmlComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
Q_PROPERTY(QQmlComponent* filePicker READ filePicker WRITE setFilePicker NOTIFY filePickerChanged)
Q_PROPERTY(QQmlComponent* databaseQuotaDialog READ databaseQuotaDialog WRITE setDatabaseQuotaDialog NOTIFY databaseQuotaDialogChanged)
+
Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
Q_PROPERTY(QWebKitTest* test READ test CONSTANT FINAL)
Q_PROPERTY(QQmlListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged)
- Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
Q_PROPERTY(QList<QUrl> userScripts READ userScripts WRITE setUserScripts NOTIFY userScriptsChanged)
Q_ENUMS(NavigationRequestActionExperimental)
@@ -296,6 +301,10 @@
void setDatabaseQuotaDialog(QQmlComponent*);
QString userAgent() const;
void setUserAgent(const QString& userAgent);
+ int deviceWidth() const;
+ void setDeviceWidth(int);
+ int deviceHeight() const;
+ void setDeviceHeight(int);
double devicePixelRatio() const;
void setDevicePixelRatio(double);
QList<QUrl> userScripts() const;
@@ -350,6 +359,8 @@
void messageReceived(const QVariantMap& message);
void proxyAuthenticationDialogChanged();
void userAgentChanged();
+ void deviceWidthChanged();
+ void deviceHeightChanged();
void devicePixelRatioChanged();
void enterFullScreenRequested();
void exitFullScreenRequested();
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp (119974 => 119975)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp 2012-06-11 13:53:11 UTC (rev 119975)
@@ -722,11 +722,6 @@
if (viewportSize.isEmpty())
return;
- // FIXME: This is wrong, add QML api!
- WebPreferences* wkPrefs = m_webPageProxy->pageGroup()->preferences();
- wkPrefs->setDeviceWidth(viewportSize.width());
- wkPrefs->setDeviceHeight(viewportSize.height());
-
// Let the WebProcess know about the new viewport size, so that
// it can resize the content accordingly.
m_webPageProxy->setViewportSize(viewportSize);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (119974 => 119975)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-06-11 13:20:47 UTC (rev 119974)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-06-11 13:53:11 UTC (rev 119975)
@@ -898,8 +898,12 @@
int minimumLayoutFallbackWidth = std::max(settings->layoutFallbackWidth(), m_viewportSize.width());
- ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, settings->deviceWidth(), settings->deviceHeight(), static_cast<int>(160 * settings->devicePixelRatio()), m_viewportSize);
+ // If unset we use the viewport dimensions. This fits with the behavior of desktop browsers.
+ int deviceWidth = (settings->deviceWidth() > 0) ? settings->deviceWidth() : m_viewportSize.width();
+ int deviceHeight = (settings->deviceHeight() > 0) ? settings->deviceHeight() : m_viewportSize.height();
+ ViewportAttributes attr = computeViewportAttributes(m_page->viewportArguments(), minimumLayoutFallbackWidth, deviceWidth, deviceHeight, static_cast<int>(160 * settings->devicePixelRatio()), m_viewportSize);
+
setResizesToContentsUsingLayoutSize(IntSize(static_cast<int>(attr.layoutSize.width()), static_cast<int>(attr.layoutSize.height())));
send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
}