Changeset 207903 in webkit
- Timestamp:
- Oct 26, 2016 10:44:12 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r207901 r207903 1270 1270 css/CSSCursorImageValue.cpp 1271 1271 css/CSSCustomIdentValue.cpp 1272 css/CSSCustomPropertyDeclaration.cpp1273 1272 css/CSSDefaultStyleSheets.cpp 1274 1273 css/CSSFilterImageValue.cpp -
trunk/Source/WebCore/ChangeLog
r207901 r207903 1 2016-10-26 Dave Hyatt <hyatt@apple.com> 2 3 [CSS Parser] Unify CSSCustomPropertyValue and CSSCustomPropertyDeclaration 4 https://bugs.webkit.org/show_bug.cgi?id=164019 5 6 Reviewed by Zalan Bujtas. 7 8 * CMakeLists.txt: 9 * WebCore.xcodeproj/project.pbxproj: 10 * css/CSSCustomPropertyDeclaration.cpp: Removed. 11 * css/CSSCustomPropertyDeclaration.h: Removed. 12 Get rid of CSSCustomPropertyDeclaration. 13 14 * css/CSSCustomPropertyValue.h: 15 Add new constructors to handle the new variable data format (either a CSSValueId or a 16 CSSVariableData object that holds parser tokens). 17 18 * css/CSSValue.cpp: 19 (WebCore::CSSValue::cssText): 20 (WebCore::CSSValue::destroy): 21 * css/CSSValue.h: 22 (WebCore::CSSValue::isCustomPropertyDeclaration): Deleted. 23 Get rid of CSSCustomPropertyDeclaration cases. 24 25 * css/CSSVariableData.h: 26 Switch to CSSCustomPropertyValue. 27 28 * css/StyleResolver.cpp: 29 (WebCore::StyleResolver::applyProperty): 30 We've renamed the old parser variable data to deprecatedValue to make it clear it's going 31 to be removed eventually. 32 33 * css/parser/CSSParserImpl.cpp: 34 (WebCore::filterProperties): 35 (WebCore::CSSParserImpl::consumeVariableValue): 36 * css/parser/CSSVariableParser.cpp: 37 (WebCore::CSSVariableParser::parseDeclarationValue): 38 * css/parser/CSSVariableParser.h: 39 Switch to CSSCustomPropertyValue. 40 1 41 2016-10-26 Youenn Fablet <youenn@apple.com> 2 42 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r207901 r207903 3422 3422 9444CBE31D8861980073A074 /* CSSCustomIdentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */; }; 3423 3423 9444CBE41D8861990073A074 /* CSSCustomIdentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */; }; 3424 9444CBE51D8861990073A074 /* CSSCustomPropertyDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */; };3425 9444CBE61D8861990073A074 /* CSSCustomPropertyDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */; };3426 3424 9444CBE71D8861C20073A074 /* CSSVariableData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */; }; 3427 3425 9444CBE81D8861C20073A074 /* CSSVariableData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9444CBDD1D8861580073A074 /* CSSVariableData.h */; }; … … 9437 9435 574AC7531DAC367D00E9744C /* CryptoAlgorithmParameters.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CryptoAlgorithmParameters.idl; sourceTree = "<group>"; }; 9438 9436 574D42791D594FF6002CF50E /* GlobalCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GlobalCrypto.idl; sourceTree = "<group>"; }; 9439 5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSRsaHashedKeyGenParams.h;path = JSRsaHashedKeyGenParams.h; sourceTree = "<group>"; };9440 5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSRsaHashedKeyGenParams.cpp;path = JSRsaHashedKeyGenParams.cpp; sourceTree = "<group>"; };9437 5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaHashedKeyGenParams.h; sourceTree = "<group>"; }; 9438 5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRsaHashedKeyGenParams.cpp; sourceTree = "<group>"; }; 9441 9439 577483101DADC49900716EF9 /* AesKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesKeyGenParams.idl; sourceTree = "<group>"; }; 9442 9440 577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesKeyGenParams.h; sourceTree = "<group>"; }; … … 10815 10813 9444CBDD1D8861580073A074 /* CSSVariableData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableData.h; sourceTree = "<group>"; }; 10816 10814 9444CBDE1D8861580073A074 /* CSSVariableData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableData.cpp; sourceTree = "<group>"; }; 10817 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomPropertyDeclaration.h; sourceTree = "<group>"; };10818 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCustomPropertyDeclaration.cpp; sourceTree = "<group>"; };10819 10815 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomIdentValue.h; sourceTree = "<group>"; }; 10820 10816 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCustomIdentValue.cpp; sourceTree = "<group>"; }; … … 22864 22860 9444CBE21D8861580073A074 /* CSSCustomIdentValue.cpp */, 22865 22861 9444CBE11D8861580073A074 /* CSSCustomIdentValue.h */, 22866 9444CBE01D8861580073A074 /* CSSCustomPropertyDeclaration.cpp */,22867 9444CBDF1D8861580073A074 /* CSSCustomPropertyDeclaration.h */,22868 22862 BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */, 22869 22863 4A9CC81516BB9AC600EC645A /* CSSDefaultStyleSheets.cpp */, … … 24707 24701 AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */, 24708 24702 9444CBE41D8861990073A074 /* CSSCustomIdentValue.h in Headers */, 24709 9444CBE61D8861990073A074 /* CSSCustomPropertyDeclaration.h in Headers */,24710 24703 BC779E141BB215BB00CAA8BF /* CSSCustomPropertyValue.h in Headers */, 24711 24704 4A9CC81816BB9AC600EC645A /* CSSDefaultStyleSheets.h in Headers */, … … 28482 28475 AA21ECCA0ABF0FBA002B834C /* CSSCursorImageValue.cpp in Sources */, 28483 28476 9444CBE31D8861980073A074 /* CSSCustomIdentValue.cpp in Sources */, 28484 9444CBE51D8861990073A074 /* CSSCustomPropertyDeclaration.cpp in Sources */,28485 28477 4A9CC81716BB9AC600EC645A /* CSSDefaultStyleSheets.cpp in Sources */, 28486 28478 FBB0C5B717BBD626003D3677 /* CSSFilterImageValue.cpp in Sources */, -
trunk/Source/WebCore/css/CSSCustomPropertyValue.h
r205869 r207903 28 28 29 29 #include "CSSValue.h" 30 #include "CSSVariableData.h" 30 31 #include <wtf/RefPtr.h> 31 32 #include <wtf/text/WTFString.h> 32 33 33 // FIXME-NEWPARSER: This will be removed in favor of CSSCustomPropertyDeclaration34 34 namespace WebCore { 35 35 … … 39 39 { 40 40 return adoptRef(*new CSSCustomPropertyValue(name, WTFMove(value))); 41 } 42 43 static Ref<CSSCustomPropertyValue> createWithVariableData(const AtomicString& name, Ref<CSSVariableData>&& value) 44 { 45 return adoptRef(*new CSSCustomPropertyValue(name, WTFMove(value))); 46 } 47 48 static Ref<CSSCustomPropertyValue> createWithID(const AtomicString& name, CSSValueID value) 49 { 50 return adoptRef(*new CSSCustomPropertyValue(name, value)); 41 51 } 42 52 … … 50 60 if (!m_serialized) { 51 61 m_serialized = true; 52 m_stringValue = m_value ? m_value->cssText() : emptyString(); 62 if (m_deprecatedValue) 63 m_stringValue = m_deprecatedValue->cssText(); 64 else if (m_value) 65 m_stringValue = m_value->tokenRange().serialize(); 66 else if (m_valueId != CSSValueInvalid) 67 m_stringValue = getValueName(m_valueId); 68 else 69 m_stringValue = emptyString(); 53 70 } 54 71 return m_stringValue; … … 57 74 const AtomicString& name() const { return m_name; } 58 75 59 // FIXME: Should arguably implement equals on all of the CSSParserValues, but CSSValue equivalence 60 // is rarely used, so serialization to compare is probably fine. 76 // FIXME: Should arguably implement equals on our internal values, but serialization to compare is probably fine. 61 77 bool equals(const CSSCustomPropertyValue& other) const { return m_name == other.m_name && customCSSText() == other.customCSSText(); } 62 78 … … 64 80 bool containsVariables() const { return m_containsVariables; } 65 81 66 const RefPtr<CSSValue> value() const { return m_value.get(); }82 const RefPtr<CSSValue> deprecatedValue() const { return m_deprecatedValue.get(); } 67 83 68 84 private: … … 70 86 : CSSValue(CustomPropertyClass) 71 87 , m_name(name) 72 , m_ value(WTFMove(value))73 , m_containsVariables(m_ value->isVariableDependentValue())88 , m_deprecatedValue(WTFMove(value)) 89 , m_containsVariables(m_deprecatedValue->isVariableDependentValue()) 74 90 , m_serialized(false) 75 91 { … … 84 100 } 85 101 102 CSSCustomPropertyValue(const AtomicString& name, CSSValueID id) 103 : CSSValue(CustomPropertyClass) 104 , m_name(name) 105 , m_valueId(id) 106 { 107 ASSERT(id == CSSValueInherit || id == CSSValueInitial || id == CSSValueUnset || id == CSSValueRevert); 108 } 109 110 CSSCustomPropertyValue(const AtomicString& name, Ref<CSSVariableData>&& value) 111 : CSSValue(CustomPropertyClass) 112 , m_name(name) 113 , m_value(WTFMove(value)) 114 , m_valueId(CSSValueInternalVariableValue) 115 , m_containsVariables(m_value->needsVariableResolution()) 116 { 117 } 118 86 119 const AtomicString m_name; 87 RefPtr<CSSValue> m_value; 120 121 RefPtr<CSSValue> m_deprecatedValue; // Used by old parser 122 RefPtr<CSSVariableData> m_value; // Used by new parser. 123 CSSValueID m_valueId { CSSValueInvalid }; // Used by new parser. 124 88 125 mutable String m_stringValue; 89 126 bool m_containsVariables { false }; -
trunk/Source/WebCore/css/CSSValue.cpp
r207479 r207903 38 38 #include "CSSCursorImageValue.h" 39 39 #include "CSSCustomIdentValue.h" 40 #include "CSSCustomPropertyDeclaration.h"41 40 #include "CSSCustomPropertyValue.h" 42 41 #include "CSSFilterImageValue.h" … … 361 360 case VariableClass: 362 361 return downcast<CSSVariableValue>(*this).customCSSText(); 363 case CustomPropertyDeclarationClass:364 return downcast<CSSCustomPropertyDeclaration>(*this).customCSSText();365 362 case CustomIdentClass: 366 363 return downcast<CSSCustomIdentValue>(*this).customCSSText(); … … 516 513 case VariableClass: 517 514 delete downcast<CSSVariableValue>(this); 518 return;519 case CustomPropertyDeclarationClass:520 delete downcast<CSSCustomPropertyDeclaration>(this);521 515 return; 522 516 case CustomIdentClass: -
trunk/Source/WebCore/css/CSSValue.h
r207479 r207903 127 127 #endif 128 128 129 bool isCustomPropertyDeclaration() const { return m_classType == CustomPropertyDeclarationClass; }130 129 bool isCustomIdentValue() const { return m_classType == CustomIdentClass; } 131 130 bool isVariableReferenceValue() const { return m_classType == VariableReferenceClass; } … … 203 202 CSSContentDistributionClass, 204 203 205 // FIXME-NEWPARSER: Remove in favor of new variables implementation. 204 CustomIdentClass, 205 206 // FIXME-NEWPARSER: Unify variables implementation. 206 207 CustomPropertyClass, 207 208 VariableDependentClass, … … 209 210 210 211 // New variables implementation. 211 CustomPropertyDeclarationClass,212 CustomIdentClass,213 212 VariableReferenceClass, 214 213 PendingSubstitutionValueClass, -
trunk/Source/WebCore/css/CSSVariableData.h
r205869 r207903 64 64 65 65 // We can safely copy the tokens (which have raw pointers to substrings) because 66 // StylePropertySets contain references to CSSCustomProperty Declarations, which66 // StylePropertySets contain references to CSSCustomPropertyValues, which 67 67 // point to the unresolved CSSVariableData values that own the backing strings 68 68 // this will potentially reference. -
trunk/Source/WebCore/css/StyleResolver.cpp
r207757 r207903 1608 1608 if (id == CSSPropertyCustom) { 1609 1609 customPropertyValue = &downcast<CSSCustomPropertyValue>(*valueToApply); 1610 valueToCheckForInheritInitial = customPropertyValue-> value().get();1610 valueToCheckForInheritInitial = customPropertyValue->deprecatedValue().get(); 1611 1611 } 1612 1612 … … 1674 1674 state.style()->setCustomPropertyValue(customProperty->name(), CSSCustomPropertyValue::createInvalid()); 1675 1675 else 1676 state.style()->setCustomPropertyValue(customProperty->name(), customProperty-> value());1676 state.style()->setCustomPropertyValue(customProperty->name(), customProperty->deprecatedValue()); 1677 1677 return; 1678 1678 } -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r207677 r207903 32 32 33 33 #include "CSSAtRuleID.h" 34 #include "CSSCustomProperty Declaration.h"34 #include "CSSCustomPropertyValue.h" 35 35 #include "CSSKeyframeRule.h" 36 36 #include "CSSKeyframesRule.h" … … 98 98 99 99 if (property.id() == CSSPropertyCustom) { 100 CSSCustomProperty Declaration* customValue = downcast<CSSCustomPropertyDeclaration>(property.value());100 CSSCustomPropertyValue* customValue = downcast<CSSCustomPropertyValue>(property.value()); 101 101 const AtomicString& name = customValue->name(); 102 102 if (seenCustomProperties.contains(name)) … … 828 828 void CSSParserImpl::consumeVariableValue(CSSParserTokenRange range, const AtomicString& variableName, bool important) 829 829 { 830 if (RefPtr<CSSCustomProperty Declaration> value = CSSVariableParser::parseDeclarationValue(variableName, range))830 if (RefPtr<CSSCustomPropertyValue> value = CSSVariableParser::parseDeclarationValue(variableName, range)) 831 831 m_parsedProperties.append(CSSProperty(CSSPropertyCustom, WTFMove(value), important)); 832 832 } -
trunk/Source/WebCore/css/parser/CSSVariableParser.cpp
r205869 r207903 31 31 #include "CSSVariableParser.h" 32 32 33 #include "CSSCustomProperty Declaration.h"33 #include "CSSCustomPropertyValue.h" 34 34 #include "CSSParserTokenRange.h" 35 35 … … 148 148 } 149 149 150 RefPtr<CSSCustomProperty Declaration> CSSVariableParser::parseDeclarationValue(const AtomicString& variableName, CSSParserTokenRange range)150 RefPtr<CSSCustomPropertyValue> CSSVariableParser::parseDeclarationValue(const AtomicString& variableName, CSSParserTokenRange range) 151 151 { 152 152 if (range.atEnd()) … … 160 160 return nullptr; 161 161 if (type == CSSValueInternalVariableValue) 162 return CSSCustomProperty Declaration::create(variableName, CSSVariableData::create(range, hasReferences || hasAtApplyRule));163 return CSSCustomProperty Declaration::create(variableName, type);162 return CSSCustomPropertyValue::createWithVariableData(variableName, CSSVariableData::create(range, hasReferences || hasAtApplyRule)); 163 return CSSCustomPropertyValue::createWithID(variableName, type); 164 164 } 165 165 -
trunk/Source/WebCore/css/parser/CSSVariableParser.h
r205869 r207903 36 36 namespace WebCore { 37 37 38 class CSSCustomProperty Declaration;38 class CSSCustomPropertyValue; 39 39 40 40 class CSSVariableParser { … … 42 42 static bool containsValidVariableReferences(CSSParserTokenRange); 43 43 44 static RefPtr<CSSCustomProperty Declaration> parseDeclarationValue(const AtomicString&, CSSParserTokenRange);44 static RefPtr<CSSCustomPropertyValue> parseDeclarationValue(const AtomicString&, CSSParserTokenRange); 45 45 46 46 static bool isValidVariableName(const CSSParserToken&); -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r207814 r207903 2067 2067 // hold the final values. This way when we inherit, we don't end up resubstituting variables, etc. 2068 2068 for (auto& resolvedValue : resolvedValues) 2069 customProperties.set(resolvedValue->name(), resolvedValue-> value());2069 customProperties.set(resolvedValue->name(), resolvedValue->deprecatedValue()); 2070 2070 2071 2071 rareInheritedData.access()->m_customProperties.access()->setContainsVariables(false);
Note: See TracChangeset
for help on using the changeset viewer.