Title: [132193] trunk
Revision
132193
Author
abe...@webkit.org
Date
2012-10-23 02:15:12 -0700 (Tue, 23 Oct 2012)

Log Message

Remove devicePixelRatio from ViewportAttributes
https://bugs.webkit.org/show_bug.cgi?id=99845

Reviewed by Adam Barth.

.:

* Source/autotools/symbols.filter: Update symbol.

Source/WebCore:

Since r121555 the devicePixelRatio is not calculated any more
and the scale factor is stored in Page::m_deviceScaleFactor,
thus it can be removed from ViewportAttributes to reduce
redundancy and unnecessary client code.
Use a new parameter in viewport calculation functions using
the visible viewport size (instead of passing the adjusted
viewport size) so that after this change clients do not end
up using the unadjusted viewport size for calculations.

No behavioural change, no new tests needed.

* WebCore.exp.in:
* dom/ViewportArguments.cpp:
(WebCore::computeViewportAttributes):
(WebCore::computeMinimumScaleFactorForContentContained):
Add the devicePixelRatio as a parameter.
(WebCore::restrictMinimumScaleFactorToViewportSize): Ditto.
* dom/ViewportArguments.h:
(ViewportAttributes):
(WebCore):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::configurationForViewport):

Source/WebKit/efl:

* ewk/ewk_view.cpp:
(_ewk_view_viewport_attributes_compute):
Pass the device pixel ratio as a function argument.

Source/WebKit/gtk:

* webkit/webkitviewportattributes.cpp:
(webkitViewportAttributesRecompute):
Pass the device pixel ratio as a function argument.

Source/WebKit/qt:

Pass the device pixel ratio as a function argument to
match the new API.

* Api/qwebpage.cpp:
(QWebPage::viewportAttributesForSize):
* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::viewportAsText):

Source/WebKit2:

Update PageViewportController and co. to pass the device pixel ratio
as an argument to functions that need to adjust the visible viewport size.

* UIProcess/PageViewportController.cpp:
(WebKit::PageViewportController::PageViewportController):
(WebKit::PageViewportController::updateMinimumScaleToFit):
* UIProcess/qt/PageViewportControllerClientQt.cpp:
(WebKit::PageViewportControllerClientQt::didChangeViewportAttributes):

Modified Paths

Diff

Modified: trunk/ChangeLog (132192 => 132193)


--- trunk/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,12 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        * Source/autotools/symbols.filter: Update symbol.
+
 2012-10-22  Pavel Feldman  <pfeld...@chromium.org>
 
         Web Inspector: merge "docked" state into the "dock side" enum.

Modified: trunk/Source/WebCore/ChangeLog (132192 => 132193)


--- trunk/Source/WebCore/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebCore/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,33 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        Since r121555 the devicePixelRatio is not calculated any more
+        and the scale factor is stored in Page::m_deviceScaleFactor,
+        thus it can be removed from ViewportAttributes to reduce
+        redundancy and unnecessary client code.
+        Use a new parameter in viewport calculation functions using
+        the visible viewport size (instead of passing the adjusted
+        viewport size) so that after this change clients do not end
+        up using the unadjusted viewport size for calculations.
+
+        No behavioural change, no new tests needed.
+
+        * WebCore.exp.in:
+        * dom/ViewportArguments.cpp:
+        (WebCore::computeViewportAttributes):
+        (WebCore::computeMinimumScaleFactorForContentContained):
+        Add the devicePixelRatio as a parameter.
+        (WebCore::restrictMinimumScaleFactorToViewportSize): Ditto.
+        * dom/ViewportArguments.h:
+        (ViewportAttributes):
+        (WebCore):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::configurationForViewport):
+
 2012-10-23  Kent Tamura  <tk...@chromium.org>
 
         Support full month names in DateTimeEditElement, and use them in input[type=month] by default

Modified: trunk/Source/WebCore/WebCore.exp.in (132192 => 132193)


--- trunk/Source/WebCore/WebCore.exp.in	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-10-23 09:15:12 UTC (rev 132193)
@@ -656,7 +656,7 @@
 __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
 __ZN7WebCore3macERKNS_10CredentialE
 __ZN7WebCore3macERKNS_23AuthenticationChallengeE
-__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
+__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf
 __ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURLl
 __ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
 __ZN7WebCore4Font11setCodePathENS0_8CodePathE

Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (132192 => 132193)


--- trunk/Source/WebCore/dom/ViewportArguments.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -52,14 +52,12 @@
 
     ASSERT(availableWidth > 0 && availableHeight > 0);
 
-    result.devicePixelRatio = devicePixelRatio;
-
     // Resolve non-'auto' width and height to pixel values.
-    if (result.devicePixelRatio != 1.0) {
-        availableWidth /= result.devicePixelRatio;
-        availableHeight /= result.devicePixelRatio;
-        deviceWidth /= result.devicePixelRatio;
-        deviceHeight /= result.devicePixelRatio;
+    if (devicePixelRatio != 1.0) {
+        availableWidth /= devicePixelRatio;
+        availableHeight /= devicePixelRatio;
+        deviceWidth /= devicePixelRatio;
+        deviceHeight /= devicePixelRatio;
     }
 
     switch (int(args.width)) {
@@ -158,27 +156,27 @@
     return result;
 }
 
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentsSize)
+float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentsSize, float devicePixelRatio)
 {
     float availableWidth = viewportSize.width();
     float availableHeight = viewportSize.height();
 
-    if (result.devicePixelRatio != 1.0) {
-        availableWidth /= result.devicePixelRatio;
-        availableHeight /= result.devicePixelRatio;
+    if (devicePixelRatio != 1.0) {
+        availableWidth /= devicePixelRatio;
+        availableHeight /= devicePixelRatio;
     }
 
     return max<float>(result.minimumScale, max(availableWidth / contentsSize.width(), availableHeight / contentsSize.height()));
 }
 
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport)
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio)
 {
     float availableWidth = visibleViewport.width();
     float availableHeight = visibleViewport.height();
 
-    if (result.devicePixelRatio != 1.0) {
-        availableWidth /= result.devicePixelRatio;
-        availableHeight /= result.devicePixelRatio;
+    if (devicePixelRatio != 1.0) {
+        availableWidth /= devicePixelRatio;
+        availableHeight /= devicePixelRatio;
     }
 
     result.minimumScale = max<float>(result.minimumScale, max(availableWidth / result.layoutSize.width(), availableHeight / result.layoutSize.height()));

Modified: trunk/Source/WebCore/dom/ViewportArguments.h (132192 => 132193)


--- trunk/Source/WebCore/dom/ViewportArguments.h	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebCore/dom/ViewportArguments.h	2012-10-23 09:15:12 UTC (rev 132193)
@@ -45,8 +45,6 @@
 struct ViewportAttributes {
     FloatSize layoutSize;
 
-    float devicePixelRatio;
-
     float initialScale;
     float minimumScale;
     float maximumScale;
@@ -116,9 +114,9 @@
 
 ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, float devicePixelRatio, IntSize visibleViewport);
 
-void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport);
+void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport, float devicePixelRatio);
 void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
-float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize);
+float computeMinimumScaleFactorForContentContained(const ViewportAttributes& result, const IntSize& viewportSize, const IntSize& contentSize, float devicePixelRatio);
 
 void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
 void reportViewportWarning(Document*, ViewportErrorCode, const String& replacement1, const String& replacement2);

Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (132192 => 132193)


--- trunk/Source/WebCore/testing/InternalSettings.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -645,7 +645,7 @@
 
     ViewportArguments arguments = page()->viewportArguments();
     ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight));
-    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight));
+    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight), devicePixelRatio);
     restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
 
     return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false");

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (132192 => 132193)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -3445,16 +3445,17 @@
     int desktopWidth = DEFAULT_MAX_LAYOUT_WIDTH;
     int deviceWidth = Platform::Graphics::Screen::primaryScreen()->width();
     int deviceHeight = Platform::Graphics::Screen::primaryScreen()->height();
-    ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, m_webSettings->devicePixelRatio(), m_defaultLayoutSize);
-    m_page->setDeviceScaleFactor(result.devicePixelRatio);
+    float devicePixelRatio = m_webSettings->devicePixelRatio();
+    ViewportAttributes result = computeViewportAttributes(m_viewportArguments, desktopWidth, deviceWidth, deviceHeight, devicePixelRatio, m_defaultLayoutSize);
+    m_page->setDeviceScaleFactor(devicePixelRatio);
 
     setUserScalable(m_webSettings->isUserScalable() && result.userScalable);
     if (result.initialScale > 0)
-        setInitialScale(result.initialScale * result.devicePixelRatio);
+        setInitialScale(result.initialScale * devicePixelRatio);
     if (result.minimumScale > 0)
-        setMinimumScale(result.minimumScale * result.devicePixelRatio);
+        setMinimumScale(result.minimumScale * devicePixelRatio);
     if (result.maximumScale > 0)
-        setMaximumScale(result.maximumScale * result.devicePixelRatio);
+        setMaximumScale(result.maximumScale * devicePixelRatio);
 
     return IntSize(result.layoutSize.width(), result.layoutSize.height());
 }

Modified: trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp (132192 => 132193)


--- trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -647,10 +647,11 @@
         return;
 
     Settings* settings = m_webView->page()->settings();
+    float devicePixelRatio = dpi / ViewportArguments::deprecatedTargetDPI;
     // Call the common viewport computing logic in ViewportArguments.cpp.
     ViewportAttributes computed = computeViewportAttributes(
         args, settings->layoutFallbackWidth(), deviceRect.width, deviceRect.height,
-        dpi / ViewportArguments::deprecatedTargetDPI, IntSize(deviceRect.width, deviceRect.height));
+        devicePixelRatio, IntSize(deviceRect.width, deviceRect.height));
 
     restrictScaleFactorToInitialScaleIfNotUserScalable(computed);
 
@@ -664,10 +665,10 @@
     m_webView->setFixedLayoutSize(IntSize(layoutWidth, layoutHeight));
 
     bool needInitializePageScale = !m_webView->isPageScaleFactorSet();
-    m_webView->setDeviceScaleFactor(computed.devicePixelRatio);
+    m_webView->setDeviceScaleFactor(devicePixelRatio);
     m_webView->setPageScaleFactorLimits(computed.minimumScale, computed.maximumScale);
     if (needInitializePageScale)
-        m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * computed.devicePixelRatio);
+        m_webView->setPageScaleFactorPreservingScrollOffset(computed.initialScale * devicePixelRatio);
 #endif
 }
 

Modified: trunk/Source/WebKit/efl/ChangeLog (132192 => 132193)


--- trunk/Source/WebKit/efl/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,14 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        * ewk/ewk_view.cpp:
+        (_ewk_view_viewport_attributes_compute):
+        Pass the device pixel ratio as a function argument.
+
 2012-10-22  Ryuan Choi  <ryuan.c...@gmail.com>
 
         [EFL] pc files should use DATA_INSTALL_DIR for datadir

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (132192 => 132193)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1271,16 +1271,17 @@
                                        (_ewk_view_zoom_animator_cb, smartData);
 }
 
-static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(const Ewk_View_Private_Data* priv)
+static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(Ewk_View_Private_Data* priv)
 {
     int desktopWidth = 980;
     int deviceDPI = WebCore::getDPI();
+    priv->settings.devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
 
     WebCore::IntRect availableRect = enclosingIntRect(priv->page->chrome()->client()->pageRect());
     WebCore::IntRect deviceRect = enclosingIntRect(priv->page->chrome()->client()->windowRect());
 
-    WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI, availableRect.size());
-    WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size());
+    WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), priv->settings.devicePixelRatio, availableRect.size());
+    WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size(), priv->settings.devicePixelRatio);
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
 
     return attributes;
@@ -3977,7 +3978,7 @@
     if (minScale)
         *minScale = attributes.minimumScale;
     if (devicePixelRatio)
-        *devicePixelRatio = attributes.devicePixelRatio;
+        *devicePixelRatio = priv->settings.devicePixelRatio;
     if (userScalable)
         *userScalable = static_cast<bool>(attributes.userScalable);
 }

Modified: trunk/Source/WebKit/gtk/ChangeLog (132192 => 132193)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,14 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        * webkit/webkitviewportattributes.cpp:
+        (webkitViewportAttributesRecompute):
+        Pass the device pixel ratio as a function argument.
+
 2012-10-22  Jocelyn Turcotte  <jocelyn.turco...@digia.com>
 
         [Qt] Fix "ASSERTION FAILED: !document->inPageCache()" when loading a page

Modified: trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp (132192 => 132193)


--- trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -534,8 +534,9 @@
 
     ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
 
-    ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, priv->deviceDPI / ViewportArguments::deprecatedTargetDPI, IntSize(priv->availableWidth, priv->availableHeight));
-    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight));
+    float devicePixelRatio = priv->deviceDPI / ViewportArguments::deprecatedTargetDPI;
+    ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, devicePixelRatio, IntSize(priv->availableWidth, priv->availableHeight));
+    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight), devicePixelRatio);
     restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
 
     priv->width = attributes.layoutSize.width();
@@ -543,7 +544,7 @@
     priv->initialScaleFactor = attributes.initialScale;
     priv->minimumScaleFactor = attributes.minimumScale;
     priv->maximumScaleFactor = attributes.maximumScale;
-    priv->devicePixelRatio = attributes.devicePixelRatio;
+    priv->devicePixelRatio = devicePixelRatio;
     priv->userScalable = static_cast<bool>(arguments.userScalable);
 
     if (!priv->isValid) {

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (132192 => 132193)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -2581,8 +2581,10 @@
         deviceHeight = size.height();
     }
 
-    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI, availableSize);
-    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+    float devicePixelRatio = qt_defaultDpi() / WebCore::ViewportArguments::deprecatedTargetDPI;
+
+    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, devicePixelRatio, availableSize);
+    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     result.m_isValid = true;
@@ -2590,10 +2592,10 @@
     result.m_initialScaleFactor = conf.initialScale;
     result.m_minimumScaleFactor = conf.minimumScale;
     result.m_maximumScaleFactor = conf.maximumScale;
-    result.m_devicePixelRatio = conf.devicePixelRatio;
+    result.m_devicePixelRatio = devicePixelRatio;
     result.m_isUserScalable = static_cast<bool>(conf.userScalable);
 
-    d->page->setDeviceScaleFactor(conf.devicePixelRatio);
+    d->page->setDeviceScaleFactor(devicePixelRatio);
 
     return result;
 }

Modified: trunk/Source/WebKit/qt/ChangeLog (132192 => 132193)


--- trunk/Source/WebKit/qt/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,18 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        Pass the device pixel ratio as a function argument to
+        match the new API.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::viewportAttributesForSize):
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::viewportAsText):
+
 2012-10-23  Simon Hausmann  <simon.hausm...@digia.com>
 
         Unreviewed build fix with newer Qt 5.

Modified: trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp (132192 => 132193)


--- trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -689,13 +689,14 @@
 {
     WebCore::ViewportArguments args = page->d->viewportArguments();
 
+    float devicePixelRatio = deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI;
     WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
         /* desktop-width    */ 980,
         /* device-width     */ deviceSize.width(),
         /* device-height    */ deviceSize.height(),
-        /* devicePixelRatio */ deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI,
+        devicePixelRatio,
         availableSize);
-    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize, devicePixelRatio);
     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
 
     QString res;

Modified: trunk/Source/WebKit2/ChangeLog (132192 => 132193)


--- trunk/Source/WebKit2/ChangeLog	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-23 09:15:12 UTC (rev 132193)
@@ -1,3 +1,19 @@
+2012-10-23  Andras Becsi  <andras.be...@digia.com>
+
+        Remove devicePixelRatio from ViewportAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=99845
+
+        Reviewed by Adam Barth.
+
+        Update PageViewportController and co. to pass the device pixel ratio
+        as an argument to functions that need to adjust the visible viewport size.
+
+        * UIProcess/PageViewportController.cpp:
+        (WebKit::PageViewportController::PageViewportController):
+        (WebKit::PageViewportController::updateMinimumScaleToFit):
+        * UIProcess/qt/PageViewportControllerClientQt.cpp:
+        (WebKit::PageViewportControllerClientQt::didChangeViewportAttributes):
+
 2012-10-23  Mikhail Pozdnyakov  <mikhail.pozdnya...@intel.com>
 
         [EFL][WK2] Refactor Ewk_Context

Modified: trunk/Source/WebKit2/UIProcess/PageViewportController.cpp (132192 => 132193)


--- trunk/Source/WebKit2/UIProcess/PageViewportController.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit2/UIProcess/PageViewportController.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -68,7 +68,6 @@
 {
     // Initializing Viewport Raw Attributes to avoid random negative or infinity scale factors
     // if there is a race condition between the first layout and setting the viewport attributes for the first time.
-    m_rawAttributes.devicePixelRatio = 1;
     m_rawAttributes.initialScale = 1;
     m_rawAttributes.minimumScale = 1;
     m_rawAttributes.maximumScale = 1;
@@ -277,7 +276,7 @@
     if (m_viewportSize.isEmpty())
         return;
 
-    float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize));
+    float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, WebCore::roundedIntSize(m_viewportSize), WebCore::roundedIntSize(m_contentsSize), devicePixelRatio());
 
     if (!fuzzyCompare(minimumScale, m_minimumScaleToFit, 0.001)) {
         m_minimumScaleToFit = minimumScale;

Modified: trunk/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp (132192 => 132193)


--- trunk/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit2/UIProcess/qt/PageViewportControllerClientQt.cpp	2012-10-23 09:15:12 UTC (rev 132193)
@@ -493,7 +493,6 @@
 
 void PageViewportControllerClientQt::didChangeViewportAttributes()
 {
-    emit m_viewportItem->experimental()->test()->devicePixelRatioChanged();
     emit m_viewportItem->experimental()->test()->viewportChanged();
 }
 

Modified: trunk/Source/WebKit2/win/WebKit2.def (132192 => 132193)


--- trunk/Source/WebKit2/win/WebKit2.def	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit2/win/WebKit2.def	2012-10-23 09:15:12 UTC (rev 132193)
@@ -274,7 +274,7 @@
         ?webkitWillExitFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z
         ?webkitDidExitFullScreenForElement@Document@WebCore@@QAEXPAVElement@2@@Z
         ?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z
-        ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@@Z
+        ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@M@Z
         ?computeViewportAttributes@WebCore@@YA?AUViewportAttributes@1@UViewportArguments@1@HHHMVIntSize@1@@Z
         ?viewportArguments@Page@WebCore@@QBE?AUViewportArguments@2@XZ
         ?isPageBoxVisible@Document@WebCore@@QAE_NH@Z

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (132192 => 132193)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-10-23 09:15:12 UTC (rev 132193)
@@ -263,7 +263,7 @@
         ?nodesFromRect@Document@WebCore@@QBE?AV?$PassRefPtr@VNodeList@WebCore@@@WTF@@HHIIII_N0@Z
         ?selectionStartHasMarkerFor@Editor@WebCore@@QBE_NW4MarkerType@DocumentMarker@2@HH@Z
         ?restrictScaleFactorToInitialScaleIfNotUserScalable@WebCore@@YAXAAUViewportAttributes@1@@Z
-        ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@@Z
+        ?restrictMinimumScaleFactorToViewportSize@WebCore@@YAXAAUViewportAttributes@1@VIntSize@1@M@Z
         ?computeViewportAttributes@WebCore@@YA?AUViewportAttributes@1@UViewportArguments@1@HHHMVIntSize@1@@Z
         ?viewportArguments@Page@WebCore@@QBE?AUViewportArguments@2@XZ
         ?isPageBoxVisible@Document@WebCore@@QAE_NH@Z

Modified: trunk/Source/autotools/symbols.filter (132192 => 132193)


--- trunk/Source/autotools/symbols.filter	2012-10-23 08:40:53 UTC (rev 132192)
+++ trunk/Source/autotools/symbols.filter	2012-10-23 09:15:12 UTC (rev 132193)
@@ -107,7 +107,7 @@
 _ZN7WebCore28InspectorFrontendClientLocalD2Ev;
 _ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELj0EEE;
 _ZN7WebCore30overrideUserPreferredLanguagesERKN3WTF6VectorINS0_6StringELm0EEE;
-_ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE;
+_ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_13DOMStringListE;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_9DOMWindowE;
 _ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to