Changeset 99195 in webkit


Ignore:
Timestamp:
Nov 3, 2011 8:22:16 AM (12 years ago)
Author:
fsamuel@chromium.org
Message:

Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
https://bugs.webkit.org/show_bug.cgi?id=70609

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Operations in computeViewportAttributes that are not a part of the spec:

http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/#constraining-viewport-property-values

were moved into the functions restrictMinimumScaleFactorToViewportSize and
restrictScaleFactorToInitialScaleIfNotUserScalable.

  • WebCore.exp.in:
  • dom/ViewportArguments.cpp:

(WebCore::computeViewportAttributes):
(WebCore::restrictMinimumScaleFactorToViewportSize):
(WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable):

  • dom/ViewportArguments.h:

Source/WebKit/efl:

  • ewk/ewk_view.cpp:

(_ewk_view_viewport_attributes_compute):

Source/WebKit/gtk:

  • WebCoreSupport/DumpRenderTreeSupportGtk.cpp:

(DumpRenderTreeSupportGtk::dumpConfigurationForViewport):

  • webkit/webkitviewportattributes.cpp:

(webkitViewportAttributesRecompute):

Source/WebKit/qt:

  • Api/qwebpage.cpp:

(QWebPage::viewportAttributesForSize):

  • WebCoreSupport/DumpRenderTreeSupportQt.cpp:

(DumpRenderTreeSupportQt::viewportAsText):

Source/WebKit2:

  • UIProcess/API/qt/qtouchwebview.cpp:

(QTouchWebViewPrivate::updateViewportConstraints):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::viewportConfigurationAsText):

Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r99190 r99195  
     12011-11-03  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=70609
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Operations in computeViewportAttributes that are not a part of the spec:
     9
     10        http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/#constraining-viewport-property-values
     11
     12        were moved into the functions restrictMinimumScaleFactorToViewportSize and
     13        restrictScaleFactorToInitialScaleIfNotUserScalable.
     14
     15        * WebCore.exp.in:
     16        * dom/ViewportArguments.cpp:
     17        (WebCore::computeViewportAttributes):
     18        (WebCore::restrictMinimumScaleFactorToViewportSize):
     19        (WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable):
     20        * dom/ViewportArguments.h:
     21
    1222011-11-03  Andreas Kling  <kling@webkit.org>
    223
  • trunk/Source/WebCore/WebCore.exp.in

    r99126 r99195  
    653653__ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E
    654654__ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiiiNS_7IntSizeE
     655__ZN7WebCore50restrictScaleFactorToInitialScaleIfNotUserScalableERNS_18ViewportAttributesE
     656__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
    655657__ZN7WebCore25contextMenuItemTagOutlineEv
    656658__ZN7WebCore26CSSMutableStyleDeclarationC1Ev
  • trunk/Source/WebCore/dom/ViewportArguments.cpp

    r99175 r99195  
    181181    result.layoutSize.setHeight(static_cast<int>(roundf(height)));
    182182
    183     // Update minimum scale factor, to never allow zooming out more than viewport
    184     result.minimumScale = max<float>(result.minimumScale, max(availableWidth / width, availableHeight / height));
    185 
    186183    result.userScalable = args.userScalable;
    187     // Make maximum and minimum scale equal to the initial scale if user is not allowed to zoom in/out.
    188     if (!args.userScalable)
     184
     185    return result;
     186}
     187
     188void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport)
     189{
     190    float availableWidth = visibleViewport.width();
     191    float availableHeight = visibleViewport.height();
     192
     193    if (result.devicePixelRatio != 1.0) {
     194        availableWidth /= result.devicePixelRatio;
     195        availableHeight /= result.devicePixelRatio;
     196    }
     197
     198    result.minimumScale = max<float>(result.minimumScale, max(availableWidth / result.layoutSize.width(), availableHeight / result.layoutSize.height()));
     199}
     200
     201void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result)
     202{
     203    if (!result.userScalable)
    189204        result.maximumScale = result.minimumScale = result.initialScale;
    190 
    191     return result;
    192205}
    193206
  • trunk/Source/WebCore/dom/ViewportArguments.h

    r99173 r99195  
    108108
    109109ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktopWidth, int deviceWidth, int deviceHeight, int deviceDPI, IntSize visibleViewport);
     110void restrictMinimumScaleFactorToViewportSize(ViewportAttributes& result, IntSize visibleViewport);
     111void restrictScaleFactorToInitialScaleIfNotUserScalable(ViewportAttributes& result);
    110112
    111113void setViewportFeature(const String& keyString, const String& valueString, Document*, void* data);
  • trunk/Source/WebKit/efl/ChangeLog

    r99155 r99195  
     12011-11-03  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=70609
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * ewk/ewk_view.cpp:
     9        (_ewk_view_viewport_attributes_compute):
     10
    1112011-11-03  Dongwoo Im  <dw.im@samsung.com>
    212
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r99155 r99195  
    10891089
    10901090    WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI, availableRect.size());
     1091    WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size());
     1092    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
    10911093
    10921094    return attributes;
  • trunk/Source/WebKit/gtk/ChangeLog

    r99108 r99195  
     12011-11-03  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=70609
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
     9        (DumpRenderTreeSupportGtk::dumpConfigurationForViewport):
     10        * webkit/webkitviewportattributes.cpp:
     11        (webkitViewportAttributesRecompute):
     12
    1132011-11-02  Jon Lee  <jonlee@apple.com>
    214
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

    r97746 r99195  
    712712    ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
    713713    ViewportAttributes attrs = computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight));
    714 
     714    restrictMinimumScaleFactorToViewportSize(attrs, IntSize(availableWidth, availableHeight));
     715    restrictScaleFactorToInitialScaleIfNotUserScalable(attrs);
    715716    fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable);
    716717}
  • trunk/Source/WebKit/gtk/webkit/webkitviewportattributes.cpp

    r95901 r99195  
    536536
    537537    ViewportAttributes attributes = computeViewportAttributes(arguments, priv->desktopWidth, priv->deviceWidth, priv->deviceHeight, priv->deviceDPI, IntSize(priv->availableWidth, priv->availableHeight));
     538    restrictMinimumScaleFactorToViewportSize(attributes, IntSize(priv->availableWidth, priv->availableHeight));
     539    restrictScaleFactorToInitialScaleIfNotUserScalable(attributes);
    538540
    539541    priv->width = attributes.layoutSize.width();
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r99108 r99195  
    25592559
    25602560    WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, qt_defaultDpi(), availableSize);
     2561    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
     2562    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
    25612563
    25622564    result.m_isValid = true;
  • trunk/Source/WebKit/qt/ChangeLog

    r99178 r99195  
     12011-11-03  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=70609
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * Api/qwebpage.cpp:
     9        (QWebPage::viewportAttributesForSize):
     10        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     11        (DumpRenderTreeSupportQt::viewportAsText):
     12
    1132011-11-03  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
    214
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r98975 r99195  
    766766        /* device-dpi    */ deviceDPI,
    767767        availableSize);
     768    WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
     769    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
    768770
    769771    QString res;
  • trunk/Source/WebKit2/ChangeLog

    r99194 r99195  
     12011-11-03  Fady Samuel  <fsamuel@chromium.org>
     2
     3        Removing line in computeViewportAttributes that enforces a minimum scale factor to never allow zooming out more than viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=70609
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        * UIProcess/API/qt/qtouchwebview.cpp:
     9        (QTouchWebViewPrivate::updateViewportConstraints):
     10        * WebProcess/WebPage/WebPage.cpp:
     11        (WebKit::WebPage::viewportConfigurationAsText):
     12
    1132011-11-03  Andras Becsi  <andras.becsi@nokia.com>
    214
  • trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp

    r99192 r99195  
    9393
    9494    WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(viewportArguments, wkPrefs->layoutFallbackWidth(), wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize);
     95    WebCore::restrictMinimumScaleFactorToViewport(attr, availableSize);
     96    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr);
    9597
    9698    QtViewportInteractionEngine::Constraints newConstraints;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r99121 r99195  
    26192619    ViewportArguments arguments = mainFrame()->document()->viewportArguments();
    26202620    ViewportAttributes attrs = WebCore::computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight));
     2621    WebCore::restrictMinimumScaleFactorToViewportSize(attrs, IntSize(availableWidth, availableHeight));
     2622    WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attrs);
    26212623    return String::format("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable);
    26222624}
Note: See TracChangeset for help on using the changeset viewer.