Changeset 176454 in webkit


Ignore:
Timestamp:
Nov 21, 2014 11:00:56 AM (9 years ago)
Author:
Chris Dumez
Message:

Crash when setting 'font' CSS property to 'calc(2 * 3)'
https://bugs.webkit.org/show_bug.cgi?id=138933

Reviewed by Darin Adler.

Source/WebCore:

The CSS Parser was not handling calculated values when parsing the font
weight. This would lead us to hit an assertion when parsing a font
property whose weight is set to a calculated value.

This patch updates parseFontWeight() to properly handle calculated
values.

Test: fast/css/font-calculated-value.html

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseFontWeight):

LayoutTests:

Add a layout test to cover the case where the 'font' CSS property is
set to a value whose weight is a calculated value, to make sure it
does not crash and behaves as intended.

  • fast/css/font-calculated-value-expected.txt: Added.
  • fast/css/font-calculated-value.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r176453 r176454  
     12014-11-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash when setting 'font' CSS property to 'calc(2 * 3)'
     4        https://bugs.webkit.org/show_bug.cgi?id=138933
     5
     6        Reviewed by Darin Adler.
     7
     8        Add a layout test to cover the case where the 'font' CSS property is
     9        set to a value whose weight is a calculated value, to make sure it
     10        does not crash and behaves as intended.
     11
     12        * fast/css/font-calculated-value-expected.txt: Added.
     13        * fast/css/font-calculated-value.html: Added.
     14
    1152014-11-21  Bear Travis  <betravis@gmail.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r176453 r176454  
     12014-11-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Crash when setting 'font' CSS property to 'calc(2 * 3)'
     4        https://bugs.webkit.org/show_bug.cgi?id=138933
     5
     6        Reviewed by Darin Adler.
     7
     8        The CSS Parser was not handling calculated values when parsing the font
     9        weight. This would lead us to hit an assertion when parsing a font
     10        property whose weight is set to a calculated value.
     11
     12        This patch updates parseFontWeight() to properly handle calculated
     13        values.
     14
     15        Test: fast/css/font-calculated-value.html
     16
     17        * css/CSSParser.cpp:
     18        (WebCore::CSSParser::parseFontWeight):
     19
    1202014-11-21  Bear Travis  <betravis@gmail.com>
    221
  • trunk/Source/WebCore/css/CSSParser.cpp

    r176390 r176454  
    64496449    }
    64506450    if (validUnit(value, FInteger | FNonNeg, CSSQuirksMode)) {
    6451         int weight = static_cast<int>(value->fValue);
     6451        int weight = static_cast<int>(parsedDouble(value, ReleaseParsedCalcValue));
    64526452        if (!(weight % 100) && weight >= 100 && weight <= 900) {
    64536453            addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(createFontWeightValueKeyword(weight)), important);
Note: See TracChangeset for help on using the changeset viewer.