Changeset 142021 in webkit


Ignore:
Timestamp:
Feb 6, 2013 12:58:04 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Implement 'vmax' from CSS3 values and units
https://bugs.webkit.org/show_bug.cgi?id=91440

Patch by Uday Kiran <udaykiran@motorola.com> on 2013-02-06
Reviewed by Antti Koivisto.

vmax is implemented as primitive length unit.
New length type ViewportPercentageMax is added and included support for fetching the value
of this viewport percentage unit based on current viewport size.

The specification related to this implementation is
http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.

Source/WebCore:

Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute.html

css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax.html

  • css/CSSGrammar.y.in: Added vmax support.
  • css/CSSParser.cpp: Parsing of vmax unit.

(WebCore::CSSParser::validUnit): Added vmax to valid units.
(WebCore::CSSParser::createPrimitiveNumericValue): Added vmax to primitive untis.
(WebCore::CSSParser::parseValidPrimitive): Creation of CSSPrimitive for vmax.
(WebCore::CSSParser::detectNumberToken): Parsing of vmax token.

  • css/CSSParserValues.cpp:

(WebCore::CSSParserValue::createCSSValue): Added support for vmax.

  • css/CSSPrimitiveValue.cpp:

(WebCore::isValidCSSUnitTypeForDoubleConversion): Added support for vmax.
(WebCore::unitCategory): Ditto.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
(WebCore::CSSPrimitiveValue::cleanup):
(WebCore::CSSPrimitiveValue::customCssText): Added support for vmax.
(WebCore::CSSPrimitiveValue::viewportPercentageLength): Function to create the Length structure for the viewport-percentage unit types.
(WebCore::CSSPrimitiveValue::cloneForCSSOM):

  • css/CSSPrimitiveValue.h:

(WebCore::CSSPrimitiveValue::isViewportPercentageLength): Checks whether the primitive value is ViewportPercentage Length.

  • css/CSSPrimitiveValue.idl: Added support for vmax.
  • css/LengthFunctions.cpp: Calcuation of length value based on the current viewport size.

(WebCore::minimumValueForLength):
(WebCore::valueForLength):
(WebCore::floatValueForLength):

  • platform/Length.h:

(WebCore::Length::isViewportPercentage): To check the Length is of type ViewportPercentage.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):

LayoutTests:

  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt:
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html:
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute-expected.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-expected.html: Added.
  • css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax.html: Added.
Location:
trunk
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142020 r142021  
     12013-02-06  Uday Kiran  <udaykiran@motorola.com>
     2
     3        Implement 'vmax' from CSS3 values and units
     4        https://bugs.webkit.org/show_bug.cgi?id=91440
     5
     6        Reviewed by Antti Koivisto.
     7
     8        vmax is implemented as primitive length unit.
     9        New length type ViewportPercentageMax is added and included support for fetching the value
     10        of this viewport percentage unit based on current viewport size.
     11
     12        The specification related to this implementation is
     13        http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.
     14
     15        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt:
     16        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html:
     17        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute-expected.html: Added.
     18        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute.html: Added.
     19        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-expected.html: Added.
     20        * css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax.html: Added.
     21
    1222013-02-06  Zan Dobersek  <zdobersek@igalia.com>
    223
  • trunk/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle-expected.txt

    r112749 r142021  
    1 Test for Bug: 27160 - Implement vw/vh/vm (viewport sizes) from CSS 3 Values and Units
     1Test for Bug: 27160/91440 - Implement vw/vh/vmin/vmax (viewport sizes) from CSS 3 Values and Units
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    8484PASS style.getPropertyValue("padding-top") is '12px'
    8585PASS style.getPropertyValue("padding-bottom") is '12px'
     86
     87Test for vmax
     88PASS style.getPropertyValue("height") is '240px'
     89PASS style.getPropertyValue("width") is '240px'
     90PASS style.getPropertyValue("font-size") is '24px'
     91PASS style.getPropertyValue("line-height") is '32px'
     92PASS style.getPropertyValue("text-indent") is '2vmax'
     93PASS style.getPropertyValue("margin-left") is '16px'
     94PASS style.getPropertyValue("margin-right") is '16px'
     95PASS style.getPropertyValue("margin-top") is '16px'
     96PASS style.getPropertyValue("margin-bottom") is '16px'
     97PASS style.getPropertyValue("border-top-left-radius") is '8px'
     98PASS style.getPropertyValue("border-top-right-radius") is '8px'
     99PASS style.getPropertyValue("border-bottom-left-radius") is '8px'
     100PASS style.getPropertyValue("border-bottom-right-radius") is '8px'
     101PASS style.getPropertyValue("min-height") is '10vmax'
     102PASS style.getPropertyValue("min-width") is '10vmax'
     103PASS style.getPropertyValue("max-height") is '60vmax'
     104PASS style.getPropertyValue("max-width") is '60vmax'
     105PASS style.getPropertyValue("top") is '80px'
     106PASS style.getPropertyValue("bottom") is '80px'
     107PASS style.getPropertyValue("left") is '80px'
     108PASS style.getPropertyValue("right") is '80px'
     109PASS style.getPropertyValue("padding-left") is '16px'
     110PASS style.getPropertyValue("padding-right") is '16px'
     111PASS style.getPropertyValue("padding-top") is '16px'
     112PASS style.getPropertyValue("padding-bottom") is '16px'
    86113PASS successfullyParsed is true
    87114
  • trunk/LayoutTests/css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-getStyle.html

    r119990 r142021  
    103103   padding-bottom:2vmin;
    104104 }
     105
     106 #element-container-vmax {
     107   background:green;
     108   height:30vmax;
     109   width:30vmax;
     110   font-size:3vmax;
     111   line-height:4vmax;
     112   text-indent:2vmax;
     113   margin-left:2vmax;
     114   margin-right:2vmax;
     115   margin-top:2vmax;
     116   margin-bottom:2vmax;
     117   border-top-left-radius:1vmax;
     118   border-top-right-radius:1vmax;
     119   border-bottom-left-radius:1vmax;
     120   border-bottom-right-radius:1vmax;
     121   min-height:10vmax;
     122   min-width:10vmax;
     123   max-height:60vmax;
     124   max-width:60vmax;
     125 }
     126
     127 #element-container-absolute-vmax {
     128   background:green;
     129   position:absolute;
     130   top:10vmax;
     131   bottom:10vmax;
     132   left:10vmax;
     133   right:10vmax;
     134   padding-left:2vmax;
     135   padding-right:2vmax;
     136   padding-top:2vmax;
     137   padding-bottom:2vmax;
     138 }
    105139 
    106140</style>
     
    111145    testRunner.dumpAsText();
    112146
    113 description("Test for Bug: 27160 - Implement vw/vh/vm (viewport sizes) from CSS 3 Values and Units");
     147description("Test for Bug: 27160/91440 - Implement vw/vh/vmin/vmax (viewport sizes) from CSS 3 Values and Units");
    114148
    115149// These have to be global for the test helpers to see them.
     
    209243    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
    210244    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMinLength / 100) + "px'");
     245
     246    debug("\nTest for vmax")
     247    element.id = "element-container-vmax";
     248    style = window.getComputedStyle(element,null);
     249    var viewportMaxLength = Math.max(window.innerWidth, window.innerHeight);
     250    shouldBe('style.getPropertyValue("height")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
     251    shouldBe('style.getPropertyValue("width")', "'" + Math.floor(30 * viewportMaxLength / 100) + "px'");
     252    shouldBe('style.getPropertyValue("font-size")', "'" + Math.floor(3 * viewportMaxLength / 100) + "px'");
     253    shouldBe('style.getPropertyValue("line-height")', "'" + Math.floor(4 * viewportMaxLength / 100) + "px'");
     254    shouldBe('style.getPropertyValue("text-indent")', "'2vmax'");
     255    shouldBe('style.getPropertyValue("margin-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     256    shouldBe('style.getPropertyValue("margin-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     257    shouldBe('style.getPropertyValue("margin-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     258    shouldBe('style.getPropertyValue("margin-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     259    shouldBe('style.getPropertyValue("border-top-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
     260    shouldBe('style.getPropertyValue("border-top-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
     261    shouldBe('style.getPropertyValue("border-bottom-left-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
     262    shouldBe('style.getPropertyValue("border-bottom-right-radius")', "'" + Math.floor(1 * viewportMaxLength / 100) + "px'");
     263    shouldBe('style.getPropertyValue("min-height")', "'10vmax'");
     264    shouldBe('style.getPropertyValue("min-width")', "'10vmax'");
     265    shouldBe('style.getPropertyValue("max-height")', "'60vmax'");
     266    shouldBe('style.getPropertyValue("max-width")', "'60vmax'");
     267    element.id = "element-container-absolute-vmax";
     268    shouldBe('style.getPropertyValue("top")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
     269    shouldBe('style.getPropertyValue("bottom")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
     270    shouldBe('style.getPropertyValue("left")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
     271    shouldBe('style.getPropertyValue("right")', "'" + Math.floor(10 * viewportMaxLength / 100) + "px'");
     272    shouldBe('style.getPropertyValue("padding-left")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     273    shouldBe('style.getPropertyValue("padding-right")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     274    shouldBe('style.getPropertyValue("padding-top")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
     275    shouldBe('style.getPropertyValue("padding-bottom")', "'" + Math.floor(2 * viewportMaxLength / 100) + "px'");
    211276}
    212277getTheStyle();
  • trunk/Source/WebCore/ChangeLog

    r142015 r142021  
     12013-02-06  Uday Kiran  <udaykiran@motorola.com>
     2
     3        Implement 'vmax' from CSS3 values and units
     4        https://bugs.webkit.org/show_bug.cgi?id=91440
     5
     6        Reviewed by Antti Koivisto.
     7
     8        vmax is implemented as primitive length unit.
     9        New length type ViewportPercentageMax is added and included support for fetching the value
     10        of this viewport percentage unit based on current viewport size.
     11
     12        The specification related to this implementation is
     13        http://dev.w3.org/csswg/css3-values/#viewport-relative-lengths.
     14
     15        Tests: css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax-absolute.html
     16               css3/viewport-percentage-lengths/css3-viewport-percentage-lengths-vmax.html
     17
     18        * css/CSSGrammar.y.in: Added vmax support.
     19        * css/CSSParser.cpp: Parsing of vmax unit.
     20        (WebCore::CSSParser::validUnit): Added vmax to valid units.
     21        (WebCore::CSSParser::createPrimitiveNumericValue): Added vmax to primitive untis.
     22        (WebCore::CSSParser::parseValidPrimitive): Creation of CSSPrimitive for vmax.
     23        (WebCore::CSSParser::detectNumberToken): Parsing of vmax token.
     24        * css/CSSParserValues.cpp:
     25        (WebCore::CSSParserValue::createCSSValue): Added support for vmax.
     26        * css/CSSPrimitiveValue.cpp:
     27        (WebCore::isValidCSSUnitTypeForDoubleConversion): Added support for vmax.
     28        (WebCore::unitCategory): Ditto.
     29        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto.
     30        (WebCore::CSSPrimitiveValue::cleanup):
     31        (WebCore::CSSPrimitiveValue::customCssText): Added support for vmax.
     32        (WebCore::CSSPrimitiveValue::viewportPercentageLength): Function to create the Length structure for the viewport-percentage unit types.
     33        (WebCore::CSSPrimitiveValue::cloneForCSSOM):
     34        * css/CSSPrimitiveValue.h:
     35        (WebCore::CSSPrimitiveValue::isViewportPercentageLength): Checks whether the primitive value is ViewportPercentage Length.
     36        * css/CSSPrimitiveValue.idl: Added support for vmax.
     37        * css/LengthFunctions.cpp: Calcuation of length value based on the current viewport size.
     38        (WebCore::minimumValueForLength):
     39        (WebCore::valueForLength):
     40        (WebCore::floatValueForLength):
     41        * platform/Length.h:
     42        (WebCore::Length::isViewportPercentage): To check the Length is of type ViewportPercentage.
     43        * rendering/RenderBox.cpp:
     44        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
     45        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
     46
    1472013-02-06  Pravin D  <pravind.2k4@gmail.com>
    248
  • trunk/Source/WebCore/css/CSSGrammar.y.in

    r140997 r142021  
    6262%}
    6363
    64 %expect 65
     64%expect 66
    6565
    6666%nonassoc LOWEST_PREC
     
    170170%token <number> VH
    171171%token <number> VMIN
     172%token <number> VMAX
    172173%token <number> DPPX
    173174%token <number> DPI
     
    17121713  | VH maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VH; }
    17131714  | VMIN maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMIN; }
     1715  | VMAX maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_VMAX; }
    17141716  | DPPX maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPPX; }
    17151717  | DPI maybe_space { $$.id = 0; $$.fValue = $1; $$.unit = CSSPrimitiveValue::CSS_DPI; }
  • trunk/Source/WebCore/css/CSSParser.cpp

    r141872 r142021  
    15991599    case CSSPrimitiveValue::CSS_VH:
    16001600    case CSSPrimitiveValue::CSS_VMIN:
     1601    case CSSPrimitiveValue::CSS_VMAX:
    16011602        b = (unitflags & FLength);
    16021603        break;
     
    16431644#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
    16441645    ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
    1645            || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
    1646            || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
    1647            || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM));
     1646        || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
     1647        || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX)
     1648        || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiveValue::CSS_DPCM));
    16481649#else
    16491650    ASSERT((value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimitiveValue::CSS_KHZ)
    1650            || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
    1651            || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN));
     1651        || (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
     1652        || (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX));
    16521653#endif
    16531654    return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
     
    17071708    if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiveValue::CSS_REMS)
    17081709        return createPrimitiveNumericValue(value);
    1709     if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMIN)
     1710    if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveValue::CSS_VMAX)
    17101711        return createPrimitiveNumericValue(value);
    17111712#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
     
    99809981            else if (isASCIIAlphaCaselessEqual(type[1], 'h'))
    99819982                m_token = VH;
    9982         } else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'm')
    9983                 && isASCIIAlphaCaselessEqual(type[2], 'i') && isASCIIAlphaCaselessEqual(type[3], 'n'))
    9984             m_token = VMIN;
     9983        } else if (length == 4 && isASCIIAlphaCaselessEqual(type[1], 'm')) {
     9984            if (isASCIIAlphaCaselessEqual(type[2], 'i') && isASCIIAlphaCaselessEqual(type[3], 'n'))
     9985                m_token = VMIN;
     9986            else if (isASCIIAlphaCaselessEqual(type[2], 'a') && isASCIIAlphaCaselessEqual(type[3], 'x'))
     9987                m_token = VMAX;
     9988        }
    99859989        return;
    99869990
  • trunk/Source/WebCore/css/CSSParserValues.cpp

    r140371 r142021  
    112112    case CSSPrimitiveValue::CSS_VH:
    113113    case CSSPrimitiveValue::CSS_VMIN:
     114    case CSSPrimitiveValue::CSS_VMAX:
    114115    case CSSPrimitiveValue::CSS_TURN:
    115116    case CSSPrimitiveValue::CSS_REMS:
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r141570 r142021  
    9494    case CSSPrimitiveValue::CSS_VH:
    9595    case CSSPrimitiveValue::CSS_VMIN:
     96    case CSSPrimitiveValue::CSS_VMAX:
    9697        return true;
    9798    case CSSPrimitiveValue::CSS_ATTR:
     
    160161    case CSSPrimitiveValue::CSS_VH:
    161162    case CSSPrimitiveValue::CSS_VMIN:
     163    case CSSPrimitiveValue::CSS_VMAX:
    162164        return CSSPrimitiveValue::UViewportPercentageLength;
    163165#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
     
    306308        case ViewportPercentageMin:
    307309            m_primitiveUnitType = CSS_VMIN;
     310            m_value.num = length.viewportPercentageLength();
     311            break;
     312        case ViewportPercentageMax:
     313            m_primitiveUnitType = CSS_VMAX;
    308314            m_value.num = length.viewportPercentageLength();
    309315            break;
     
    437443    case CSS_VH:
    438444    case CSS_VMIN:
     445    case CSS_VMAX:
    439446    case CSS_DPPX:
    440447    case CSS_DPI:
     
    11001107            text = formatNumber(m_value.num, "vmin");
    11011108            break;
     1109        case CSS_VMAX:
     1110            text = formatNumber(m_value.num, "vmax");
     1111            break;
    11021112#if ENABLE(CSS_VARIABLES)
    11031113        case CSS_VARIABLE_NAME:
     
    11661176    case CSS_VMIN:
    11671177        viewportLength = Length(getDoubleValue(), ViewportPercentageMin);
     1178        break;
     1179    case CSS_VMAX:
     1180        viewportLength = Length(getDoubleValue(), ViewportPercentageMax);
    11681181        break;
    11691182    default:
     
    12341247    case CSS_VH:
    12351248    case CSS_VMIN:
     1249    case CSS_VMAX:
    12361250#if ENABLE(CSS_IMAGE_RESOLUTION) || ENABLE(RESOLUTION_MEDIA_QUERY)
    12371251    case CSS_DPPX:
  • trunk/Source/WebCore/css/CSSPrimitiveValue.h

    r132227 r142021  
    9292        CSS_RECT = 24,
    9393        CSS_RGBCOLOR = 25,
    94         // From CSS Values and Units. Viewport-percentage Lengths (vw/vh/vmin).
     94        // From CSS Values and Units. Viewport-percentage Lengths (vw/vh/vmin/vmax).
    9595        CSS_VW = 26,
    9696        CSS_VH = 27,
    9797        CSS_VMIN = 28,
    98         CSS_DPPX = 29,
    99         CSS_DPI = 30,
    100         CSS_DPCM = 31,
     98        CSS_VMAX = 29,
     99        CSS_DPPX = 30,
     100        CSS_DPI = 31,
     101        CSS_DPCM = 32,
    101102        CSS_PAIR = 100, // We envision this being exposed as a means of getting computed style values for pairs (border-spacing/radius, background-position, etc.)
    102103#if ENABLE(DASHBOARD_SUPPORT)
     
    189190    bool isVariableName() const { return primitiveType() == CSS_VARIABLE_NAME; }
    190191#endif
    191     bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMIN; }
     192    bool isViewportPercentageLength() const { return m_primitiveUnitType >= CSS_VW && m_primitiveUnitType <= CSS_VMAX; }
    192193
    193194    static PassRefPtr<CSSPrimitiveValue> createIdentifier(int identifier) { return adoptRef(new CSSPrimitiveValue(identifier)); }
  • trunk/Source/WebCore/css/CSSPrimitiveValue.idl

    r141034 r142021  
    5252    const unsigned short CSS_VH         = 27;
    5353    const unsigned short CSS_VMIN       = 28;
     54    const unsigned short CSS_VMAX       = 29;
    5455   
    5556    readonly attribute unsigned short primitiveType;
  • trunk/Source/WebCore/css/LengthFunctions.cpp

    r133779 r142021  
    6767        }
    6868        return 0;
     69    case ViewportPercentageMax:
     70        if (renderView) {
     71            IntSize viewportSize = renderView->viewportSize();
     72            return static_cast<LayoutUnit>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
     73        }
     74        return 0;
    6975    case FillAvailable:
    7076    case Auto:
     
    9399    case ViewportPercentageHeight:
    94100    case ViewportPercentageMin:
     101    case ViewportPercentageMax:
    95102        return minimumValueForLength(length, maximumValue, renderView, roundPercentages);
    96103    case FillAvailable:
     
    138145        }
    139146        return 0;
     147    case ViewportPercentageMax:
     148        if (renderView) {
     149            IntSize viewportSize = renderView->viewportSize();
     150            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
     151        }
     152        return 0;
    140153    case Relative:
    141154    case Intrinsic:
     
    178191        }
    179192        return 0;
     193    case ViewportPercentageMax:
     194        if (renderView) {
     195            IntSize viewportSize = renderView->viewportSize();
     196            return static_cast<int>(std::max(viewportSize.width(), viewportSize.height()) * length.viewportPercentageLength() / 100.0f);
     197        }
     198        return 0;
    180199    case Relative:
    181200    case Intrinsic:
  • trunk/Source/WebCore/platform/Length.h

    r140198 r142021  
    3939    MinContent, MaxContent, FillAvailable, FitContent,
    4040    Calculated,
    41     ViewportPercentageWidth, ViewportPercentageHeight, ViewportPercentageMin,
     41    ViewportPercentageWidth, ViewportPercentageHeight, ViewportPercentageMin, ViewportPercentageMax,
    4242    Undefined
    4343};
     
    266266    {
    267267        LengthType lengthType = type();
    268         return lengthType >= ViewportPercentageWidth && lengthType <= ViewportPercentageMin;
     268        return lengthType >= ViewportPercentageWidth && lengthType <= ViewportPercentageMax;
    269269    }
    270270    float viewportPercentageLength() const
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r141963 r142021  
    26022602        case ViewportPercentageHeight:
    26032603        case ViewportPercentageMin:
     2604        case ViewportPercentageMax:
    26042605            return adjustContentBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, 0, view()));
    26052606        case Percent:
     
    26912692        case ViewportPercentageHeight:
    26922693        case ViewportPercentageMin:
     2694        case ViewportPercentageMax:
    26932695            return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, 0, view()));
    26942696        default:
Note: See TracChangeset for help on using the changeset viewer.