Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (205868 => 205869)
--- trunk/Source/WebCore/CMakeLists.txt 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-09-13 19:08:30 UTC (rev 205869)
@@ -1253,6 +1253,8 @@
css/CSSContentDistributionValue.cpp
css/CSSCrossfadeValue.cpp
css/CSSCursorImageValue.cpp
+ css/CSSCustomIdentValue.cpp
+ css/CSSCustomPropertyDeclaration.cpp
css/CSSDefaultStyleSheets.cpp
css/CSSFilterImageValue.cpp
css/FontFaceSet.cpp
@@ -1307,7 +1309,9 @@
css/CSSValue.cpp
css/CSSValueList.cpp
css/CSSValuePool.cpp
+ css/CSSVariableData.cpp
css/CSSVariableDependentValue.cpp
+ css/CSSVariableReferenceValue.cpp
css/CSSVariableValue.cpp
css/DOMCSSNamespace.cpp
css/DocumentRuleSets.cpp
@@ -1364,6 +1368,7 @@
css/parser/CSSSupportsParser.cpp
css/parser/CSSTokenizer.cpp
css/parser/CSSTokenizerInputStream.cpp
+ css/parser/CSSVariableParser.cpp
css/parser/MediaQueryBlockWatcher.cpp
css/parser/MediaQueryParser.cpp
css/parser/SizesAttributeParser.cpp
Modified: trunk/Source/WebCore/ChangeLog (205868 => 205869)
--- trunk/Source/WebCore/ChangeLog 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/ChangeLog 2016-09-13 19:08:30 UTC (rev 205869)
@@ -1,3 +1,79 @@
+2016-09-13 Dave Hyatt <[email protected]>
+
+ [CSS Parser] Add CSS Variable Parsing support
+ https://bugs.webkit.org/show_bug.cgi?id=161916
+
+ Reviewed by Dean Jackson.
+
+ This patch not only adds the parser for CSS variables (from Blink), but it also brings in
+ all of the data structures used to store variables and custom property declarations. We
+ will be abandoning our old data structures eventually in favor of these new ones. They
+ are not significantly different other than operating on the CSSParserTokenRanges rather
+ than the soon-to-be-removed parser value lists.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSCustomIdentValue.cpp: Added.
+ (WebCore::CSSCustomIdentValue::CSSCustomIdentValue):
+ (WebCore::CSSCustomIdentValue::customCSSText):
+ * css/CSSCustomIdentValue.h: Added.
+ (WebCore::CSSCustomIdentValue::create):
+ (WebCore::CSSCustomIdentValue::value):
+ (WebCore::CSSCustomIdentValue::isKnownPropertyID):
+ (WebCore::CSSCustomIdentValue::valueAsPropertyID):
+ (WebCore::CSSCustomIdentValue::equals):
+ * css/CSSCustomPropertyDeclaration.cpp: Added.
+ (WebCore::CSSCustomPropertyDeclaration::customCSSText):
+ * css/CSSCustomPropertyDeclaration.h: Added.
+ (WebCore::CSSCustomPropertyDeclaration::create):
+ (WebCore::CSSCustomPropertyDeclaration::name):
+ (WebCore::CSSCustomPropertyDeclaration::value):
+ (WebCore::CSSCustomPropertyDeclaration::id):
+ (WebCore::CSSCustomPropertyDeclaration::equals):
+ (WebCore::CSSCustomPropertyDeclaration::CSSCustomPropertyDeclaration):
+ * css/CSSCustomPropertyValue.h:
+ * css/CSSValue.cpp:
+ (WebCore::CSSValue::cssText):
+ (WebCore::CSSValue::destroy):
+ * css/CSSValue.h:
+ (WebCore::CSSValue::isCustomPropertyDeclaration):
+ (WebCore::CSSValue::isCustomIdentValue):
+ (WebCore::CSSValue::isVariableReferenceValue):
+ * css/CSSValueKeywords.in:
+ * css/CSSVariableData.cpp: Added.
+ (WebCore::CSSVariableData::updateTokens):
+ (WebCore::CSSVariableData::operator==):
+ (WebCore::CSSVariableData::consumeAndUpdateTokens):
+ (WebCore::CSSVariableData::CSSVariableData):
+ * css/CSSVariableData.h: Added.
+ (WebCore::CSSVariableData::create):
+ (WebCore::CSSVariableData::createResolved):
+ (WebCore::CSSVariableData::tokenRange):
+ (WebCore::CSSVariableData::tokens):
+ (WebCore::CSSVariableData::needsVariableResolution):
+ (WebCore::CSSVariableData::CSSVariableData):
+ * css/CSSVariableDependentValue.h:
+ * css/CSSVariableReferenceValue.cpp: Added.
+ (WebCore::CSSVariableReferenceValue::customCSSText):
+ * css/CSSVariableReferenceValue.h: Added.
+ (WebCore::CSSVariableReferenceValue::create):
+ (WebCore::CSSVariableReferenceValue::variableDataValue):
+ (WebCore::CSSVariableReferenceValue::equals):
+ (WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
+ * css/CSSVariableValue.h:
+ * css/parser/CSSParserImpl.cpp:
+ (WebCore::filterProperties):
+ (WebCore::CSSParserImpl::consumeDeclaration):
+ (WebCore::CSSParserImpl::consumeVariableValue):
+ * css/parser/CSSVariableParser.cpp: Added.
+ (WebCore::CSSVariableParser::isValidVariableName):
+ (WebCore::classifyBlock):
+ (WebCore::isValidVariableReference):
+ (WebCore::classifyVariableRange):
+ (WebCore::CSSVariableParser::containsValidVariableReferences):
+ (WebCore::CSSVariableParser::parseDeclarationValue):
+ * css/parser/CSSVariableParser.h: Added.
+
2016-09-13 Daniel Bates <[email protected]>
Remove CSS keyword properties from CSSParser::parseValue(CSSPropertyID, bool)
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (205868 => 205869)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-09-13 19:08:30 UTC (rev 205869)
@@ -3347,6 +3347,16 @@
9444CBD41D860C8B0073A074 /* SizesCalcParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBCF1D860C740073A074 /* SizesCalcParser.h */; };
9444CBD51D860C8B0073A074 /* SizesAttributeParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBD21D860C740073A074 /* SizesAttributeParser.cpp */; };
9444CBD61D860C8B0073A074 /* SizesAttributeParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBD11D860C740073A074 /* SizesAttributeParser.h */; };
+ 9444CBD91D88483A0073A074 /* CSSVariableParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBD81D88482A0073A074 /* CSSVariableParser.cpp */; };
+ 9444CBDA1D88483A0073A074 /* CSSVariableParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBD71D88482A0073A074 /* CSSVariableParser.h */; };
+ 9444CBE31D8861980073A074 /* CSSCustomIdentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */; };
+ 9444CBE41D8861990073A074 /* CSSCustomIdentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */; };
+ 9444CBE51D8861990073A074 /* CSSCustomPropertyDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */; };
+ 9444CBE61D8861990073A074 /* CSSCustomPropertyDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */; };
+ 9444CBE71D8861C20073A074 /* CSSVariableData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */; };
+ 9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDD1D8861580073A074 /* CSSVariableData.h */; };
+ 9444CBE91D8861CA0073A074 /* CSSVariableReferenceValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBDC1D8861580073A074 /* CSSVariableReferenceValue.cpp */; };
+ 9444CBEA1D8861CA0073A074 /* CSSVariableReferenceValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDB1D8861580073A074 /* CSSVariableReferenceValue.h */; };
946D372D1D6CB2940077084F /* CSSParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 946D37281D6CB28B0077084F /* CSSParser.cpp */; };
946D372E1D6CB2940077084F /* CSSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D37291D6CB28B0077084F /* CSSParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
946D372F1D6CB2940077084F /* CSSParserMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 946D372A1D6CB28B0077084F /* CSSParserMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10509,6 +10519,16 @@
9444CBD01D860C740073A074 /* SizesCalcParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SizesCalcParser.cpp; path = parser/SizesCalcParser.cpp; sourceTree = "<group>"; };
9444CBD11D860C740073A074 /* SizesAttributeParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SizesAttributeParser.h; path = parser/SizesAttributeParser.h; sourceTree = "<group>"; };
9444CBD21D860C740073A074 /* SizesAttributeParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SizesAttributeParser.cpp; path = parser/SizesAttributeParser.cpp; sourceTree = "<group>"; };
+ 9444CBD71D88482A0073A074 /* CSSVariableParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSVariableParser.h; path = parser/CSSVariableParser.h; sourceTree = "<group>"; };
+ 9444CBD81D88482A0073A074 /* CSSVariableParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSVariableParser.cpp; path = parser/CSSVariableParser.cpp; sourceTree = "<group>"; };
+ 9444CBDB1D8861580073A074 /* CSSVariableReferenceValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableReferenceValue.h; sourceTree = "<group>"; };
+ 9444CBDC1D8861580073A074 /* CSSVariableReferenceValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableReferenceValue.cpp; sourceTree = "<group>"; };
+ 9444CBDD1D8861580073A074 /* CSSVariableData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableData.h; sourceTree = "<group>"; };
+ 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableData.cpp; sourceTree = "<group>"; };
+ 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomPropertyDeclaration.h; sourceTree = "<group>"; };
+ 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCustomPropertyDeclaration.cpp; sourceTree = "<group>"; };
+ 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomIdentValue.h; sourceTree = "<group>"; };
+ 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCustomIdentValue.cpp; sourceTree = "<group>"; };
946D37281D6CB28B0077084F /* CSSParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParser.cpp; path = parser/CSSParser.cpp; sourceTree = "<group>"; };
946D37291D6CB28B0077084F /* CSSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParser.h; path = parser/CSSParser.h; sourceTree = "<group>"; };
946D372A1D6CB28B0077084F /* CSSParserMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserMode.h; path = parser/CSSParserMode.h; sourceTree = "<group>"; };
@@ -18216,6 +18236,8 @@
946D37371D6CDF980077084F /* CSSTokenizer.h */,
946D37351D6CDF980077084F /* CSSTokenizerInputStream.cpp */,
946D37381D6CDF980077084F /* CSSTokenizerInputStream.h */,
+ 9444CBD81D88482A0073A074 /* CSSVariableParser.cpp */,
+ 9444CBD71D88482A0073A074 /* CSSVariableParser.h */,
9493B6B61D74B3950088E780 /* MediaQueryBlockWatcher.cpp */,
9493B6B71D74B3950088E780 /* MediaQueryBlockWatcher.h */,
9493B6B81D74B3950088E780 /* MediaQueryParser.cpp */,
@@ -22321,6 +22343,10 @@
2D8FEBDB143E3EF70072502B /* CSSCrossfadeValue.h */,
AA0978ED0ABAA6E100874480 /* CSSCursorImageValue.cpp */,
AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */,
+ 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */,
+ 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */,
+ 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */,
+ 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */,
BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */,
4A9CC81516BB9AC600EC645A /* CSSDefaultStyleSheets.cpp */,
4A9CC81616BB9AC600EC645A /* CSSDefaultStyleSheets.h */,
@@ -22453,8 +22479,12 @@
A8D0651C0A23C1FE005E7203 /* CSSValueList.idl */,
E49BDA0A131FD3E5003C56F0 /* CSSValuePool.cpp */,
E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */,
+ 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */,
+ 9444CBDD1D8861580073A074 /* CSSVariableData.h */,
BC1790BC1BBB36A80006D13E /* CSSVariableDependentValue.cpp */,
BC1790BA1BB5AB3F0006D13E /* CSSVariableDependentValue.h */,
+ 9444CBDC1D8861580073A074 /* CSSVariableReferenceValue.cpp */,
+ 9444CBDB1D8861580073A074 /* CSSVariableReferenceValue.h */,
BC1790BE1BBF2C430006D13E /* CSSVariableValue.cpp */,
BC1790BF1BBF2C430006D13E /* CSSVariableValue.h */,
A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */,
@@ -24371,6 +24401,7 @@
93309DE4099E64920056E581 /* EditCommand.h in Headers */,
4F1534DE11B532EC0021FD86 /* EditingBehavior.h in Headers */,
4F1534E011B533020021FD86 /* EditingBehaviorTypes.h in Headers */,
+ 9444CBE41D8861990073A074 /* CSSCustomIdentValue.h in Headers */,
3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */,
9BAB6C6C12550631001626D4 /* EditingStyle.h in Headers */,
4B3043CD0AE0373B00A82647 /* Editor.h in Headers */,
@@ -25358,6 +25389,7 @@
B2FA3DC30AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothAbs.h in Headers */,
B2FA3DC50AB75A6F000E5AC4 /* JSSVGPathSegCurvetoCubicSmoothRel.h in Headers */,
B2FA3DC70AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticAbs.h in Headers */,
+ 9444CBDA1D88483A0073A074 /* CSSVariableParser.h in Headers */,
B2FA3DC90AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticRel.h in Headers */,
B2FA3DCB0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothAbs.h in Headers */,
B2FA3DCD0AB75A6F000E5AC4 /* JSSVGPathSegCurvetoQuadraticSmoothRel.h in Headers */,
@@ -25934,6 +25966,7 @@
31D591B316697A6C00E6BF02 /* PlugInClient.h in Headers */,
A9C6E4F40D745E48006442E9 /* PluginData.h in Headers */,
97205ABC1239292700B17380 /* PluginDocument.h in Headers */,
+ 9444CBEA1D8861CA0073A074 /* CSSVariableReferenceValue.h in Headers */,
1A08FEDD1D592B8B008BA8CB /* PluginInfoProvider.h in Headers */,
072AE1E5183C0741000A5988 /* PluginReplacement.h in Headers */,
71E2183A17359FB8006E6E4D /* PlugInsResources.h in Headers */,
@@ -26143,6 +26176,7 @@
6ED878C5147493F4004C3597 /* RenderTableCaption.h in Headers */,
A8DF4AE90980C42C0052981B /* RenderTableCell.h in Headers */,
A8DF4AF10980C42C0052981B /* RenderTableCol.h in Headers */,
+ 9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */,
A8DF4AEE0980C42C0052981B /* RenderTableRow.h in Headers */,
A8DF4AEF0980C42C0052981B /* RenderTableSection.h in Headers */,
BCEA488C097D93020094C9E4 /* RenderText.h in Headers */,
@@ -26744,6 +26778,7 @@
08C7136E128956A3001B107E /* SVGTransformListPropertyTearOff.h in Headers */,
B2227AE20D00BF220071B782 /* SVGTRefElement.h in Headers */,
B2227AE50D00BF220071B782 /* SVGTSpanElement.h in Headers */,
+ 9444CBE61D8861990073A074 /* CSSCustomPropertyDeclaration.h in Headers */,
B2227AE70D00BF220071B782 /* SVGUnitTypes.h in Headers */,
B2227AEA0D00BF220071B782 /* SVGURIReference.h in Headers */,
B2227AED0D00BF220071B782 /* SVGUseElement.h in Headers */,
@@ -28113,6 +28148,7 @@
976D6C80122B8A3D001FD1F7 /* File.cpp in Sources */,
934FE9E50B5CA539003E4A73 /* FileChooser.cpp in Sources */,
978D07B6145A0F030096908D /* FileException.cpp in Sources */,
+ 9444CBE91D8861CA0073A074 /* CSSVariableReferenceValue.cpp in Sources */,
1A88A90417553CD7000C74F9 /* FileIconLoader.cpp in Sources */,
F55B3DBD1251F12D003EF269 /* FileInputType.cpp in Sources */,
976D6C85122B8A3D001FD1F7 /* FileList.cpp in Sources */,
@@ -28674,6 +28710,7 @@
7728698314FD9ADA00F484DC /* JSEXTTextureFilterAnisotropic.cpp in Sources */,
7F4C96DC1AD4483500365A50 /* JSFetchBody.cpp in Sources */,
7D4C96DC1AD4483500365A50 /* JSFetchHeaders.cpp in Sources */,
+ 9444CBD91D88483A0073A074 /* CSSVariableParser.cpp in Sources */,
7E4C96DC1AD4483500365A50 /* JSFetchRequest.cpp in Sources */,
8E4C96DC1AD4483500365A50 /* JSFetchResponse.cpp in Sources */,
BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */,
@@ -28748,6 +28785,7 @@
A80E7E980A1A83E3007FB8C5 /* JSHTMLInputElement.cpp in Sources */,
BCC438780E886CC700533DD5 /* JSHTMLInputElementCustom.cpp in Sources */,
A6148A7812E41E3B0044A784 /* JSHTMLKeygenElement.cpp in Sources */,
+ 9444CBE71D8861C20073A074 /* CSSVariableData.cpp in Sources */,
1AE2AB210A1CE63B00B42B25 /* JSHTMLLabelElement.cpp in Sources */,
1AE2AB230A1CE63B00B42B25 /* JSHTMLLegendElement.cpp in Sources */,
1AE2AB250A1CE63B00B42B25 /* JSHTMLLIElement.cpp in Sources */,
@@ -29516,6 +29554,7 @@
A7197F2617568AE5007B9442 /* PageThrottler.cpp in Sources */,
E1284AEA10447DEE00EAEB52 /* PageTransitionEvent.cpp in Sources */,
51E1ECC20C91C90400DC255B /* PageURLRecord.cpp in Sources */,
+ 9444CBE31D8861980073A074 /* CSSCustomIdentValue.cpp in Sources */,
FFD5B97A135CC97800D5E92A /* PageVisibilityState.cpp in Sources */,
FD3160A212B026F700C1A359 /* Panner.cpp in Sources */,
FD31601912B0267600C1A359 /* PannerNode.cpp in Sources */,
@@ -29698,6 +29737,7 @@
8AC822FC180FC03300FB64D5 /* RenderNamedFlowFragment.cpp in Sources */,
1A3FF9C315265359002288A1 /* RenderNamedFlowThread.cpp in Sources */,
BCEA487F097D93020094C9E4 /* RenderObject.cpp in Sources */,
+ 9444CBE51D8861990073A074 /* CSSCustomPropertyDeclaration.cpp in Sources */,
A43BF59C1149292800C643CA /* RenderProgress.cpp in Sources */,
5A574F24131DB93900471B88 /* RenderQuote.cpp in Sources */,
D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */,
Added: trunk/Source/WebCore/css/CSSCustomIdentValue.cpp (0 => 205869)
--- trunk/Source/WebCore/css/CSSCustomIdentValue.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSCustomIdentValue.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSCustomIdentValue.h"
+
+#include "CSSMarkup.h"
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+CSSCustomIdentValue::CSSCustomIdentValue(const String& str)
+ : CSSValue(CustomIdentClass)
+ , m_string(str)
+ , m_propertyId(CSSPropertyInvalid) { }
+
+CSSCustomIdentValue::CSSCustomIdentValue(CSSPropertyID id)
+ : CSSValue(CustomIdentClass)
+ , m_string()
+ , m_propertyId(id)
+{
+ ASSERT(isKnownPropertyID());
+}
+
+
+String CSSCustomIdentValue::customCSSText() const
+{
+ if (isKnownPropertyID())
+ return getPropertyNameAtomicString(m_propertyId);
+ StringBuilder builder;
+ serializeIdentifier(m_string, builder);
+ return builder.toString();
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSCustomIdentValue.h (0 => 205869)
--- trunk/Source/WebCore/css/CSSCustomIdentValue.h (rev 0)
+++ trunk/Source/WebCore/css/CSSCustomIdentValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,72 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSPropertyNames.h"
+#include "CSSValue.h"
+
+namespace WebCore {
+
+class CSSCustomIdentValue : public CSSValue {
+public:
+ static Ref<CSSCustomIdentValue> create(const String& str)
+ {
+ return adoptRef(*new CSSCustomIdentValue(str));
+ }
+
+ // FIXME: Remove this and lazily parse the CSSPropertyID in isKnownPropertyID().
+ static Ref<CSSCustomIdentValue> create(CSSPropertyID id)
+ {
+ return adoptRef(*new CSSCustomIdentValue(id));
+ }
+
+ String value() const { ASSERT(!isKnownPropertyID()); return m_string; }
+ bool isKnownPropertyID() const { return m_propertyId != CSSPropertyInvalid; }
+ CSSPropertyID valueAsPropertyID() const { ASSERT(isKnownPropertyID()); return m_propertyId; }
+
+ String customCSSText() const;
+
+ bool equals(const CSSCustomIdentValue& other) const
+ {
+ return isKnownPropertyID() ? m_propertyId == other.m_propertyId : m_string == other.m_string;
+ }
+
+private:
+ CSSCustomIdentValue(const String&);
+ CSSCustomIdentValue(CSSPropertyID);
+
+ // FIXME: Change this to an AtomicString.
+ String m_string;
+ CSSPropertyID m_propertyId;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSCustomIdentValue, isCustomIdentValue())
Added: trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.cpp (0 => 205869)
--- trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSCustomPropertyDeclaration.h"
+
+#include "CSSParserTokenRange.h"
+
+namespace WebCore {
+
+String CSSCustomPropertyDeclaration::customCSSText() const
+{
+ if (m_value)
+ return m_value->tokenRange().serialize();
+ ASSERT(m_valueId != CSSValueInternalVariableValue);
+ return getValueName(m_valueId);
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.h (0 => 205869)
--- trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.h (rev 0)
+++ trunk/Source/WebCore/css/CSSCustomPropertyDeclaration.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,83 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSValue.h"
+#include "CSSVariableData.h"
+#include <wtf/RefPtr.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class CSSCustomPropertyDeclaration : public CSSValue {
+public:
+ static Ref<CSSCustomPropertyDeclaration> create(const AtomicString& name, Ref<CSSVariableData>&& value)
+ {
+ return adoptRef(*new CSSCustomPropertyDeclaration(name, WTFMove(value)));
+ }
+
+ static Ref<CSSCustomPropertyDeclaration> create(const AtomicString& name, CSSValueID id)
+ {
+ return adoptRef(*new CSSCustomPropertyDeclaration(name, id));
+ }
+
+ const AtomicString& name() const { return m_name; }
+ CSSVariableData* value() const { return m_value.get(); }
+ CSSValueID id() const { return m_valueId; }
+ String customCSSText() const;
+
+ bool equals(const CSSCustomPropertyDeclaration& other) const { return this == &other; }
+
+private:
+ CSSCustomPropertyDeclaration(const AtomicString& name, CSSValueID id)
+ : CSSValue(CustomPropertyDeclarationClass)
+ , m_name(name)
+ , m_value(nullptr)
+ , m_valueId(id)
+ {
+ ASSERT(id == CSSValueInherit || id == CSSValueInitial || id == CSSValueUnset || id == CSSValueRevert);
+ }
+
+ CSSCustomPropertyDeclaration(const AtomicString& name, Ref<CSSVariableData>&& value)
+ : CSSValue(CustomPropertyDeclarationClass)
+ , m_name(name)
+ , m_value(WTFMove(value))
+ , m_valueId(CSSValueInternalVariableValue)
+ {
+ }
+
+ const AtomicString m_name;
+ RefPtr<CSSVariableData> m_value;
+ CSSValueID m_valueId;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSCustomPropertyDeclaration, isCustomPropertyDeclaration())
Modified: trunk/Source/WebCore/css/CSSCustomPropertyValue.h (205868 => 205869)
--- trunk/Source/WebCore/css/CSSCustomPropertyValue.h 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSCustomPropertyValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -30,6 +30,7 @@
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
+// FIXME-NEWPARSER: This will be removed in favor of CSSCustomPropertyDeclaration
namespace WebCore {
class CSSCustomPropertyValue final : public CSSValue {
Modified: trunk/Source/WebCore/css/CSSValue.cpp (205868 => 205869)
--- trunk/Source/WebCore/css/CSSValue.cpp 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSValue.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -36,6 +36,8 @@
#include "CSSContentDistributionValue.h"
#include "CSSCrossfadeValue.h"
#include "CSSCursorImageValue.h"
+#include "CSSCustomIdentValue.h"
+#include "CSSCustomPropertyDeclaration.h"
#include "CSSCustomPropertyValue.h"
#include "CSSFilterImageValue.h"
#include "CSSFontFaceSrcValue.h"
@@ -58,6 +60,7 @@
#include "CSSUnsetValue.h"
#include "CSSValueList.h"
#include "CSSVariableDependentValue.h"
+#include "CSSVariableReferenceValue.h"
#include "CSSVariableValue.h"
#include "SVGColor.h"
#include "SVGPaint.h"
@@ -362,6 +365,12 @@
return downcast<CSSVariableDependentValue>(*this).customCSSText();
case VariableClass:
return downcast<CSSVariableValue>(*this).customCSSText();
+ case CustomPropertyDeclarationClass:
+ return downcast<CSSCustomPropertyDeclaration>(*this).customCSSText();
+ case CustomIdentClass:
+ return downcast<CSSCustomIdentValue>(*this).customCSSText();
+ case VariableReferenceClass:
+ return downcast<CSSVariableReferenceValue>(*this).customCSSText();
}
ASSERT_NOT_REACHED();
@@ -505,6 +514,15 @@
case VariableClass:
delete downcast<CSSVariableValue>(this);
return;
+ case CustomPropertyDeclarationClass:
+ delete downcast<CSSCustomPropertyDeclaration>(this);
+ return;
+ case CustomIdentClass:
+ delete downcast<CSSCustomIdentValue>(this);
+ return;
+ case VariableReferenceClass:
+ delete downcast<CSSVariableReferenceValue>(this);
+ return;
}
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebCore/css/CSSValue.h (205868 => 205869)
--- trunk/Source/WebCore/css/CSSValue.h 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -123,6 +123,10 @@
bool isAnimationTriggerScrollValue() const { return m_classType == AnimationTriggerScrollClass; }
#endif
+ bool isCustomPropertyDeclaration() const { return m_classType == CustomPropertyDeclarationClass; }
+ bool isCustomIdentValue() const { return m_classType == CustomIdentClass; }
+ bool isVariableReferenceValue() const { return m_classType == VariableReferenceClass; }
+
bool isCSSOMSafe() const { return m_isCSSOMSafe; }
bool isSubtypeExposedToCSSOM() const
{
@@ -192,10 +196,17 @@
#endif
CSSContentDistributionClass,
+
+ // FIXME-NEWPARSER: Remove in favor of new variables implementation.
CustomPropertyClass,
VariableDependentClass,
VariableClass,
+ // New variables implementation.
+ CustomPropertyDeclarationClass,
+ CustomIdentClass,
+ VariableReferenceClass,
+
// List class types must appear after ValueListClass.
ValueListClass,
ImageSetClass,
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (205868 => 205869)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2016-09-13 19:08:30 UTC (rev 205869)
@@ -833,6 +833,12 @@
padding-box
//
+// Variables Implementation
+//
+var
+-internal-variable-value
+
+//
// CSS_PROP_BREAK_BEFORE/AFTER/INSIDE
//
avoid-column
Added: trunk/Source/WebCore/css/CSSVariableData.cpp (0 => 205869)
--- trunk/Source/WebCore/css/CSSVariableData.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSVariableData.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,84 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSVariableData.h"
+
+#include "CSSParser.h"
+#include "CSSParserTokenRange.h"
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringView.h>
+
+namespace WebCore {
+
+template<typename CharacterType> void CSSVariableData::updateTokens(const CSSParserTokenRange& range)
+{
+ const CharacterType* currentOffset = m_backingString.characters<CharacterType>();
+ for (const CSSParserToken& token : range) {
+ if (token.hasStringBacking()) {
+ unsigned length = token.value().length();
+ StringView string(currentOffset, length);
+ m_tokens.append(token.copyWithUpdatedString(string));
+ currentOffset += length;
+ } else
+ m_tokens.append(token);
+ }
+ ASSERT(currentOffset == m_backingString.characters<CharacterType>() + m_backingString.length());
+}
+
+bool CSSVariableData::operator==(const CSSVariableData& other) const
+{
+ return tokens() == other.tokens();
+}
+
+void CSSVariableData::consumeAndUpdateTokens(const CSSParserTokenRange& range)
+{
+ StringBuilder stringBuilder;
+ CSSParserTokenRange localRange = range;
+
+ while (!localRange.atEnd()) {
+ CSSParserToken token = localRange.consume();
+ if (token.hasStringBacking())
+ stringBuilder.append(token.value());
+ }
+ m_backingString = stringBuilder.toString();
+ if (m_backingString.is8Bit())
+ updateTokens<LChar>(range);
+ else
+ updateTokens<UChar>(range);
+}
+
+CSSVariableData::CSSVariableData(const CSSParserTokenRange& range, bool needsVariableResolution)
+ : m_needsVariableResolution(needsVariableResolution)
+{
+ ASSERT(!range.atEnd());
+ consumeAndUpdateTokens(range);
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSVariableData.h (0 => 205869)
--- trunk/Source/WebCore/css/CSSVariableData.h (rev 0)
+++ trunk/Source/WebCore/css/CSSVariableData.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,85 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSParserToken.h"
+#include "CSSParserTokenRange.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSParserTokenRange;
+
+class CSSVariableData : public RefCounted<CSSVariableData> {
+ WTF_MAKE_NONCOPYABLE(CSSVariableData);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static Ref<CSSVariableData> create(const CSSParserTokenRange& range, bool needsVariableResolution = true)
+ {
+ return adoptRef(*new CSSVariableData(range, needsVariableResolution));
+ }
+
+ static Ref<CSSVariableData> createResolved(const Vector<CSSParserToken>& resolvedTokens, const CSSVariableData& unresolvedData)
+ {
+ return adoptRef(*new CSSVariableData(resolvedTokens, unresolvedData.m_backingString));
+ }
+
+ CSSParserTokenRange tokenRange() { return m_tokens; }
+
+ const Vector<CSSParserToken>& tokens() const { return m_tokens; }
+
+ bool operator==(const CSSVariableData& other) const;
+
+ bool needsVariableResolution() const { return m_needsVariableResolution; }
+
+private:
+ CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution);
+
+ // We can safely copy the tokens (which have raw pointers to substrings) because
+ // StylePropertySets contain references to CSSCustomPropertyDeclarations, which
+ // point to the unresolved CSSVariableData values that own the backing strings
+ // this will potentially reference.
+ CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backingString)
+ : m_backingString(backingString)
+ , m_tokens(resolvedTokens)
+ , m_needsVariableResolution(false)
+ { }
+
+ void consumeAndUpdateTokens(const CSSParserTokenRange&);
+ template<typename CharacterType> void updateTokens(const CSSParserTokenRange&);
+
+ String m_backingString;
+ Vector<CSSParserToken> m_tokens;
+ const bool m_needsVariableResolution;
+
+ // FIXME-NEWPARSER: We want to cache StyleProperties once we support @apply.
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/css/CSSVariableDependentValue.h (205868 => 205869)
--- trunk/Source/WebCore/css/CSSVariableDependentValue.h 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSVariableDependentValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -30,6 +30,7 @@
#include "CSSValueList.h"
#include <wtf/RefPtr.h>
+// FIXME-NEWPARSER: This will be removed in favor of CSSVariableReferenceValue
namespace WebCore {
class CSSVariableDependentValue final : public CSSValue {
Added: trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp (0 => 205869)
--- trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp (rev 0)
+++ trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSVariableReferenceValue.h"
+
+namespace WebCore {
+
+String CSSVariableReferenceValue::customCSSText() const
+{
+ // We may want to consider caching this value.
+ return m_data->tokenRange().serialize();
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/CSSVariableReferenceValue.h (0 => 205869)
--- trunk/Source/WebCore/css/CSSVariableReferenceValue.h (rev 0)
+++ trunk/Source/WebCore/css/CSSVariableReferenceValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,65 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSValue.h"
+#include "CSSVariableData.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class CSSVariableReferenceValue : public CSSValue {
+public:
+ static Ref<CSSVariableReferenceValue> create(Ref<CSSVariableData>&& data)
+ {
+ return adoptRef(*new CSSVariableReferenceValue(WTFMove(data)));
+ }
+
+ CSSVariableData* variableDataValue() const
+ {
+ return m_data.get();
+ }
+
+ bool equals(const CSSVariableReferenceValue& other) const { return m_data == other.m_data; }
+ String customCSSText() const;
+
+private:
+ CSSVariableReferenceValue(Ref<CSSVariableData>&& data)
+ : CSSValue(VariableReferenceClass)
+ , m_data(WTFMove(data))
+ {
+ }
+
+ RefPtr<CSSVariableData> m_data;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSVariableReferenceValue, isVariableReferenceValue())
Modified: trunk/Source/WebCore/css/CSSVariableValue.h (205868 => 205869)
--- trunk/Source/WebCore/css/CSSVariableValue.h 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/CSSVariableValue.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -28,6 +28,7 @@
#include "CSSValue.h"
+// FIXME-NEWPARSER: This will be removed in favor of the new variables implementation.
namespace WebCore {
class CSSValueList;
Modified: trunk/Source/WebCore/css/parser/CSSAtRuleID.cpp (205868 => 205869)
--- trunk/Source/WebCore/css/parser/CSSAtRuleID.cpp 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/parser/CSSAtRuleID.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -59,5 +59,5 @@
return CSSAtRuleInvalid;
}
-} // namespace blink
+} // namespace WebCore
Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (205868 => 205869)
--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -31,7 +31,7 @@
#include "CSSParserImpl.h"
#include "CSSAtRuleID.h"
-#include "CSSCustomPropertyValue.h"
+#include "CSSCustomPropertyDeclaration.h"
#include "CSSKeyframeRule.h"
#include "CSSKeyframesRule.h"
#include "CSSParserObserver.h"
@@ -42,7 +42,7 @@
#include "CSSStyleSheet.h"
#include "CSSSupportsParser.h"
#include "CSSTokenizer.h"
-// FIXME-NEWPARSER: #include "CSSVariableParser.h"
+#include "CSSVariableParser.h"
#include "Document.h"
#include "Element.h"
#include "MediaQueryParser.h"
@@ -97,12 +97,11 @@
const unsigned propertyIDIndex = property.id() - firstCSSProperty;
if (property.id() == CSSPropertyCustom) {
- if (property.value()) {
- auto& name = downcast<CSSCustomPropertyValue>(*property.value()).name();
- if (!seenCustomProperties.add(name).isNewEntry)
- continue;
- output[--unusedEntries] = property;
- }
+ CSSCustomPropertyDeclaration* customValue = downcast<CSSCustomPropertyDeclaration>(property.value());
+ const AtomicString& name = customValue->name();
+ if (seenCustomProperties.contains(name))
+ continue;
+ seenCustomProperties.add(name);
continue;
}
@@ -779,11 +778,10 @@
}
size_t propertiesCount = m_parsedProperties.size();
- // FIXME-NEWPARSER: Support variables
- /*if (unresolvedProperty == CSSPropertyInvalid && CSSVariableParser::isValidVariableName(token)) {
+ if (unresolvedProperty == CSSPropertyInvalid && CSSVariableParser::isValidVariableName(token)) {
AtomicString variableName = token.value().toAtomicString();
consumeVariableValue(range.makeSubRange(&range.peek(), declarationValueEnd), variableName, important);
- }*/
+ }
if (important && (ruleType == StyleRule::FontFace || ruleType == StyleRule::Keyframe))
return;
@@ -798,11 +796,10 @@
}
}
-void CSSParserImpl::consumeVariableValue(CSSParserTokenRange /* range */, const AtomicString& /*variableName */, bool /* important */)
+void CSSParserImpl::consumeVariableValue(CSSParserTokenRange range, const AtomicString& variableName, bool important)
{
- // FIXME-NEWPARSER: Support variables
- // if (CSSCustomPropertyDeclaration* value = CSSVariableParser::parseDeclarationValue(variableName, range))
- // m_parsedProperties.append(CSSProperty(CSSPropertyVariable, *value, important));
+ if (RefPtr<CSSCustomPropertyDeclaration> value = CSSVariableParser::parseDeclarationValue(variableName, range))
+ m_parsedProperties.append(CSSProperty(CSSPropertyCustom, WTFMove(value), important));
}
void CSSParserImpl::consumeDeclarationValue(CSSParserTokenRange range, CSSPropertyID unresolvedProperty, bool important, StyleRule::Type ruleType)
Modified: trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp (205868 => 205869)
--- trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -768,4 +768,4 @@
return secondCompound;
}
-} // namespace blink
+} // namespace WebCore
Modified: trunk/Source/WebCore/css/parser/CSSSupportsParser.cpp (205868 => 205869)
--- trunk/Source/WebCore/css/parser/CSSSupportsParser.cpp 2016-09-13 19:01:32 UTC (rev 205868)
+++ trunk/Source/WebCore/css/parser/CSSSupportsParser.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -116,4 +116,4 @@
return innerRange.peek().type() == IdentToken && m_parser.supportsDeclaration(innerRange) ? Supported : Unsupported;
}
-} // namespace blink
+} // namespace WebCore
Added: trunk/Source/WebCore/css/parser/CSSVariableParser.cpp (0 => 205869)
--- trunk/Source/WebCore/css/parser/CSSVariableParser.cpp (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSVariableParser.cpp 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,166 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "config.h"
+#include "CSSVariableParser.h"
+
+#include "CSSCustomPropertyDeclaration.h"
+#include "CSSParserTokenRange.h"
+
+namespace WebCore {
+
+bool CSSVariableParser::isValidVariableName(const CSSParserToken& token)
+{
+ if (token.type() != IdentToken)
+ return false;
+
+ StringView value = token.value();
+ return value.length() >= 2 && value[0] == '-' && value[1] == '-';
+}
+
+bool CSSVariableParser::isValidVariableName(const String& string)
+{
+ return string.length() >= 2 && string[0] == '-' && string[1] == '-';
+}
+
+bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule);
+
+static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule, bool isTopLevelBlock = true)
+{
+ while (!range.atEnd()) {
+ if (range.peek().getBlockType() == CSSParserToken::BlockStart) {
+ const CSSParserToken& token = range.peek();
+ CSSParserTokenRange block = range.consumeBlock();
+ if (token.functionId() == CSSValueVar) {
+ if (!isValidVariableReference(block, hasAtApplyRule))
+ return false; // Bail if any references are invalid
+ hasReferences = true;
+ continue;
+ }
+ if (!classifyBlock(block, hasReferences, hasAtApplyRule, false))
+ return false;
+ continue;
+ }
+
+ ASSERT(range.peek().getBlockType() != CSSParserToken::BlockEnd);
+
+ const CSSParserToken& token = range.consume();
+ switch (token.type()) {
+ case AtKeywordToken: {
+ if (equalIgnoringASCIICase(token.value(), "apply")) {
+ range.consumeWhitespace();
+ const CSSParserToken& variableName = range.consumeIncludingWhitespace();
+ if (!CSSVariableParser::isValidVariableName(variableName)
+ || !(range.atEnd() || range.peek().type() == SemicolonToken || range.peek().type() == RightBraceToken))
+ return false;
+ hasAtApplyRule = true;
+ }
+ break;
+ }
+ case DelimiterToken: {
+ if (token.delimiter() == '!' && isTopLevelBlock)
+ return false;
+ break;
+ }
+ case RightParenthesisToken:
+ case RightBraceToken:
+ case RightBracketToken:
+ case BadStringToken:
+ case BadUrlToken:
+ return false;
+ case SemicolonToken:
+ if (isTopLevelBlock)
+ return false;
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+}
+
+bool isValidVariableReference(CSSParserTokenRange range, bool& hasAtApplyRule)
+{
+ range.consumeWhitespace();
+ if (!CSSVariableParser::isValidVariableName(range.consumeIncludingWhitespace()))
+ return false;
+ if (range.atEnd())
+ return true;
+
+ if (range.consume().type() != CommaToken)
+ return false;
+ if (range.atEnd())
+ return false;
+
+ bool hasReferences = false;
+ return classifyBlock(range, hasReferences, hasAtApplyRule);
+}
+
+static CSSValueID classifyVariableRange(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule)
+{
+ hasReferences = false;
+ hasAtApplyRule = false;
+
+ range.consumeWhitespace();
+ if (range.peek().type() == IdentToken) {
+ CSSValueID id = range.consumeIncludingWhitespace().id();
+ if (range.atEnd() && (id == CSSValueInherit || id == CSSValueInitial || id == CSSValueUnset))
+ return id;
+ }
+
+ if (classifyBlock(range, hasReferences, hasAtApplyRule))
+ return CSSValueInternalVariableValue;
+ return CSSValueInvalid;
+}
+
+bool CSSVariableParser::containsValidVariableReferences(CSSParserTokenRange range)
+{
+ bool hasReferences;
+ bool hasAtApplyRule;
+ CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule);
+ return type == CSSValueInternalVariableValue && hasReferences && !hasAtApplyRule;
+}
+
+RefPtr<CSSCustomPropertyDeclaration> CSSVariableParser::parseDeclarationValue(const AtomicString& variableName, CSSParserTokenRange range)
+{
+ if (range.atEnd())
+ return nullptr;
+
+ bool hasReferences;
+ bool hasAtApplyRule;
+ CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule);
+
+ if (type == CSSValueInvalid)
+ return nullptr;
+ if (type == CSSValueInternalVariableValue)
+ return CSSCustomPropertyDeclaration::create(variableName, CSSVariableData::create(range, hasReferences || hasAtApplyRule));
+ return CSSCustomPropertyDeclaration::create(variableName, type);
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/parser/CSSVariableParser.h (0 => 205869)
--- trunk/Source/WebCore/css/parser/CSSVariableParser.h (rev 0)
+++ trunk/Source/WebCore/css/parser/CSSVariableParser.h 2016-09-13 19:08:30 UTC (rev 205869)
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright (C) 2016 Apple Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#pragma once
+
+#include "CSSParserTokenRange.h"
+#include <wtf/RefPtr.h>
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class CSSCustomPropertyDeclaration;
+
+class CSSVariableParser {
+public:
+ static bool containsValidVariableReferences(CSSParserTokenRange);
+
+ static RefPtr<CSSCustomPropertyDeclaration> parseDeclarationValue(const AtomicString&, CSSParserTokenRange);
+
+ static bool isValidVariableName(const CSSParserToken&);
+ static bool isValidVariableName(const String&);
+};
+
+} // namespace WebCore