Changeset 127557 in webkit


Ignore:
Timestamp:
Sep 4, 2012 11:28:26 PM (12 years ago)
Author:
mikelawther@chromium.org
Message:

CSS3 calc: expressions with 'em' units do not zoom correctly.
https://bugs.webkit.org/show_bug.cgi?id=95705

Reviewed by Ojan Vafai.

Source/WebCore:

Each primitive value in a CSS calc expression now has (zoom) multiplier and scale factor applied
independently. Previously the multiplier and a single scale factor was applied to the expression
as a whole, but this failed to account for expressions involving font relative units. This is
because the multiplier should not be applied to font relative units.

Test: css3/calc/zoom-with-em.html

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::computeLengthDouble):

LayoutTests:

  • css3/calc/zoom-with-em-expected.txt: Added.
  • css3/calc/zoom-with-em.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r127553 r127557  
     12012-09-04  Mike Lawther  <mikelawther@chromium.org>
     2
     3        CSS3 calc: expressions with 'em' units do not zoom correctly.
     4        https://bugs.webkit.org/show_bug.cgi?id=95705
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * css3/calc/zoom-with-em-expected.txt: Added.
     9        * css3/calc/zoom-with-em.html: Added.
     10
    1112012-09-04  Keishi Hattori  <keishi@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r127556 r127557  
     12012-09-04  Mike Lawther  <mikelawther@chromium.org>
     2
     3        CSS3 calc: expressions with 'em' units do not zoom correctly.
     4        https://bugs.webkit.org/show_bug.cgi?id=95705
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Each primitive value in a CSS calc expression now has (zoom) multiplier and scale factor applied
     9        independently. Previously the multiplier and a single scale factor was applied to the expression
     10        as a whole, but this failed to account for expressions involving font relative units. This is
     11        because the multiplier should not be applied to font relative units.
     12
     13        Test: css3/calc/zoom-with-em.html
     14
     15        * css/CSSPrimitiveValue.cpp:
     16        (WebCore::CSSPrimitiveValue::computeLengthDouble):
     17
    1182012-09-04  Brian Anderson  <brianderson@chromium.org>
    219
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r127224 r127557  
    495495double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
    496496{
     497    if (m_primitiveUnitType == CSS_CALC)
     498        // The multiplier and factor is applied to each value in the calc expression individually
     499        return m_value.calc->computeLengthPx(style, rootStyle, multiplier, computingFontSize);
     500       
    497501    double factor;
    498502
     
    541545    }
    542546
    543     double computedValue;
    544     if (m_primitiveUnitType == CSS_CALC)
    545         // The multiplier is passed in as 1.0 here to ensure it is only applied once
    546         computedValue = m_value.calc->computeLengthPx(style, rootStyle, 1.0, computingFontSize);
    547     else
    548         computedValue = getDoubleValue();
    549    
    550547    // We do not apply the zoom factor when we are computing the value of the font-size property. The zooming
    551548    // for font sizes is much more complicated, since we have to worry about enforcing the minimum font size preference
    552549    // as well as enforcing the implicit "smart minimum." In addition the CSS property text-size-adjust is used to
    553550    // prevent text from zooming at all. Therefore we will not apply the zoom here if we are computing font-size.
    554     double result = computedValue * factor;
     551    double result = getDoubleValue() * factor;
    555552    if (computingFontSize || isFontRelativeLength())
    556553        return result;
Note: See TracChangeset for help on using the changeset viewer.