Changeset 208029 in webkit


Ignore:
Timestamp:
Oct 27, 2016 9:11:18 PM (8 years ago)
Author:
hyatt@apple.com
Message:

[CSS Parser] Add support for a reference box to -webkit-clip-path
https://bugs.webkit.org/show_bug.cgi?id=164107

Reviewed by Simon Fraser.

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeBasicShape):
(WebCore::consumeBasicShapeOrBox):
(WebCore::consumeWebkitClipPath):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r208028 r208029  
     12016-10-27  Dave Hyatt  <hyatt@apple.com>
     2
     3        [CSS Parser] Add support for a reference box to -webkit-clip-path
     4        https://bugs.webkit.org/show_bug.cgi?id=164107
     5
     6        Reviewed by Simon Fraser.
     7
     8        * css/parser/CSSPropertyParser.cpp:
     9        (WebCore::consumeBasicShape):
     10        (WebCore::consumeBasicShapeOrBox):
     11        (WebCore::consumeWebkitClipPath):
     12
    1132016-10-27  Yusuke Suzuki  <utatane.tea@gmail.com>
    214
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r207759 r208029  
    22042204    else if (id == CSSValueInset)
    22052205        shape = consumeBasicShapeInset(args, context);
    2206     if (!shape || !args.atEnd())
     2206    if (!shape)
    22072207        return nullptr;
    22082208    range = rangeCopy;
     
    22112211}
    22122212
     2213static RefPtr<CSSValue> consumeBasicShapeOrBox(CSSParserTokenRange& range, const CSSParserContext& context)
     2214{
     2215    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     2216    bool shapeFound = false;
     2217    bool boxFound = false;
     2218    while (!range.atEnd() && !(shapeFound && boxFound)) {
     2219        RefPtr<CSSValue> componentValue;
     2220        if (range.peek().type() == FunctionToken && !shapeFound) {
     2221            componentValue = consumeBasicShape(range, context);
     2222            shapeFound = true;
     2223        } else if (range.peek().type() == IdentToken && !boxFound) {
     2224            componentValue = consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, CSSValueFill, CSSValueStroke, CSSValueViewBox>(range);
     2225            boxFound = true;
     2226        }
     2227        if (!componentValue)
     2228            return nullptr;
     2229        list->append(componentValue.releaseNonNull());
     2230    }
     2231   
     2232    if (!range.atEnd())
     2233        return nullptr;
     2234   
     2235    return list;
     2236}
     2237   
    22132238static RefPtr<CSSValue> consumeWebkitClipPath(CSSParserTokenRange& range, const CSSParserContext& context)
    22142239{
     
    22172242    if (RefPtr<CSSPrimitiveValue> url = consumeUrl(range))
    22182243        return url;
    2219     return consumeBasicShape(range, context);
     2244    return consumeBasicShapeOrBox(range, context);
    22202245}
    22212246
Note: See TracChangeset for help on using the changeset viewer.