Changeset 135728 in webkit


Ignore:
Timestamp:
Nov 26, 2012 8:22:31 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Viewport CSS rules should not clamp values like Viewport META
https://bugs.webkit.org/show_bug.cgi?id=103068

Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-11-26
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

CSS Device Adaption does not clamp the length and zoom values the
same way as the Viewport META. In fact, they are not clamped at all,
but instead, we just make sure that length values are at least 1px.

Tests: css3/device-adapt/opera/constrain-018.xhtml

css3/device-adapt/opera/constrain-019.xhtml
css3/device-adapt/opera/constrain-023.xhtml
css3/device-adapt/opera/constrain-024.xhtml

  • dom/ViewportArguments.cpp:

(WebCore::ViewportArguments::resolve):

LayoutTests:

Imported Opera tests that makes sure we are doing the clamping right.

  • css3/device-adapt/opera/constrain-018-expected.txt: Added.
  • css3/device-adapt/opera/constrain-018.xhtml: Added.
  • css3/device-adapt/opera/constrain-019-expected.txt: Added.
  • css3/device-adapt/opera/constrain-019.xhtml: Added.
  • css3/device-adapt/opera/constrain-023-expected.txt: Added.
  • css3/device-adapt/opera/constrain-023.xhtml: Added.
  • css3/device-adapt/opera/constrain-024-expected.txt: Added.
  • css3/device-adapt/opera/constrain-024.xhtml: Added.
Location:
trunk
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r135727 r135728  
     12012-11-26  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Viewport CSS rules should not clamp values like Viewport META
     4        https://bugs.webkit.org/show_bug.cgi?id=103068
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Imported Opera tests that makes sure we are doing the clamping right.
     9
     10        * css3/device-adapt/opera/constrain-018-expected.txt: Added.
     11        * css3/device-adapt/opera/constrain-018.xhtml: Added.
     12        * css3/device-adapt/opera/constrain-019-expected.txt: Added.
     13        * css3/device-adapt/opera/constrain-019.xhtml: Added.
     14        * css3/device-adapt/opera/constrain-023-expected.txt: Added.
     15        * css3/device-adapt/opera/constrain-023.xhtml: Added.
     16        * css3/device-adapt/opera/constrain-024-expected.txt: Added.
     17        * css3/device-adapt/opera/constrain-024.xhtml: Added.
     18
    1192012-11-26  Robert Kroeger  <rjkroege@chromium.org>
    220
  • trunk/Source/WebCore/ChangeLog

    r135723 r135728  
     12012-11-26  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        Viewport CSS rules should not clamp values like Viewport META
     4        https://bugs.webkit.org/show_bug.cgi?id=103068
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        CSS Device Adaption does not clamp the length and zoom values the
     9        same way as the Viewport META. In fact, they are not clamped at all,
     10        but instead, we just make sure that length values are at least 1px.
     11
     12        Tests: css3/device-adapt/opera/constrain-018.xhtml
     13               css3/device-adapt/opera/constrain-019.xhtml
     14               css3/device-adapt/opera/constrain-023.xhtml
     15               css3/device-adapt/opera/constrain-024.xhtml
     16
     17        * dom/ViewportArguments.cpp:
     18        (WebCore::ViewportArguments::resolve):
     19
    1202012-11-26  Mike West  <mkwst@chromium.org>
    221
  • trunk/Source/WebCore/dom/ViewportArguments.cpp

    r135163 r135728  
    176176            resultHeight = compareIgnoringAuto(resultHeight, deviceSize.height() / compareIgnoringAuto(resultZoom, resultMaxZoom, min), max);
    177177        }
    178     }
    179 
    180     // Clamp values to valid range.
    181     resultWidth = clampLengthValue(resultWidth);
    182     resultHeight = clampLengthValue(resultHeight);
    183     resultZoom = clampScaleValue(resultZoom);
    184     resultMinZoom = clampScaleValue(resultMinZoom);
    185     resultMaxZoom = clampScaleValue(resultMaxZoom);
     178
     179        resultWidth = max<float>(1, resultWidth);
     180        resultHeight = max<float>(1, resultHeight);
     181    }
     182
     183    if (type != ViewportArguments::CSSDeviceAdaptation && type != ViewportArguments::Implicit) {
     184        // Clamp values to a valid range, but not for @viewport since is
     185        // not mandated by the specification.
     186        resultWidth = clampLengthValue(resultWidth);
     187        resultHeight = clampLengthValue(resultHeight);
     188        resultZoom = clampScaleValue(resultZoom);
     189        resultMinZoom = clampScaleValue(resultMinZoom);
     190        resultMaxZoom = clampScaleValue(resultMaxZoom);
     191    }
    186192
    187193    ViewportAttributes result;
     
    230236        resultHeight = resultWidth * (initialViewportSize.height() / initialViewportSize.width());
    231237
    232     // Extend width and height to fill the visual viewport for the resolved initial-scale.
    233     resultWidth = max<float>(resultWidth, initialViewportSize.width() / result.initialScale);
    234     resultHeight = max<float>(resultHeight, initialViewportSize.height() / result.initialScale);
     238    if (type == ViewportArguments::ViewportMeta) {
     239        // Extend width and height to fill the visual viewport for the resolved initial-scale.
     240        resultWidth = max<float>(resultWidth, initialViewportSize.width() / result.initialScale);
     241        resultHeight = max<float>(resultHeight, initialViewportSize.height() / result.initialScale);
     242    }
     243
    235244    result.layoutSize.setWidth(resultWidth);
    236245    result.layoutSize.setHeight(resultHeight);
Note: See TracChangeset for help on using the changeset viewer.