Changeset 209006 in webkit


Ignore:
Timestamp:
Nov 28, 2016 12:28:15 PM (7 years ago)
Author:
hyatt@apple.com
Message:

[CSS Parser] Filters and Reflections Fixes
https://bugs.webkit.org/show_bug.cgi?id=165103

Reviewed by Zalan Bujtas.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeReflect):
Support the "none" keyword for box-reflect.

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction):
(WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
Don't rely on range checking, since invert isn't grouped with the other
function values. Actually check every keyword.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r209005 r209006  
     12016-11-28  Dave Hyatt  <hyatt@apple.com>
     2
     3        [CSS Parser] Filters and Reflections Fixes
     4        https://bugs.webkit.org/show_bug.cgi?id=165103
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * css/parser/CSSPropertyParser.cpp:
     9        (WebCore::consumeReflect):
     10        Support the "none" keyword for box-reflect.
     11
     12        * css/parser/CSSPropertyParserHelpers.cpp:
     13        (WebCore::CSSPropertyParserHelpers::isValidPrimitiveFilterFunction):
     14        (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
     15        Don't rely on range checking, since invert isn't grouped with the other
     16        function values. Actually check every keyword.
     17
    1182016-11-28  Brent Fulgham  <bfulgham@apple.com>
    219
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r209003 r209006  
    26212621static RefPtr<CSSValue> consumeReflect(CSSParserTokenRange& range, const CSSParserContext& context)
    26222622{
     2623    if (range.peek().id() == CSSValueNone)
     2624        return consumeIdent(range);
     2625   
    26232626    RefPtr<CSSPrimitiveValue> direction = consumeIdent<CSSValueAbove, CSSValueBelow, CSSValueLeft, CSSValueRight>(range);
    26242627    if (!direction)
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r208700 r209006  
    11831183        || id == CSSValueCrossFade || id == CSSValueWebkitNamedImage || id == CSSValueWebkitFilter || id == CSSValueFilter;
    11841184}
     1185   
     1186static bool isValidPrimitiveFilterFunction(CSSValueID filterFunction)
     1187{
     1188    switch (filterFunction) {
     1189    case CSSValueBlur:
     1190    case CSSValueBrightness:
     1191    case CSSValueContrast:
     1192    case CSSValueDropShadow:
     1193    case CSSValueGrayscale:
     1194    case CSSValueHueRotate:
     1195    case CSSValueInvert:
     1196    case CSSValueOpacity:
     1197    case CSSValueSaturate:
     1198    case CSSValueSepia:
     1199        return true;
     1200    default:
     1201        return false;
     1202    }
     1203}
    11851204
    11861205RefPtr<CSSFunctionValue> consumeFilterFunction(CSSParserTokenRange& range, const CSSParserContext& context)
    11871206{
    11881207    CSSValueID filterType = range.peek().functionId();
    1189     if (filterType < CSSValueInvert || filterType > CSSValueDropShadow)
     1208    if (!isValidPrimitiveFilterFunction(filterType))
    11901209        return nullptr;
    11911210    CSSParserTokenRange args = consumeFunction(range);
    1192     auto filterValue = CSSFunctionValue::create(filterType);
     1211    RefPtr<CSSFunctionValue> filterValue = CSSFunctionValue::create(filterType);
    11931212    RefPtr<CSSValue> parsedValue;
    11941213
     
    11971216    else {
    11981217        if (args.atEnd())
    1199             return filterValue.ptr();
     1218            return filterValue;
    12001219        if (filterType == CSSValueBrightness) {
    12011220            parsedValue = consumePercent(args, ValueRangeAll);
     
    12201239    if (!parsedValue || !args.atEnd())
    12211240        return nullptr;
    1222     filterValue->append(*parsedValue);
    1223     return filterValue.ptr();
     1241    filterValue->append(parsedValue.releaseNonNull());
     1242    return filterValue;
    12241243}
    12251244
Note: See TracChangeset for help on using the changeset viewer.