Source/WebCore/ChangeLog

 12016-09-15 Dave Hyatt <hyatt@apple.com>
 2
 3 [CSS Parser] Get CSSParserFastPaths.cpp compiling
 4 https://bugs.webkit.org/show_bug.cgi?id=162033
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * CMakeLists.txt:
 9 * WebCore.xcodeproj/project.pbxproj:
 10 Add new StyleColor.h/.cpp files to the projecty
 11
 12 * css/CSSFunctionValue.cpp:
 13 (WebCore::CSSFunctionValue::CSSFunctionValue):
 14 (WebCore::CSSFunctionValue::customCSSText):
 15 (WebCore::CSSFunctionValue::append):
 16 (WebCore::CSSFunctionValue::buildParserValueSubstitutingVariables):
 17 * css/CSSFunctionValue.h:
 18 Tweak CSSFunctionValue so that the name can be represented as a keyword ID instead of a String. Eventually we also
 19 want to make CSSFunctionValue subclass CSSValueList rather than referening a separate CSSValueList as a member. For now
 20 I left that alone though in order to not change too much in the old parser.
 21
 22 * css/CSSProperty.cpp:
 23 (WebCore::CSSProperty::isDescriptorOnly):
 24 Whether or not a property is only a descriptor, e.g., used in viewport and font face stuff.
 25
 26 * css/CSSProperty.h:
 27 * css/CSSValueKeywords.in:
 28 Added new keywords for functions that can be used as values. The new parser uses keywords to represent function names.
 29
 30 * css/StyleColor.cpp: Added.
 31 (WebCore::StyleColor::colorFromKeyword):
 32 (WebCore::StyleColor::isColorKeyword):
 33 (WebCore::StyleColor::isSystemColor):
 34 * css/StyleColor.h: Added.
 35 (WebCore::StyleColor::StyleColor):
 36 (WebCore::StyleColor::currentColor):
 37 (WebCore::StyleColor::isCurrentColor):
 38 (WebCore::StyleColor::getColor):
 39 (WebCore::StyleColor::resolve):
 40 (WebCore::operator==):
 41 (WebCore::operator!=):
 42 New color helper that contains code for checking and looking up colors. This code is similar to some code we already
 43 had in the old CSSParser.cpp file, but this way it can be used outside the parser and/or in different files.
 44
 45 * css/parser/CSSParserFastPaths.cpp:
 46 (WebCore::parseSimpleLengthValue):
 47 (WebCore::isColorPropertyID):
 48 (WebCore::parseColorIntOrPercentage):
 49 (WebCore::fastParseColorInternal):
 50 (WebCore::CSSParserFastPaths::parseColor):
 51 (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
 52 (WebCore::isUniversalKeyword):
 53 (WebCore::parseKeywordValue):
 54 (WebCore::parseTransformTranslateArguments):
 55 (WebCore::parseTransformNumberArguments):
 56 (WebCore::parseSimpleTransformValue):
 57 (WebCore::transformCanLikelyUseFastPath):
 58 (WebCore::parseSimpleTransformList):
 59 (WebCore::parseSimpleTransform):
 60 (WebCore::CSSParserFastPaths::maybeParseValue):
 61 * css/parser/CSSParserFastPaths.h:
 62 Get everything compiling in this file. Key changes included reverting to our old unit names, making CSSFunctionValue compatible,
 63 adding support for StyleColor, adding support for mode checking of keywords, and fixing up the memory management model so that
 64 RefPtrs are used on returns from parsing functions.
 65
 66 * css/parser/CSSParserIdioms.cpp:
 67 (WebCore::isValueAllowedInMode):
 68 * css/parser/CSSParserIdioms.h:
 69 New helper function for restricting keywords to certain modes only. The -webkit-text color quirk has been moved to this function.
 70
1712016-09-15 Anders Carlsson <andersca@apple.com>
272
373 Fix build.
205995

Source/WebCore/CMakeLists.txt

@@set(WebCore_SOURCES
13321332 css/SVGCSSComputedStyleDeclaration.cpp
13331333 css/SelectorChecker.cpp
13341334 css/SelectorFilter.cpp
 1335 css/StyleColor.cpp
13351336 css/StyleInvalidationAnalysis.cpp
13361337 css/StyleMedia.cpp
13371338 css/StyleProperties.cpp
205990

Source/WebCore/WebCore.xcodeproj/project.pbxproj

33393339 93F9B7A00BA6032600854064 /* JSCDATASection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F9B79E0BA6032600854064 /* JSCDATASection.cpp */; };
33403340 93F9B7A10BA6032600854064 /* JSCDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F9B79F0BA6032600854064 /* JSCDATASection.h */; };
33413341 93FDAFCA0B11307400E2746F /* EditorInsertAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDAFC90B11307400E2746F /* EditorInsertAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
 3342 9418278A1D8B244000492764 /* StyleColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941827881D8B242200492764 /* StyleColor.cpp */; };
 3343 9418278B1D8B244000492764 /* StyleColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 941827891D8B242200492764 /* StyleColor.h */; };
33423344 9444CBD31D860C8B0073A074 /* SizesCalcParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBD01D860C740073A074 /* SizesCalcParser.cpp */; };
33433345 9444CBD41D860C8B0073A074 /* SizesCalcParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBCF1D860C740073A074 /* SizesCalcParser.h */; };
33443346 9444CBD51D860C8B0073A074 /* SizesAttributeParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBD21D860C740073A074 /* SizesAttributeParser.cpp */; };

93779379 5C5381AF1D8793E000E2EBE6 /* URLSearchParams.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = URLSearchParams.idl; sourceTree = "<group>"; };
93789380 5C5381B01D87D45700E2EBE6 /* URLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLSearchParams.cpp; sourceTree = "<group>"; };
93799381 5C5381B11D87D45700E2EBE6 /* URLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = URLSearchParams.h; sourceTree = "<group>"; };
9380  5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSURLSearchParams.cpp; path = JSURLSearchParams.cpp; sourceTree = "<group>"; };
9381  5C5381B41D87E08100E2EBE6 /* JSURLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSURLSearchParams.h; path = JSURLSearchParams.h; sourceTree = "<group>"; };
 9382 5C5381B31D87E08100E2EBE6 /* JSURLSearchParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSURLSearchParams.cpp; sourceTree = "<group>"; };
 9383 5C5381B41D87E08100E2EBE6 /* JSURLSearchParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSURLSearchParams.h; sourceTree = "<group>"; };
93829384 5C688AA01D380509000B54FA /* ThreadableWebSocketChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadableWebSocketChannel.cpp; sourceTree = "<group>"; };
93839385 5C688AA21D38126F000B54FA /* SocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SocketProvider.cpp; sourceTree = "<group>"; };
93849386 5C6E653F1D5CEDC900F7862E /* URLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLParser.cpp; sourceTree = "<group>"; };

1050710509 93F9B79E0BA6032600854064 /* JSCDATASection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCDATASection.cpp; sourceTree = "<group>"; };
1050810510 93F9B79F0BA6032600854064 /* JSCDATASection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCDATASection.h; sourceTree = "<group>"; };
1050910511 93FDAFC90B11307400E2746F /* EditorInsertAction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EditorInsertAction.h; sourceTree = "<group>"; };
 10512 941827881D8B242200492764 /* StyleColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleColor.cpp; sourceTree = "<group>"; };
 10513 941827891D8B242200492764 /* StyleColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleColor.h; sourceTree = "<group>"; };
1051010514 9444CBCF1D860C740073A074 /* SizesCalcParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SizesCalcParser.h; path = parser/SizesCalcParser.h; sourceTree = "<group>"; };
1051110515 9444CBD01D860C740073A074 /* SizesCalcParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SizesCalcParser.cpp; path = parser/SizesCalcParser.cpp; sourceTree = "<group>"; };
1051210516 9444CBD11D860C740073A074 /* SizesAttributeParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SizesAttributeParser.h; path = parser/SizesAttributeParser.h; sourceTree = "<group>"; };

2254822552 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */,
2254922553 83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */,
2255022554 835D363619FF6193004C93AB /* StyleBuilderCustom.h */,
 22555 941827881D8B242200492764 /* StyleColor.cpp */,
 22556 941827891D8B242200492764 /* StyleColor.h */,
2255122557 E47A97CE163059FC005DCD99 /* StyleInvalidationAnalysis.cpp */,
2255222558 E47A97CF163059FC005DCD99 /* StyleInvalidationAnalysis.h */,
2255322559 0FF5026E102BA9660066F39A /* StyleMedia.cpp */,

2565725663 CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
2565825664 1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */,
2565925665 1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */,
 25666 9418278B1D8B244000492764 /* StyleColor.h in Headers */,
2566025667 CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
2566125668 C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */,
2566225669 C9F87CFE1B28F40E00979B83 /* MediaSessionEvents.h in Headers */,

2797327980 5C9A7A761AA0F6ED00958ACF /* DFABytecodeInterpreter.cpp in Sources */,
2797427981 26A807841B18F97700E219BE /* DFACombiner.cpp in Sources */,
2797527982 26A517FD1AB92238006335DF /* DFAMinimizer.cpp in Sources */,
 27983 9418278A1D8B244000492764 /* StyleColor.cpp in Sources */,
2797627984 26D4E8461B42539D00E033A2 /* DFANode.cpp in Sources */,
2797727985 CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */,
2797827986 CECADFC6153778FF00E37068 /* DictationAlternative.cpp in Sources */,
205990

Source/WebCore/css/CSSFunctionValue.cpp

@@namespace WebCore {
3434
3535CSSFunctionValue::CSSFunctionValue(CSSParserFunction* function)
3636 : CSSValue(FunctionClass)
37  , m_name(function->name)
 37 , m_nameDeprecated(function->name)
3838 , m_args(function->args ? RefPtr<CSSValueList>(CSSValueList::createFromParserValueList(*function->args)) : nullptr)
3939{
4040}
4141
4242CSSFunctionValue::CSSFunctionValue(const String& name, Ref<CSSValueList>&& args)
4343 : CSSValue(FunctionClass)
44  , m_name(name)
 44 , m_nameDeprecated(name)
4545 , m_args(WTFMove(args))
4646{
4747}
4848
 49CSSFunctionValue::CSSFunctionValue(CSSValueID keyword)
 50: CSSValue(FunctionClass)
 51, m_name(keyword)
 52{
 53}
 54
4955String CSSFunctionValue::customCSSText() const
5056{
5157 StringBuilder result;
52  result.append(m_name); // Includes the '('
 58 if (m_name != CSSValueInvalid) {
 59 result.append(getValueName(m_name));
 60 result.append('(');
 61 } else
 62 result.append(m_nameDeprecated); // Includes the '('
5363 if (m_args)
5464 result.append(m_args->cssText());
5565 result.append(')');

@@bool CSSFunctionValue::equals(const CSSF
6171 return m_name == other.m_name && compareCSSValuePtr(m_args, other.m_args);
6272}
6373
 74void CSSFunctionValue::append(Ref<CSSValue>&& value)
 75{
 76 if (!m_args)
 77 m_args = CSSValueList::createCommaSeparated();
 78 m_args->append(WTFMove(value));
 79}
 80
6481bool CSSFunctionValue::buildParserValueSubstitutingVariables(CSSParserValue* result, const CustomPropertyValueMap& customProperties) const
6582{
6683 result->id = CSSValueInvalid;
6784 result->unit = CSSParserValue::Function;
6885 result->function = new CSSParserFunction;
69  result->function->name.init(m_name);
 86 result->function->name.init(m_nameDeprecated);
7087 bool success = true;
7188 if (m_args) {
7289 CSSParserValueList* argList = new CSSParserValueList;
205990

Source/WebCore/css/CSSFunctionValue.h

2626#pragma once
2727
2828#include "CSSValue.h"
 29#include "CSSValueKeywords.h"
2930
3031namespace WebCore {
3132

@@class CSSValueList;
3334struct CSSParserFunction;
3435struct CSSParserValue;
3536
 37// FIXME-NEWPARSER: This can just *be* a CSSValueList subclass.
3638class CSSFunctionValue final : public CSSValue {
3739public:
3840 static Ref<CSSFunctionValue> create(CSSParserFunction* function)

@@public:
4547 return adoptRef(*new CSSFunctionValue(name, WTFMove(args)));
4648 }
4749
 50 static Ref<CSSFunctionValue> create(CSSValueID keyword)
 51 {
 52 return adoptRef(*new CSSFunctionValue(keyword));
 53 }
 54
4855 String customCSSText() const;
4956
5057 bool equals(const CSSFunctionValue&) const;

@@public:
5259 CSSValueList* arguments() const { return m_args.get(); }
5360
5461 bool buildParserValueSubstitutingVariables(CSSParserValue*, const CustomPropertyValueMap& customProperties) const;
55 
 62
 63 void append(Ref<CSSValue>&& value);
 64
5665private:
5766 explicit CSSFunctionValue(CSSParserFunction*);
5867 CSSFunctionValue(const String&, Ref<CSSValueList>&&);
 68 CSSFunctionValue(CSSValueID);
 69
 70 CSSValueID m_name { CSSValueInvalid };
5971
60  String m_name;
 72 // FIXME-NEWPARSER: Remove these.
 73 String m_nameDeprecated;
6174 RefPtr<CSSValueList> m_args;
6275};
6376
205990

Source/WebCore/css/CSSProperty.cpp

@@CSSPropertyID CSSProperty::resolveDirect
154154 }
155155}
156156
 157bool CSSProperty::isDescriptorOnly(CSSPropertyID propertyID)
 158{
 159 switch (propertyID) {
 160#if ENABLE(CSS_DEVICE_ADAPTATION)
 161 case CSSPropertyMinZoom:
 162 case CSSPropertyMaxZoom:
 163 case CSSPropertyOrientation:
 164 case CSSPropertyUserZoom:
 165#endif
 166 case CSSPropertySrc:
 167 case CSSPropertyUnicodeRange:
 168 return true;
 169 default:
 170 return false;
 171 }
 172}
 173
157174bool CSSProperty::isDirectionAwareProperty(CSSPropertyID propertyID)
158175{
159176 switch (propertyID) {
205990

Source/WebCore/css/CSSProperty.h

@@public:
7979 static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode);
8080 static bool isInheritedProperty(CSSPropertyID);
8181 static bool isDirectionAwareProperty(CSSPropertyID);
 82 static bool isDescriptorOnly(CSSPropertyID);
8283
8384 const StylePropertyMetadata& metadata() const { return m_metadata; }
8485
205990

Source/WebCore/css/CSSValueKeywords.in

@@isolate
11491149// none
11501150scale-down
11511151
 1152// background-image, etc.
 1153linear-gradient
 1154radial-gradient
 1155repeating-linear-gradient
 1156repeating-radial-gradient
 1157paint
 1158-webkit-cross-fade
 1159-webkit-gradient
 1160-webkit-linear-gradient
 1161-webkit-radial-gradient
 1162-webkit-repeating-linear-gradient
 1163-webkit-repeating-radial-gradient
 1164-webkit-image-set
 1165
 1166// deprecated gradients
 1167from
 1168to
 1169color-stop
 1170radial
 1171
 1172// content
 1173attr
 1174counter
 1175counters
 1176
 1177// clip
 1178rect
 1179
 1180// shapes
 1181polygon
 1182
 1183// @font-face src
 1184format
 1185
 1186// (-webkit-)filter
 1187// invert
 1188grayscale
 1189sepia
 1190saturate
 1191hue-rotate
 1192opacity
 1193brightness
 1194contrast
 1195blur
 1196drop-shadow
 1197url
 1198
 1199// colors
 1200rgb
 1201rgba
 1202hsl
 1203hsla
 1204
 1205// transform
 1206matrix
 1207matrix3d
 1208perspective
 1209rotate
 1210rotateX
 1211rotateY
 1212rotateZ
 1213rotate3d
 1214scale
 1215scaleX
 1216scaleY
 1217scaleZ
 1218scale3d
 1219skew
 1220skewX
 1221skewY
 1222translate
 1223translateX
 1224translateY
 1225translateZ
 1226translate3d
 1227
 1228// motion path
 1229path
 1230
 1231calc
 1232-webkit-calc
 1233
11521234#if defined(ENABLE_CSS_IMAGE_RESOLUTION) && ENABLE_CSS_IMAGE_RESOLUTION
11531235from-image
11541236snap
205990

Source/WebCore/css/StyleColor.cpp

 1/*
 2 * Copyright (C) 2015 Google Inc. All rights reserved.
 3 * Copyright (C) 2016 Apple Inc. All rights reserved.
 4 *
 5 * Redistribution and use in source and binary forms, with or without
 6 * modification, are permitted provided that the following conditions are
 7 * met:
 8 *
 9 * * Redistributions of source code must retain the above copyright
 10 * notice, this list of conditions and the following disclaimer.
 11 * * Redistributions in binary form must reproduce the above
 12 * copyright notice, this list of conditions and the following disclaimer
 13 * in the documentation and/or other materials provided with the
 14 * distribution.
 15 * * Neither the name of Google Inc. nor the names of its
 16 * contributors may be used to endorse or promote products derived from
 17 * this software without specific prior written permission.
 18 *
 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 */
 31
 32#include "config.h"
 33#include "StyleColor.h"
 34
 35#include "HashTools.h"
 36#include "RenderTheme.h"
 37
 38namespace WebCore {
 39
 40Color StyleColor::colorFromKeyword(CSSValueID keyword)
 41{
 42 if (const char* valueName = getValueName(keyword)) {
 43 if (const NamedColor* namedColor = findColor(valueName, strlen(valueName)))
 44 return Color(namedColor->ARGBValue);
 45 }
 46 return RenderTheme::defaultTheme()->systemColor(keyword);
 47}
 48
 49bool StyleColor::isColorKeyword(CSSValueID id)
 50{
 51 return (id >= CSSValueAlpha && id <= CSSValueWebkitText) || id == CSSValueMenu;
 52}
 53
 54bool StyleColor::isSystemColor(CSSValueID id)
 55{
 56 return (id >= CSSValueActiveborder && id <= CSSValueAppleSystemYellow) || id == CSSValueMenu || id == CSSValueWebkitFocusRingColor;
 57}
 58
 59} // namespace WebCore
nonexistent

Source/WebCore/css/StyleColor.h

 1/*
 2 * Copyright (C) 2013 Google Inc. All rights reserved.
 3 * Copyright (C) 2016 Apple Inc. All rights reserved.
 4 *
 5 * Redistribution and use in source and binary forms, with or without
 6 * modification, are permitted provided that the following conditions are
 7 * met:
 8 *
 9 * * Redistributions of source code must retain the above copyright
 10 * notice, this list of conditions and the following disclaimer.
 11 * * Redistributions in binary form must reproduce the above
 12 * copyright notice, this list of conditions and the following disclaimer
 13 * in the documentation and/or other materials provided with the
 14 * distribution.
 15 * * Neither the name of Google Inc. nor the names of its
 16 * contributors may be used to endorse or promote products derived from
 17 * this software without specific prior written permission.
 18 *
 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 */
 31
 32#pragma once
 33
 34#include "CSSValueKeywords.h"
 35#include "Color.h"
 36
 37namespace WebCore {
 38
 39class StyleColor {
 40public:
 41 StyleColor() : m_currentColor(true) { }
 42 StyleColor(Color color) : m_color(color), m_currentColor(false) { }
 43 static StyleColor currentColor() { return StyleColor(); }
 44
 45 bool isCurrentColor() const { return m_currentColor; }
 46 Color getColor() const { ASSERT(!isCurrentColor()); return m_color; }
 47
 48 Color resolve(Color currentColor) const { return m_currentColor ? currentColor : m_color; }
 49
 50 static Color colorFromKeyword(CSSValueID);
 51 static bool isColorKeyword(CSSValueID);
 52 static bool isSystemColor(CSSValueID);
 53
 54private:
 55 Color m_color;
 56 bool m_currentColor;
 57};
 58
 59inline bool operator==(const StyleColor& a, const StyleColor& b)
 60{
 61 if (a.isCurrentColor() || b.isCurrentColor())
 62 return a.isCurrentColor() && b.isCurrentColor();
 63 return a.getColor() == b.getColor();
 64}
 65
 66inline bool operator!=(const StyleColor& a, const StyleColor& b)
 67{
 68 return !(a == b);
 69}
 70
 71
 72} // namespace WebCore
nonexistent

Source/WebCore/css/parser/CSSParserFastPaths.cpp

3030#include "config.h"
3131#include "CSSParserFastPaths.h"
3232
33 // FIXME-NEWPARSER: #include "CSSColorValue.h"
3433#include "CSSFunctionValue.h"
3534#include "CSSInheritedValue.h"
3635#include "CSSInitialValue.h"
3736#include "CSSParserIdioms.h"
3837#include "CSSPrimitiveValue.h"
3938#include "CSSPropertyParser.h"
 39#include "CSSValueList.h"
 40#include "CSSValuePool.h"
4041#include "HTMLParserIdioms.h"
4142#include "RuntimeEnabledFeatures.h"
42 // FIXME-NEWPARSER: #include "StyleColor.h"
 43#include "StyleColor.h"
4344#include "StylePropertyShorthand.h"
4445
4546namespace WebCore {
4647
47 /* FIXME-NEWPARSER: Turn off for now.
48 
4948static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acceptsNegativeNumbers)
5049{
5150 switch (propertyId) {

@@static inline bool parseSimpleLength(con
120119 return true;
121120}
122121
123 static CSSValue* parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
 122static RefPtr<CSSValue> parseSimpleLengthValue(CSSPropertyID propertyId, const String& string, CSSParserMode cssParserMode)
124123{
125124 ASSERT(!string.isEmpty());
126125 bool acceptsNegativeNumbers = false;

@@static CSSValue* parseSimpleLengthValue(
131130
132131 unsigned length = string.length();
133132 double number;
134  CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::Number;
 133 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
135134
136135 if (string.is8Bit()) {
137136 if (!parseSimpleLength(string.characters8(), length, unit, number))

@@static CSSValue* parseSimpleLengthValue(
141140 return nullptr;
142141 }
143142
144  if (unit == CSSPrimitiveValue::UnitTypes::Number) {
145  if (cssParserMode == SVGAttributeMode)
146  unit = CSSPrimitiveValue::UnitTypes::UserUnits;
147  else if (!number)
148  unit = CSSPrimitiveValue::UnitTypes::Pixels;
149  else
 143 if (unit == CSSPrimitiveValue::UnitTypes::CSS_NUMBER) {
 144 if (!number)
 145 unit = CSSPrimitiveValue::UnitTypes::CSS_PX;
 146 else if (cssParserMode != SVGAttributeMode)
150147 return nullptr;
151148 }
152149

@@static inline bool isColorPropertyID(CSS
179176 case CSSPropertyWebkitTextEmphasisColor:
180177 case CSSPropertyWebkitTextFillColor:
181178 case CSSPropertyWebkitTextStrokeColor:
182  case CSSPropertyTextDecorationColor:
 179 case CSSPropertyWebkitTextDecorationColor:
183180 return true;
184181 default:
185182 return false;

@@static bool parseColorIntOrPercentage(co
284281 if (current == end)
285282 return false;
286283
287  if (expect == CSSPrimitiveValue::UnitTypes::Number && (*current == '.' || *current == '%'))
 284 if (expect == CSSPrimitiveValue::UnitTypes::CSS_NUMBER && (*current == '.' || *current == '%'))
288285 return false;
289286
290287 if (*current == '.') {

@@static bool parseColorIntOrPercentage(co
300297 localValue += percentage;
301298 }
302299
303  if (expect == CSSPrimitiveValue::UnitTypes::Percentage && *current != '%')
 300 if (expect == CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE && *current != '%')
304301 return false;
305302
306303 if (*current == '%') {
307  expect = CSSPrimitiveValue::UnitTypes::Percentage;
 304 expect = CSSPrimitiveValue::UnitTypes::CSS_PERCENTAGE;
308305 localValue = localValue / 100.0 * 256.0;
309306 // Clamp values at 255 for percentages over 100%
310307 if (localValue > 255)
311308 localValue = 255;
312309 current++;
313310 } else {
314  expect = CSSPrimitiveValue::UnitTypes::Number;
 311 expect = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
315312 }
316313
317314 while (current != end && isHTMLSpace<CharacterType>(*current))

@@static inline bool mightBeRGB(const Char
416413template <typename CharacterType>
417414static bool fastParseColorInternal(RGBA32& rgb, const CharacterType* characters, unsigned length, bool quirksMode)
418415{
419  CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::UnitTypes::Unknown;
 416 CSSPrimitiveValue::UnitTypes expect = CSSPrimitiveValue::UnitTypes::CSS_UNKNOWN;
420417
421418 if (length >= 4 && characters[0] == '#')
422419 return Color::parseHexColor(characters + 1, length - 1, rgb);

@@static bool fastParseColorInternal(RGBA3
471468 return false;
472469}
473470
474 CSSValue* CSSParserFastPaths::parseColor(const String& string, CSSParserMode parserMode)
 471RefPtr<CSSValue> CSSParserFastPaths::parseColor(const String& string, CSSParserMode parserMode)
475472{
476473 ASSERT(!string.isEmpty());
477474 CSSValueID valueID = cssValueKeywordID(string);

@@CSSValue* CSSParserFastPaths::parseColor
492489 parseResult = fastParseColorInternal(color, string.characters16(), string.length(), quirksMode);
493490 if (!parseResult)
494491 return nullptr;
495  return CSSColorValue::create(color);
 492 return CSSValuePool::singleton().createColorValue(color);;
496493}
497494
498495bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId, CSSValueID valueID, CSSParserMode parserMode)

@@bool CSSParserFastPaths::isValidKeywordP
537534 return valueID == CSSValueNonzero || valueID == CSSValueEvenodd;
538535 case CSSPropertyColorInterpolation:
539536 case CSSPropertyColorInterpolationFilters:
540  return valueID == CSSValueAuto || valueID == CSSValueSRGB || valueID == CSSValueLinearRGB;
 537 return valueID == CSSValueAuto || valueID == CSSValueSrgb || valueID == CSSValueLinearrgb;
541538 case CSSPropertyColorRendering:
542  return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueOptimizeQuality;
 539 return valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || valueID == CSSValueOptimizequality;
543540 case CSSPropertyDirection: // ltr | rtl
544541 return valueID == CSSValueLtr || valueID == CSSValueRtl;
545542 case CSSPropertyDisplay:

@@bool CSSParserFastPaths::isValidKeywordP
548545 // table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none
549546 // flex | inline-flex | -webkit-flex | -webkit-inline-flex | grid | inline-grid
550547 return (valueID >= CSSValueInline && valueID <= CSSValueInlineFlex) || valueID == CSSValueWebkitFlex || valueID == CSSValueWebkitInlineFlex || valueID == CSSValueNone
551  || (RuntimeEnabledFeatures::cssGridLayoutEnabled() && (valueID == CSSValueGrid || valueID == CSSValueInlineGrid));
 548#if ENABLE(CSS_GRID_LAYOUT)
 549 || (RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled() && (valueID == CSSValueGrid || valueID == CSSValueInlineGrid))
 550#endif
 551 ;
552552 case CSSPropertyDominantBaseline:
553553 // auto | use-script | no-change | reset-size | ideographic |
554554 // alphabetic | hanging | mathematical | central | middle |

@@bool CSSParserFastPaths::isValidKeywordP
566566 return valueID == CSSValueNormal || (valueID >= CSSValueUltraCondensed && valueID <= CSSValueUltraExpanded);
567567 case CSSPropertyImageRendering: // auto | optimizeContrast | pixelated
568568 return valueID == CSSValueAuto || valueID == CSSValueWebkitOptimizeContrast || valueID == CSSValuePixelated;
 569#if ENABLE(CSS_COMPOSITING)
569570 case CSSPropertyIsolation: // auto | isolate
570571 return valueID == CSSValueAuto || valueID == CSSValueIsolate;
 572#endif
571573 case CSSPropertyListStylePosition: // inside | outside
572574 return valueID == CSSValueInside || valueID == CSSValueOutside;
573575 case CSSPropertyListStyleType:

@@bool CSSParserFastPaths::isValidKeywordP
580582 return valueID == CSSValueFill || valueID == CSSValueContain || valueID == CSSValueCover || valueID == CSSValueNone || valueID == CSSValueScaleDown;
581583 case CSSPropertyOutlineStyle: // (<border-style> except hidden) | auto
582584 return valueID == CSSValueAuto || valueID == CSSValueNone || (valueID >= CSSValueInset && valueID <= CSSValueDouble);
583  case CSSPropertyOverflowAnchor:
584  return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAuto;
 585 // FIXME-NEWPARSER: Support?
 586 // case CSSPropertyOverflowAnchor:
 587 // return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAuto;
585588 case CSSPropertyOverflowWrap: // normal | break-word
586589 case CSSPropertyWordWrap:
587590 return valueID == CSSValueNormal || valueID == CSSValueBreakWord;

@@bool CSSParserFastPaths::isValidKeywordP
597600 case CSSPropertyPointerEvents:
598601 // none | visiblePainted | visibleFill | visibleStroke | visible |
599602 // painted | fill | stroke | auto | all | bounding-box
600  return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAll || valueID == CSSValueAuto || (valueID >= CSSValueVisiblePainted && valueID <= CSSValueBoundingBox);
 603 return valueID == CSSValueVisible || valueID == CSSValueNone || valueID == CSSValueAll || valueID == CSSValueAuto || (valueID >= CSSValueVisiblepainted && valueID <= CSSValueStroke);
601604 case CSSPropertyPosition: // static | relative | absolute | fixed | sticky
602  return valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed || (RuntimeEnabledFeatures::cssStickyPositionEnabled() && valueID == CSSValueSticky);
 605 return valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed || valueID == CSSValueWebkitSticky;
603606 case CSSPropertyResize: // none | both | horizontal | vertical | auto
604607 return valueID == CSSValueNone || valueID == CSSValueBoth || valueID == CSSValueHorizontal || valueID == CSSValueVertical || valueID == CSSValueAuto;
605  case CSSPropertyScrollBehavior: // auto | smooth
606  ASSERT(RuntimeEnabledFeatures::cssomSmoothScrollEnabled());
607  return valueID == CSSValueAuto || valueID == CSSValueSmooth;
 608 // FIXME-NEWPARSER: Investigate this property.
 609 // case CSSPropertyScrollBehavior: // auto | smooth
 610 // ASSERT(RuntimeEnabledFeatures::cssomSmoothScrollEnabled());
 611 // return valueID == CSSValueAuto || valueID == CSSValueSmooth;
608612 case CSSPropertyShapeRendering:
609  return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueCrispEdges || valueID == CSSValueGeometricPrecision;
 613 return valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || valueID == CSSValueCrispEdges || valueID == CSSValueGeometricprecision;
610614 case CSSPropertySpeak: // none | normal | spell-out | digits | literal-punctuation | no-punctuation
611615 return valueID == CSSValueNone || valueID == CSSValueNormal || valueID == CSSValueSpellOut || valueID == CSSValueDigits || valueID == CSSValueLiteralPunctuation || valueID == CSSValueNoPunctuation;
612616 case CSSPropertyStrokeLinejoin:

@@bool CSSParserFastPaths::isValidKeywordP
616620 case CSSPropertyTableLayout: // auto | fixed
617621 return valueID == CSSValueAuto || valueID == CSSValueFixed;
618622 case CSSPropertyTextAlign:
619  return (valueID >= CSSValueWebkitAuto && valueID <= CSSValueInternalCenter) || valueID == CSSValueStart || valueID == CSSValueEnd;
620  case CSSPropertyTextAlignLast:
 623 return (valueID >= CSSValueWebkitAuto && valueID <= CSSValueWebkitMatchParent) || valueID == CSSValueStart || valueID == CSSValueEnd;
 624#if ENABLE(CSS3_TEXT)
 625 case CSSPropertyWebkitTextAlignLast:
621626 // auto | start | end | left | right | center | justify
622627 return (valueID >= CSSValueLeft && valueID <= CSSValueJustify) || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueAuto;
 628#endif
623629 case CSSPropertyTextAnchor:
624630 return valueID == CSSValueStart || valueID == CSSValueMiddle || valueID == CSSValueEnd;
625  case CSSPropertyTextCombineUpright:
626  return valueID == CSSValueNone || valueID == CSSValueAll;
627  case CSSPropertyTextDecorationStyle:
 631// FIXME-NEWPARSER: Support
 632// case CSSPropertyTextCombineUpright:
 633// return valueID == CSSValueNone || valueID == CSSValueAll;
 634 case CSSPropertyWebkitTextDecorationStyle:
628635 // solid | double | dotted | dashed | wavy
629  ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
630636 return valueID == CSSValueSolid || valueID == CSSValueDouble || valueID == CSSValueDotted || valueID == CSSValueDashed || valueID == CSSValueWavy;
631  case CSSPropertyTextJustify:
 637#if ENABLE(CSS3_TEXT)
 638 case CSSPropertyWebkitTextJustify:
632639 // auto | none | inter-word | distribute
633640 ASSERT(RuntimeEnabledFeatures::css3TextEnabled());
634641 return valueID == CSSValueInterWord || valueID == CSSValueDistribute || valueID == CSSValueAuto || valueID == CSSValueNone;
635  case CSSPropertyTextOrientation: // mixed | upright | sideways | sideways-right
 642#endif
 643 case CSSPropertyWebkitTextOrientation: // mixed | upright | sideways | sideways-right
636644 return valueID == CSSValueMixed || valueID == CSSValueUpright || valueID == CSSValueSideways || valueID == CSSValueSidewaysRight;
637  case CSSPropertyWebkitTextOrientation:
638  return valueID == CSSValueSideways || valueID == CSSValueSidewaysRight || valueID == CSSValueVerticalRight || valueID == CSSValueUpright;
639645 case CSSPropertyTextOverflow: // clip | ellipsis
640646 return valueID == CSSValueClip || valueID == CSSValueEllipsis;
641647 case CSSPropertyTextRendering: // auto | optimizeSpeed | optimizeLegibility | geometricPrecision
642  return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueOptimizeLegibility || valueID == CSSValueGeometricPrecision;
 648 return valueID == CSSValueAuto || valueID == CSSValueOptimizespeed || valueID == CSSValueOptimizelegibility || valueID == CSSValueGeometricprecision;
643649 case CSSPropertyTextTransform: // capitalize | uppercase | lowercase | none
644650 return (valueID >= CSSValueCapitalize && valueID <= CSSValueLowercase) || valueID == CSSValueNone;
645651 case CSSPropertyUnicodeBidi:
646652 return valueID == CSSValueNormal || valueID == CSSValueEmbed
647653 || valueID == CSSValueBidiOverride || valueID == CSSValueWebkitIsolate
648654 || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext
649  || valueID == CSSValueIsolate || valueID == CSSValueIsolateOverride || valueID == CSSValuePlaintext;
 655 || valueID == CSSValueIsolate || valueID == CSSValueWebkitIsolateOverride || valueID == CSSValueWebkitPlaintext;
650656 case CSSPropertyVectorEffect:
651657 return valueID == CSSValueNone || valueID == CSSValueNonScalingStroke;
652658 case CSSPropertyVisibility: // visible | hidden | collapse
653659 return valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueCollapse;
654660 case CSSPropertyWebkitAppearance:
655661 return (valueID >= CSSValueCheckbox && valueID <= CSSValueTextarea) || valueID == CSSValueNone;
656  case CSSPropertyBackfaceVisibility:
 662 case CSSPropertyWebkitBackfaceVisibility:
657663 return valueID == CSSValueVisible || valueID == CSSValueHidden;
 664#if ENABLE(CSS_COMPOSITING)
658665 case CSSPropertyMixBlendMode:
659666 return valueID == CSSValueNormal || valueID == CSSValueMultiply || valueID == CSSValueScreen || valueID == CSSValueOverlay
660667 || valueID == CSSValueDarken || valueID == CSSValueLighten || valueID == CSSValueColorDodge || valueID == CSSValueColorBurn
661668 || valueID == CSSValueHardLight || valueID == CSSValueSoftLight || valueID == CSSValueDifference || valueID == CSSValueExclusion
662669 || valueID == CSSValueHue || valueID == CSSValueSaturation || valueID == CSSValueColor || valueID == CSSValueLuminosity;
 670#endif
663671 case CSSPropertyWebkitBoxAlign:
664672 return valueID == CSSValueStretch || valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline;
665673 case CSSPropertyWebkitBoxDecorationBreak:

@@bool CSSParserFastPaths::isValidKeywordP
687695 return valueID == CSSValueRow || valueID == CSSValueRowReverse || valueID == CSSValueColumn || valueID == CSSValueColumnReverse;
688696 case CSSPropertyFlexWrap:
689697 return valueID == CSSValueNowrap || valueID == CSSValueWrap || valueID == CSSValueWrapReverse;
690  case CSSPropertyHyphens:
 698 case CSSPropertyWebkitHyphens:
691699 return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueManual;
692700 case CSSPropertyJustifyContent:
693701 // FIXME: Per CSS alignment, this property should accept an optional <overflow-position>. We should share this parsing code with 'justify-self'.
694702 return valueID == CSSValueFlexStart || valueID == CSSValueFlexEnd || valueID == CSSValueCenter || valueID == CSSValueSpaceBetween || valueID == CSSValueSpaceAround;
695  case CSSPropertyFontKerning:
 703 case CSSPropertyWebkitFontKerning:
696704 return valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone;
697705 case CSSPropertyWebkitFontSmoothing:
698706 return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueAntialiased || valueID == CSSValueSubpixelAntialiased;

@@bool CSSParserFastPaths::isValidKeywordP
721729 return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueElement;
722730 case CSSPropertyWebkitUserModify: // read-only | read-write
723731 return valueID == CSSValueReadOnly || valueID == CSSValueReadWrite || valueID == CSSValueReadWritePlaintextOnly;
724  case CSSPropertyUserSelect: // auto | none | text | all
 732 case CSSPropertyWebkitUserSelect: // auto | none | text | all
725733 return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueText || valueID == CSSValueAll;
726734 case CSSPropertyWebkitWritingMode:
727735 return valueID >= CSSValueHorizontalTb && valueID <= CSSValueVerticalLr;

@@bool CSSParserFastPaths::isValidKeywordP
734742 return valueID == CSSValueNormal || valueID == CSSValuePre || valueID == CSSValuePreWrap || valueID == CSSValuePreLine || valueID == CSSValueNowrap;
735743 case CSSPropertyWordBreak: // normal | break-all | keep-all | break-word (this is a custom extension)
736744 return valueID == CSSValueNormal || valueID == CSSValueBreakAll || valueID == CSSValueKeepAll || valueID == CSSValueBreakWord;
737  case CSSPropertyScrollSnapType: // none | mandatory | proximity
738  ASSERT(RuntimeEnabledFeatures::cssScrollSnapPointsEnabled());
739  return valueID == CSSValueNone || valueID == CSSValueMandatory || valueID == CSSValueProximity;
 745#if ENABLE(CSS_SCROLL_SNAP)
 746 case CSSPropertyWebkitScrollSnapType: // none | mandatory | proximity
 747 return valueID == CSSValueNone || valueID == CSSValueMandatory || valueID == CSSValueProximity;
 748#endif
 749#if ENABLE(TOUCH_EVENTS)
 750 case CSSPropertyTouchAction: // auto | manipulation
 751 return valueID == CSSValueAuto || valueID == CSSValueManipulation;
 752#endif
 753#if ENABLE(CSS_TRAILING_WORD)
 754 case CSSPropertyAppleTrailingWord: // auto | -apple-partially-balanced
 755 return valueID == CSSValueAuto || valueID == CSSValueWebkitPartiallyBalanced;
 756#endif
 757#if ENABLE(APPLE_PAY)
 758 case CSSPropertyApplePayButtonStyle: // white | white-outline | black
 759 return valueID == CSSValueWhite || valueID == CSSValueWhiteOutline || valueID == CSSValueBlack;
 760 case CSSPropertyApplePayButtonType: // plain | buy | set-up | in-store
 761 return valueID == CSSValuePlain || valueID == CSSValueBuy || valueID == CSSValueSetUp || valueID == CSSValueInStore;
 762#endif
740763 default:
741764 ASSERT_NOT_REACHED();
742765 return false;
743766 }
744767}
745 */
746768
747769bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId)
748770{

@@bool CSSParserFastPaths::isKeywordProper
941963 }
942964}
943965
944 /* FIXME-NEWPARSER: Turn off for now.
 966static bool isUniversalKeyword(const String& string)
 967{
 968 // These keywords can be used for all properties.
 969 return equalLettersIgnoringASCIICase(string, "initial")
 970 || equalLettersIgnoringASCIICase(string, "inherit")
 971 || equalLettersIgnoringASCIICase(string, "unset")
 972 || equalLettersIgnoringASCIICase(string, "revert");
 973}
945974
946 static CSSValue* parseKeywordValue(CSSPropertyID propertyId, const String& string, CSSParserMode parserMode)
 975static RefPtr<CSSValue> parseKeywordValue(CSSPropertyID propertyId, const String& string, CSSParserMode parserMode)
947976{
948977 ASSERT(!string.isEmpty());
949978
950979 if (!CSSParserFastPaths::isKeywordPropertyID(propertyId)) {
951980 // All properties accept the values of "initial" and "inherit".
952  if (!equalIgnoringASCIICase(string, "initial") && !equalIgnoringASCIICase(string, "inherit"))
 981 if (!isUniversalKeyword(string))
953982 return nullptr;
954983
955984 // Parse initial/inherit shorthands using the CSSPropertyParser.

@@static CSSValue* parseKeywordValue(CSSPr
957986 return nullptr;
958987
959988 // Descriptors do not support css wide keywords.
960  if (CSSPropertyMetadata::isDescriptorOnly(propertyId))
 989 if (CSSProperty::isDescriptorOnly(propertyId))
961990 return nullptr;
962991 }
963992

@@static CSSValue* parseKeywordValue(CSSPr
967996 return nullptr;
968997
969998 if (valueID == CSSValueInherit)
970  return CSSInheritedValue::create();
 999 return CSSValuePool::singleton().createInheritedValue();
9711000 if (valueID == CSSValueInitial)
972  return CSSInitialValue::create();
 1001 return CSSValuePool::singleton().createExplicitInitialValue();
 1002 if (valueID == CSSValueUnset)
 1003 return CSSValuePool::singleton().createUnsetValue();
 1004 if (valueID == CSSValueRevert)
 1005 return CSSValuePool::singleton().createRevertValue();
 1006
9731007 if (CSSParserFastPaths::isValidKeywordPropertyAndValue(propertyId, valueID, parserMode))
9741008 return CSSPrimitiveValue::createIdentifier(valueID);
9751009 return nullptr;

@@static bool parseTransformTranslateArgum
9801014{
9811015 while (expectedCount) {
9821016 size_t delimiter = WTF::find(pos, end - pos, expectedCount == 1 ? ')' : ',');
983  if (delimiter == kNotFound)
 1017 if (delimiter == notFound)
9841018 return false;
9851019 unsigned argumentLength = static_cast<unsigned>(delimiter);
986  CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::Number;
 1020 CSSPrimitiveValue::UnitTypes unit = CSSPrimitiveValue::UnitTypes::CSS_NUMBER;
9871021 double number;
9881022 if (!parseSimpleLength(pos, argumentLength, unit, number))
9891023 return false;
990  if (unit != CSSPrimitiveValue::UnitTypes::Pixels && (number || unit != CSSPrimitiveValue::UnitTypes::Number))
 1024 if (unit != CSSPrimitiveValue::UnitTypes::CSS_PX && (number || unit != CSSPrimitiveValue::UnitTypes::CSS_NUMBER))
9911025 return false;
992  transformValue->append(*CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::Pixels));
 1026 transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::CSS_PX));
9931027 pos += argumentLength + 1;
9941028 --expectedCount;
9951029 }

@@static bool parseTransformNumberArgument
10011035{
10021036 while (expectedCount) {
10031037 size_t delimiter = WTF::find(pos, end - pos, expectedCount == 1 ? ')' : ',');
1004  if (delimiter == kNotFound)
 1038 if (delimiter == notFound)
10051039 return false;
10061040 unsigned argumentLength = static_cast<unsigned>(delimiter);
10071041 bool ok;
10081042 double number = charactersToDouble(pos, argumentLength, &ok);
10091043 if (!ok)
10101044 return false;
1011  transformValue->append(*CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::Number));
 1045 transformValue->append(CSSPrimitiveValue::create(number, CSSPrimitiveValue::UnitTypes::CSS_NUMBER));
10121046 pos += argumentLength + 1;
10131047 --expectedCount;
10141048 }

@@static bool parseTransformNumberArgument
10181052static const int kShortestValidTransformStringLength = 12;
10191053
10201054template <typename CharType>
1021 static CSSFunctionValue* parseSimpleTransformValue(CharType*& pos, CharType* end)
 1055static RefPtr<CSSFunctionValue> parseSimpleTransformValue(CharType*& pos, CharType* end)
10221056{
10231057 if (end - pos < kShortestValidTransformStringLength)
10241058 return nullptr;

@@static CSSFunctionValue* parseSimpleTran
10391073 unsigned argumentStart = 11;
10401074 CharType c9 = toASCIILower(pos[9]);
10411075 if (c9 == 'x' && pos[10] == '(') {
1042  transformType = CSSValueTranslateX;
 1076 transformType = CSSValueTranslatex;
10431077 } else if (c9 == 'y' && pos[10] == '(') {
1044  transformType = CSSValueTranslateY;
 1078 transformType = CSSValueTranslatey;
10451079 } else if (c9 == 'z' && pos[10] == '(') {
1046  transformType = CSSValueTranslateZ;
 1080 transformType = CSSValueTranslatez;
10471081 } else if (c9 == '(') {
10481082 transformType = CSSValueTranslate;
10491083 expectedArgumentCount = 2;

@@static CSSFunctionValue* parseSimpleTran
10561090 return nullptr;
10571091 }
10581092 pos += argumentStart;
1059  CSSFunctionValue* transformValue = CSSFunctionValue::create(transformType);
1060  if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, transformValue))
 1093 RefPtr<CSSFunctionValue> transformValue = CSSFunctionValue::create(transformType);
 1094 if (!parseTransformTranslateArguments(pos, end, expectedArgumentCount, transformValue.get()))
10611095 return nullptr;
10621096 return transformValue;
10631097 }

@@static CSSFunctionValue* parseSimpleTran
10741108
10751109 if (isMatrix3d) {
10761110 pos += 9;
1077  CSSFunctionValue* transformValue = CSSFunctionValue::create(CSSValueMatrix3d);
1078  if (!parseTransformNumberArguments(pos, end, 16, transformValue))
 1111 RefPtr<CSSFunctionValue> transformValue = CSSFunctionValue::create(CSSValueMatrix3d);
 1112 if (!parseTransformNumberArguments(pos, end, 16, transformValue.get()))
10791113 return nullptr;
10801114 return transformValue;
10811115 }

@@static CSSFunctionValue* parseSimpleTran
10911125
10921126 if (isScale3d) {
10931127 pos += 8;
1094  CSSFunctionValue* transformValue = CSSFunctionValue::create(CSSValueScale3d);
1095  if (!parseTransformNumberArguments(pos, end, 3, transformValue))
 1128 RefPtr<CSSFunctionValue> transformValue = CSSFunctionValue::create(CSSValueScale3d);
 1129 if (!parseTransformNumberArguments(pos, end, 3, transformValue.get()))
10961130 return nullptr;
10971131 return transformValue;
10981132 }

@@static bool transformCanLikelyUseFastPat
11391173 return false;
11401174 }
11411175 size_t argumentsEnd = WTF::find(chars, length, ')', i);
1142  if (argumentsEnd == kNotFound)
 1176 if (argumentsEnd == notFound)
11431177 return false;
11441178 // Advance to the end of the arguments.
11451179 i = argumentsEnd + 1;

@@static bool transformCanLikelyUseFastPat
11481182}
11491183
11501184template <typename CharType>
1151 static CSSValueList* parseSimpleTransformList(const CharType* chars, unsigned length)
 1185static RefPtr<CSSValueList> parseSimpleTransformList(const CharType* chars, unsigned length)
11521186{
11531187 if (!transformCanLikelyUseFastPath(chars, length))
11541188 return nullptr;
11551189 const CharType*& pos = chars;
11561190 const CharType* end = chars + length;
1157  CSSValueList* transformList = nullptr;
 1191 RefPtr<CSSValueList> transformList;
11581192 while (pos < end) {
11591193 while (pos < end && isCSSSpace(*pos))
11601194 ++pos;
11611195 if (pos >= end)
11621196 break;
1163  CSSFunctionValue* transformValue = parseSimpleTransformValue(pos, end);
 1197 RefPtr<CSSFunctionValue> transformValue = parseSimpleTransformValue(pos, end);
11641198 if (!transformValue)
11651199 return nullptr;
11661200 if (!transformList)

@@static CSSValueList* parseSimpleTransfor
11701204 return transformList;
11711205}
11721206
1173 static CSSValue* parseSimpleTransform(CSSPropertyID propertyID, const String& string)
 1207static RefPtr<CSSValue> parseSimpleTransform(CSSPropertyID propertyID, const String& string)
11741208{
11751209 ASSERT(!string.isEmpty());
11761210

@@static CSSValue* parseSimpleTransform(CS
11811215 return parseSimpleTransformList(string.characters16(), string.length());
11821216}
11831217
1184 CSSValue* CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
 1218RefPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode)
11851219{
1186  if (CSSValue* length = parseSimpleLengthValue(propertyID, string, parserMode))
1187  return length;
 1220 RefPtr<CSSValue> result = parseSimpleLengthValue(propertyID, string, parserMode);
 1221 if (result)
 1222 return result;
11881223 if (isColorPropertyID(propertyID))
11891224 return parseColor(string, parserMode);
1190  if (CSSValue* keyword = parseKeywordValue(propertyID, string, parserMode))
1191  return keyword;
1192  if (CSSValue* transform = parseSimpleTransform(propertyID, string))
1193  return transform;
 1225 result = parseKeywordValue(propertyID, string, parserMode);
 1226 if (result)
 1227 return result;
 1228 result = parseSimpleTransform(propertyID, string);
 1229 if (result)
 1230 return result;
11941231 return nullptr;
11951232}
11961233
1197  */
11981234} // namespace WebCore
205990

Source/WebCore/css/parser/CSSParserFastPaths.h

@@class CSSParserFastPaths {
4343public:
4444 // Parses simple values like '10px' or 'green', but makes no guarantees
4545 // about handling any property completely.
46  static CSSValue* maybeParseValue(CSSPropertyID, const String&, CSSParserMode);
 46 static RefPtr<CSSValue> maybeParseValue(CSSPropertyID, const String&, CSSParserMode);
4747
4848 // Properties handled here shouldn't be explicitly handled in CSSPropertyParser
4949 static bool isKeywordPropertyID(CSSPropertyID);
5050 static bool isValidKeywordPropertyAndValue(CSSPropertyID, CSSValueID, CSSParserMode);
5151
52  static CSSValue* parseColor(const String&, CSSParserMode);
 52 static RefPtr<CSSValue> parseColor(const String&, CSSParserMode);
5353};
5454
5555} // namespace WebCore
205990

Source/WebCore/css/parser/CSSParserIdioms.cpp

2929
3030#include "config.h"
3131#include "CSSParserIdioms.h"
 32#include "CSSValueKeywords.h"
3233
3334namespace WebCore {
3435

@@void convertToASCIILowercaseInPlace(Stri
4849 WebCore::convertToASCIILowercaseInPlace(const_cast<UChar*>(stringView.characters16()), stringView.length());
4950}
5051
 52bool isValueAllowedInMode(unsigned short id, CSSParserMode mode)
 53{
 54 switch (id) {
 55 case CSSValueInternalVariableValue:
 56 return isUASheetBehavior(mode);
 57 case CSSValueWebkitFocusRingColor:
 58 return isUASheetBehavior(mode) || isQuirksModeBehavior(mode);
 59 default:
 60 return true;
 61 }
 62}
 63
5164} // namespace WebCore
205990

Source/WebCore/css/parser/CSSParserIdioms.h

3232#ifndef CSSParserIdioms_h
3333#define CSSParserIdioms_h
3434
 35#include "CSSParserMode.h"
3536#include <wtf/ASCIICType.h>
3637#include <wtf/text/StringView.h>
3738
3839namespace WebCore {
39 
 40
4041// Space characters as defined by the CSS specification.
4142// http://www.w3.org/TR/css3-syntax/#whitespace
4243inline bool isCSSSpace(UChar c)

@@bool isNameCodePoint(CharacterType c)
6061
6162void convertToASCIILowercaseInPlace(StringView&);
6263
 64bool isValueAllowedInMode(unsigned short, CSSParserMode);
 65
6366}
6467
6568#endif
205990