Changeset 153581 in webkit
- Timestamp:
- Aug 1, 2013, 5:26:44 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r153566 r153581 1 2013-08-01 Alexis Menard <alexis@webkit.org> 2 3 Reduce CSSProperty's StylePropertyMetadata memory footprint by half when used inside a ImmutableStylePropertySet. 4 https://bugs.webkit.org/show_bug.cgi?id=117715 5 6 Reviewed by Andreas Kling. 7 8 Today CSSProperty holds its metadata in the following way : 9 10 -------------------------------------------------------------------------------------------- 11 | m_propertyID : 14 We use 14 bits because CSSPropertyIDs start at 1001. | 12 | m_shorthandID : 14 id of the shorthand this property was set, 0 if not part of a shorthand| 13 | m_important : 1 | 14 | m_implicit : 1 | 15 | m_inherited : 1 | 16 -------------------------------------------------------------------------------------------- 17 18 The proposal to decrease the memory footprint on CSSProperty's metadata 19 only stand when stored inside ImmutableStylePropertySet which uses a custom 20 way to allocate and lay out the StylePropertyMetadata and the CSSValues in 21 memory because the idea behind is that the content will not change. 22 The MutableStylePropertySet uses a regular vector to retrieve, remove 23 and modify the CSSProperties. ImmutableStylePropertySet is used by default 24 when parsing up until someone start to access the CSSOM like 25 div.style which will convert the immutable to a mutable set. It is also good 26 to note that a CSSProperty is created for every single statement inside a block 27 in a stylesheet so we do have quite a bunch around. Another consideration is 28 that the only client to the m_shorthandID is the inspector which uses it 29 to group the longhands into a shorthand drop down list. 30 31 The new proposal is the following one : 32 - Reduce m_propertyID to 10 bits by not starting the CSSPropertyIDs from 33 1001 but rather 0 (or 3 as two are hardcoded CSSPropertyInvalid and CSSPropertyVariable). 34 - Use the fact that we statically know which longhand belong to which shorthand. So 35 we create a static mapping between longhands and shorthands. 36 37 Here is the new layout : 38 ------------------------------------------------------------------------------ 39 | m_propertyID : 10 (up to 1024 properties), we have less than 400 today | 40 | m_isSetFromShorthand : 1 and then use the mapping in StylePropertyShorthand | 41 | m_indexInShorthandsVector : 2 | 42 | m_important : 1 (unchanged) | 43 | m_implicit : 1 (unchanged) | 44 | m_inherited : 1 (unchanged) | 45 ------------------------------------------------------------------------------ 46 47 it was set from using the new code in StylePropertyShorthand. 48 - m_indexInShorthandsVector : 2 bits, unfortunately there are few longhands which belong to multiple 49 shorthands so we need to store which was this longhand was part at parsing time. Notice 50 that it does not store the CSSPropertyID of the matching shorthand but rather its position 51 in the vector of matching shorthands. CSSProperty::m_shorthandID() method make it transparent 52 for call sites and return the actual CSSPropertyID of the shorthand. So far 2 bits seems 53 enough as there is only few longhands with ambiguity and they belong to 3 shorthands. 54 55 Profiling the benchmark with Intel Vtune to find out the performance regression 56 showed that copying uint16_t, so StylePropertyMetadata, is not 57 a fast operation in term of assembly code and has a big penalty on Windows 58 MSVC over unsigned for example. The latter produces a much faster code 59 when using unsigned over uint16_t (45% difference in the benchmark). 60 61 The patch avoid the copies of StylePropertyMetadata when applicable (by using const ref). 62 63 The second part of the fix is avoiding the conversion from an int (enum) to 64 an uint16_t in a tight loop such as StylePropertySet::findPropertyIndex 65 (which is the hotspot of the benchmark). 66 67 On my Windows 7 64 bits Core i5 machine CSSPropertySetterGetter results are : 68 - avg : 2714 runs/s with the patch 69 - avg : 2696 runs/s without the patch 70 71 According to Andreas Kling this patch save up ~1.8Mb on membuster. 72 73 No new tests : refactor, old ones should cover. 74 75 * css/CSSComputedStyleDeclaration.cpp: 76 (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue): 77 * css/CSSParser.cpp: 78 (WebCore::CSSParser::addPropertyWithPrefixingVariant): 79 (WebCore::CSSParser::addProperty): 80 * css/CSSProperty.cpp: 81 (WebCore::StylePropertyMetadata::shorthandID): 82 (WebCore::borderDirections): 83 * css/CSSProperty.h: 84 (WebCore::StylePropertyMetadata::StylePropertyMetadata): Use uint16_t type for bitfields so sizeof() returns 2 bytes. 85 (WebCore::CSSProperty::CSSProperty): 86 (WebCore::CSSProperty::isSetFromShorthand): 87 (WebCore::CSSProperty::shorthandID): 88 * css/StylePropertySet.cpp: 89 (WebCore::ImmutableStylePropertySet::ImmutableStylePropertySet): 90 (WebCore::getIndexInShorthandVectorForPrefixingVariant): 91 (WebCore::MutableStylePropertySet::appendPrefixingVariantProperty): 92 (WebCore::MutableStylePropertySet::setPrefixingVariantProperty): 93 * css/StylePropertySet.h: 94 (WebCore::StylePropertySet::PropertyReference::shorthandID): 95 * css/StylePropertyShorthand.cpp: 96 (WebCore::backgroundShorthand): 97 (WebCore::backgroundPositionShorthand): 98 (WebCore::backgroundRepeatShorthand): 99 (WebCore::borderShorthand): 100 (WebCore::borderAbridgedShorthand): 101 (WebCore::borderBottomShorthand): 102 (WebCore::borderColorShorthand): 103 (WebCore::borderImageShorthand): 104 (WebCore::borderLeftShorthand): 105 (WebCore::borderRadiusShorthand): 106 (WebCore::webkitBorderRadiusShorthand): 107 (WebCore::borderRightShorthand): 108 (WebCore::borderSpacingShorthand): 109 (WebCore::borderStyleShorthand): 110 (WebCore::borderTopShorthand): 111 (WebCore::borderWidthShorthand): 112 (WebCore::listStyleShorthand): 113 (WebCore::fontShorthand): 114 (WebCore::marginShorthand): 115 (WebCore::markerShorthand): 116 (WebCore::outlineShorthand): 117 (WebCore::overflowShorthand): 118 (WebCore::paddingShorthand): 119 (WebCore::transitionShorthand): 120 (WebCore::webkitAnimationShorthand): 121 (WebCore::webkitAnimationShorthandForParsing): 122 (WebCore::webkitBorderAfterShorthand): 123 (WebCore::webkitBorderBeforeShorthand): 124 (WebCore::webkitBorderEndShorthand): 125 (WebCore::webkitBorderStartShorthand): 126 (WebCore::webkitColumnsShorthand): 127 (WebCore::webkitColumnRuleShorthand): 128 (WebCore::webkitFlexFlowShorthand): 129 (WebCore::webkitFlexShorthand): 130 (WebCore::webkitMarginCollapseShorthand): 131 (WebCore::webkitGridColumnShorthand): 132 (WebCore::webkitGridRowShorthand): 133 (WebCore::webkitMarqueeShorthand): 134 (WebCore::webkitMaskShorthand): 135 (WebCore::webkitMaskPositionShorthand): 136 (WebCore::webkitMaskRepeatShorthand): 137 (WebCore::webkitTextEmphasisShorthand): 138 (WebCore::webkitTextStrokeShorthand): 139 (WebCore::webkitTransitionShorthand): 140 (WebCore::webkitTransformOriginShorthand): 141 (WebCore::widthShorthand): 142 (WebCore::heightShorthand): 143 (WebCore::matchingShorthandsForLonghand): 144 (WebCore::indexOfShorthandForLonghand): 145 * css/StylePropertyShorthand.h: 146 (WebCore::StylePropertyShorthand::StylePropertyShorthand): 147 (WebCore::StylePropertyShorthand::id): 148 * css/makeprop.pl: 149 1 150 2013-07-31 Andreas Kling <akling@apple.com> 2 151 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r153347 r153581 3160 3160 3161 3161 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); 3162 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand( propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator))));3163 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand( propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator))));3162 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlashSeperator)))); 3163 list->append(getCSSPropertyValuesForShorthandProperties(StylePropertyShorthand(CSSPropertyBackground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSeperator)))); 3164 3164 return list.release(); 3165 3165 } -
trunk/Source/WebCore/css/CSSParser.cpp
r153399 r153581 1561 1561 if (prefixingVariant == propId) 1562 1562 return; 1563 addProperty(prefixingVariant, val.release(), important, implicit); 1563 1564 if (m_currentShorthand) { 1565 // We can't use ShorthandScope here as we can already be inside one (e.g we are parsing CSSTransition). 1566 m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); 1567 addProperty(prefixingVariant, val.release(), important, implicit); 1568 m_currentShorthand = prefixingVariantForPropertyId(m_currentShorthand); 1569 } else 1570 addProperty(prefixingVariant, val.release(), important, implicit); 1564 1571 } 1565 1572 1566 1573 void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit) 1567 1574 { 1568 m_parsedProperties.append(CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand || implicit)); 1575 #if ENABLE(CSS_VARIABLES) 1576 CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value.get()) : 0; 1577 #endif 1578 // This property doesn't belong to a shorthand or is a CSS variable (which will be resolved later). 1579 if (!m_currentShorthand 1580 #if ENABLE(CSS_VARIABLES) 1581 || (primitiveValue && primitiveValue->isVariableName()) 1582 #endif 1583 ) { 1584 m_parsedProperties.append(CSSProperty(propId, value, important, false, CSSPropertyInvalid, m_implicitShorthand || implicit)); 1585 return; 1586 } 1587 1588 const Vector<const StylePropertyShorthand*> shorthands = matchingShorthandsForLonghand(propId); 1589 // The longhand does not belong to multiple shorthands. 1590 if (shorthands.size() == 1) 1591 m_parsedProperties.append(CSSProperty(propId, value, important, true, CSSPropertyInvalid, m_implicitShorthand || implicit)); 1592 else 1593 m_parsedProperties.append(CSSProperty(propId, value, important, true, indexOfShorthandForLonghand(m_currentShorthand, shorthands), m_implicitShorthand || implicit)); 1569 1594 } 1570 1595 -
trunk/Source/WebCore/css/CSSProperty.cpp
r152479 r153581 41 41 COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), CSSProperty_should_stay_small); 42 42 43 CSSPropertyID StylePropertyMetadata::shorthandID() const 44 { 45 if (!m_isSetFromShorthand) 46 return CSSPropertyInvalid; 47 48 const Vector<const StylePropertyShorthand*> shorthands = matchingShorthandsForLonghand(static_cast<CSSPropertyID>(m_propertyID)); 49 ASSERT(shorthands.size() && m_indexInShorthandsVector >= 0 && m_indexInShorthandsVector < shorthands.size()); 50 return shorthands.at(m_indexInShorthandsVector)->id(); 51 } 52 43 53 void CSSProperty::wrapValueInCommaSeparatedList() 44 54 { … … 168 178 { 169 179 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft }; 170 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, ( properties, WTF_ARRAY_LENGTH(properties)));180 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderDirections, (CSSPropertyBorder, properties, WTF_ARRAY_LENGTH(properties))); 171 181 return borderDirections; 172 182 } -
trunk/Source/WebCore/css/CSSProperty.h
r148921 r153581 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 32 33 namespace WebCore { 33 34 34 unionStylePropertyMetadata {35 StylePropertyMetadata(CSSPropertyID propertyID, CSSPropertyID shorthandID, bool important, bool implicit, bool inherited)35 struct StylePropertyMetadata { 36 StylePropertyMetadata(CSSPropertyID propertyID, bool isSetFromShorthand, int indexInShorthandsVector, bool important, bool implicit, bool inherited) 36 37 : m_propertyID(propertyID) 37 , m_shorthandID(shorthandID) 38 , m_isSetFromShorthand(isSetFromShorthand) 39 , m_indexInShorthandsVector(indexInShorthandsVector) 38 40 , m_important(important) 39 41 , m_implicit(implicit) … … 42 44 } 43 45 44 unsigned m_bits;45 struct { 46 unsigned m_propertyID : 14;47 unsigned m_shorthandID : 14; // If this property was set as part of a shorthand, gives the shorthand.48 unsigned m_important : 1;49 unsigned m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.50 unsigned m_inherited : 1;51 };46 CSSPropertyID shorthandID() const; 47 48 uint16_t m_propertyID : 10; 49 uint16_t m_isSetFromShorthand : 1; 50 uint16_t m_indexInShorthandsVector : 2; // If this property was set as part of an ambiguous shorthand, gives the index in the shorthands vector. 51 uint16_t m_important : 1; 52 uint16_t m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand. 53 uint16_t m_inherited : 1; 52 54 }; 53 55 54 56 class CSSProperty { 55 57 public: 56 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool important = false, CSSPropertyID shorthandID = CSSPropertyInvalid, bool implicit = false)57 : m_metadata(propertyID, shorthandID, important, implicit, isInheritedProperty(propertyID))58 CSSProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> value, bool important = false, bool isSetFromShorthand = false, int indexInShorthandsVector = 0, bool implicit = false) 59 : m_metadata(propertyID, isSetFromShorthand, indexInShorthandsVector, important, implicit, isInheritedProperty(propertyID)) 58 60 , m_value(value) 59 61 { … … 74 76 75 77 CSSPropertyID id() const { return static_cast<CSSPropertyID>(m_metadata.m_propertyID); } 76 CSSPropertyID shorthandID() const { return static_cast<CSSPropertyID>(m_metadata.m_shorthandID); } 78 bool isSetFromShorthand() const { return m_metadata.m_isSetFromShorthand; }; 79 CSSPropertyID shorthandID() const { return m_metadata.shorthandID(); }; 77 80 bool isImportant() const { return m_metadata.m_important; } 78 81 … … 84 87 static bool isInheritedProperty(CSSPropertyID); 85 88 86 StylePropertyMetadatametadata() const { return m_metadata; }89 const StylePropertyMetadata& metadata() const { return m_metadata; } 87 90 88 91 private: -
trunk/Source/WebCore/css/StylePropertySet.cpp
r152935 r153581 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 706 707 } 707 708 709 static unsigned getIndexInShorthandVectorForPrefixingVariant(const CSSProperty& property, CSSPropertyID prefixingVariant) 710 { 711 if (!property.isSetFromShorthand()) 712 return 0; 713 714 CSSPropertyID prefixedShorthand = prefixingVariantForPropertyId(property.shorthandID()); 715 return indexOfShorthandForLonghand(prefixedShorthand, matchingShorthandsForLonghand(prefixingVariant)); 716 } 717 708 718 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property) 709 719 { … … 712 722 if (prefixingVariant == property.id()) 713 723 return; 714 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.shorthandID(), property.metadata().m_implicit)); 724 725 m_propertyVector.append(CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit)); 715 726 } 716 727 … … 719 730 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(property.id()); 720 731 CSSProperty* toReplace = findCSSPropertyWithID(prefixingVariant); 721 if (toReplace )722 *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property. shorthandID(), property.metadata().m_implicit);732 if (toReplace && prefixingVariant != property.id()) 733 *toReplace = CSSProperty(prefixingVariant, property.value(), property.isImportant(), property.isSetFromShorthand(), getIndexInShorthandVectorForPrefixingVariant(property, prefixingVariant), property.metadata().m_implicit); 723 734 } 724 735 … … 1128 1139 int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const 1129 1140 { 1141 // Convert here propertyID into an uint16_t to compare it with the metadata's m_propertyID to avoid 1142 // the compiler converting it to an int multiple times in the loop. 1143 uint16_t id = static_cast<uint16_t>(propertyID); 1130 1144 for (int n = propertyCount() - 1 ; n >= 0; --n) { 1131 if ( propertyID == propertyAt(n).id())1145 if (id == propertyAt(n).propertyMetadata().m_propertyID) 1132 1146 return n; 1133 1147 } -
trunk/Source/WebCore/css/StylePropertySet.h
r152935 r153581 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * Copyright (C) 2004, 2005, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved. 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 60 61 61 62 CSSPropertyID id() const { return static_cast<CSSPropertyID>(propertyMetadata().m_propertyID); } 62 CSSPropertyID shorthandID() const { return static_cast<CSSPropertyID>(propertyMetadata().m_shorthandID); }63 CSSPropertyID shorthandID() const { return propertyMetadata().shorthandID(); } 63 64 64 65 bool isImportant() const { return propertyMetadata().m_important; } … … 75 76 // FIXME: Remove this. 76 77 CSSProperty toCSSProperty() const { return CSSProperty(propertyMetadata(), const_cast<CSSValue*>(propertyValue())); } 78 const StylePropertyMetadata& propertyMetadata() const; 77 79 78 80 private: 79 StylePropertyMetadata propertyMetadata() const;80 81 const CSSValue* propertyValue() const; 81 82 … … 171 172 inline const CSSValue** ImmutableStylePropertySet::valueArray() const 172 173 { 173 return reinterpret_cast<const CSSValue**>(const_cast<const void**>((& static_cast<const ImmutableStylePropertySet*>(this)->m_storage)));174 return reinterpret_cast<const CSSValue**>(const_cast<const void**>((&(this->m_storage)))); 174 175 } 175 176 176 177 inline const StylePropertyMetadata* ImmutableStylePropertySet::metadataArray() const 177 178 { 178 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<const char*>( (&static_cast<const ImmutableStylePropertySet*>(this)->m_storage))[m_arraySize * sizeof(CSSValue*)]);179 return reinterpret_cast<const StylePropertyMetadata*>(&reinterpret_cast<const char*>(&(this->m_storage))[m_arraySize * sizeof(CSSValue*)]); 179 180 } 180 181 … … 235 236 }; 236 237 237 inline StylePropertyMetadataStylePropertySet::PropertyReference::propertyMetadata() const238 inline const StylePropertyMetadata& StylePropertySet::PropertyReference::propertyMetadata() const 238 239 { 239 240 if (m_propertySet.isMutable()) -
trunk/Source/WebCore/css/StylePropertyShorthand.cpp
r149623 r153581 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 22 23 #include "StylePropertyShorthand.h" 23 24 25 #include <wtf/HashMap.h> 24 26 #include <wtf/StdLibExtras.h> 25 27 … … 40 42 CSSPropertyBackgroundColor 41 43 }; 42 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundShorthand, ( backgroundProperties, WTF_ARRAY_LENGTH(backgroundProperties)));44 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundShorthand, (CSSPropertyBackground, backgroundProperties, WTF_ARRAY_LENGTH(backgroundProperties))); 43 45 return backgroundShorthand; 44 46 } … … 47 49 { 48 50 static const CSSPropertyID backgroundPositionProperties[] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY }; 49 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundPositionLonghands, ( backgroundPositionProperties, WTF_ARRAY_LENGTH(backgroundPositionProperties)));51 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundPositionLonghands, (CSSPropertyBackgroundPosition, backgroundPositionProperties, WTF_ARRAY_LENGTH(backgroundPositionProperties))); 50 52 return backgroundPositionLonghands; 51 53 } … … 54 56 { 55 57 static const CSSPropertyID backgroundRepeatProperties[] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY }; 56 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundRepeatLonghands, ( backgroundRepeatProperties, WTF_ARRAY_LENGTH(backgroundRepeatProperties)));58 DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundRepeatLonghands, (CSSPropertyBackgroundRepeat, backgroundRepeatProperties, WTF_ARRAY_LENGTH(backgroundRepeatProperties))); 57 59 return backgroundRepeatLonghands; 58 60 } … … 67 69 { CSSPropertyBorderLeftColor, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftWidth } 68 70 }; 69 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderLonghands, ( borderProperties[0], sizeof(borderProperties) / sizeof(borderProperties[0][0])));71 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderLonghands, (CSSPropertyBorder, borderProperties[0], sizeof(borderProperties) / sizeof(borderProperties[0][0]))); 70 72 return borderLonghands; 71 73 } … … 80 82 }; 81 83 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderAbridgedLonghands, 82 ( borderAbridgedProperties, propertiesForInitialization, WTF_ARRAY_LENGTH(borderAbridgedProperties)));84 (CSSPropertyBorder, borderAbridgedProperties, propertiesForInitialization, WTF_ARRAY_LENGTH(borderAbridgedProperties))); 83 85 return borderAbridgedLonghands; 84 86 } … … 87 89 { 88 90 static const CSSPropertyID borderBottomProperties[] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomColor }; 89 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderBottomLonghands, ( borderBottomProperties, WTF_ARRAY_LENGTH(borderBottomProperties)));91 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderBottomLonghands, (CSSPropertyBorderBottom, borderBottomProperties, WTF_ARRAY_LENGTH(borderBottomProperties))); 90 92 return borderBottomLonghands; 91 93 } … … 99 101 CSSPropertyBorderLeftColor 100 102 }; 101 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderColorLonghands, ( borderColorProperties, WTF_ARRAY_LENGTH(borderColorProperties)));103 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderColorLonghands, (CSSPropertyBorderColor, borderColorProperties, WTF_ARRAY_LENGTH(borderColorProperties))); 102 104 return borderColorLonghands; 103 105 } … … 112 114 CSSPropertyBorderImageRepeat 113 115 }; 114 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderImageLonghands, ( borderImageProperties, WTF_ARRAY_LENGTH(borderImageProperties)));116 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderImageLonghands, (CSSPropertyBorderImage, borderImageProperties, WTF_ARRAY_LENGTH(borderImageProperties))); 115 117 return borderImageLonghands; 116 118 } … … 119 121 { 120 122 static const CSSPropertyID borderLeftProperties[] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftColor }; 121 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderLeftLonghands, ( borderLeftProperties, WTF_ARRAY_LENGTH(borderLeftProperties)));123 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderLeftLonghands, (CSSPropertyBorderLeft, borderLeftProperties, WTF_ARRAY_LENGTH(borderLeftProperties))); 122 124 return borderLeftLonghands; 123 125 } … … 131 133 CSSPropertyBorderBottomLeftRadius 132 134 }; 133 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRadiusLonghands, ( borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties)));135 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRadiusLonghands, (CSSPropertyBorderRadius, borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties))); 134 136 return borderRadiusLonghands; 135 137 } 136 138 139 const StylePropertyShorthand& webkitBorderRadiusShorthand() 140 { 141 static const CSSPropertyID borderRadiusProperties[] = { 142 CSSPropertyBorderTopLeftRadius, 143 CSSPropertyBorderTopRightRadius, 144 CSSPropertyBorderBottomRightRadius, 145 CSSPropertyBorderBottomLeftRadius 146 }; 147 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRadiusLonghands, (CSSPropertyWebkitBorderRadius, borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties))); 148 return borderRadiusLonghands; 149 } 150 137 151 const StylePropertyShorthand& borderRightShorthand() 138 152 { 139 153 static const CSSPropertyID borderRightProperties[] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, CSSPropertyBorderRightColor }; 140 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRightLonghands, ( borderRightProperties, WTF_ARRAY_LENGTH(borderRightProperties)));154 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderRightLonghands, (CSSPropertyBorderRight, borderRightProperties, WTF_ARRAY_LENGTH(borderRightProperties))); 141 155 return borderRightLonghands; 142 156 } … … 145 159 { 146 160 static const CSSPropertyID borderSpacingProperties[] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing }; 147 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderSpacingLonghands, ( borderSpacingProperties, WTF_ARRAY_LENGTH(borderSpacingProperties)));161 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderSpacingLonghands, (CSSPropertyBorderSpacing, borderSpacingProperties, WTF_ARRAY_LENGTH(borderSpacingProperties))); 148 162 return borderSpacingLonghands; 149 163 } … … 157 171 CSSPropertyBorderLeftStyle 158 172 }; 159 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderStyleLonghands, ( borderStyleProperties, WTF_ARRAY_LENGTH(borderStyleProperties)));173 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderStyleLonghands, (CSSPropertyBorderStyle, borderStyleProperties, WTF_ARRAY_LENGTH(borderStyleProperties))); 160 174 return borderStyleLonghands; 161 175 } … … 164 178 { 165 179 static const CSSPropertyID borderTopProperties[] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderTopColor }; 166 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderTopLonghands, ( borderTopProperties, WTF_ARRAY_LENGTH(borderTopProperties)));180 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderTopLonghands, (CSSPropertyBorderTop, borderTopProperties, WTF_ARRAY_LENGTH(borderTopProperties))); 167 181 return borderTopLonghands; 168 182 } … … 176 190 CSSPropertyBorderLeftWidth 177 191 }; 178 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderWidthLonghands, ( borderWidthProperties, WTF_ARRAY_LENGTH(borderWidthProperties)));192 DEFINE_STATIC_LOCAL(StylePropertyShorthand, borderWidthLonghands, (CSSPropertyBorderWidth, borderWidthProperties, WTF_ARRAY_LENGTH(borderWidthProperties))); 179 193 return borderWidthLonghands; 180 194 } … … 187 201 CSSPropertyListStyleImage 188 202 }; 189 DEFINE_STATIC_LOCAL(StylePropertyShorthand, listStyleLonghands, ( listStyleProperties, WTF_ARRAY_LENGTH(listStyleProperties)));203 DEFINE_STATIC_LOCAL(StylePropertyShorthand, listStyleLonghands, (CSSPropertyListStyle, listStyleProperties, WTF_ARRAY_LENGTH(listStyleProperties))); 190 204 return listStyleLonghands; 191 205 } … … 201 215 CSSPropertyLineHeight 202 216 }; 203 DEFINE_STATIC_LOCAL(StylePropertyShorthand, fontLonghands, ( fontProperties, WTF_ARRAY_LENGTH(fontProperties)));217 DEFINE_STATIC_LOCAL(StylePropertyShorthand, fontLonghands, (CSSPropertyFont, fontProperties, WTF_ARRAY_LENGTH(fontProperties))); 204 218 return fontLonghands; 205 219 } … … 213 227 CSSPropertyMarginLeft 214 228 }; 215 DEFINE_STATIC_LOCAL(StylePropertyShorthand, marginLonghands, ( marginProperties, WTF_ARRAY_LENGTH(marginProperties)));229 DEFINE_STATIC_LOCAL(StylePropertyShorthand, marginLonghands, (CSSPropertyMargin, marginProperties, WTF_ARRAY_LENGTH(marginProperties))); 216 230 return marginLonghands; 231 } 232 233 const StylePropertyShorthand& markerShorthand() 234 { 235 static const CSSPropertyID markerProperties[] = { 236 CSSPropertyMarkerStart, 237 CSSPropertyMarkerMid, 238 CSSPropertyMarkerEnd 239 }; 240 DEFINE_STATIC_LOCAL(StylePropertyShorthand, markerLonghands, (CSSPropertyMarker, markerProperties, WTF_ARRAY_LENGTH(markerProperties))); 241 return markerLonghands; 217 242 } 218 243 … … 224 249 CSSPropertyOutlineWidth 225 250 }; 226 DEFINE_STATIC_LOCAL(StylePropertyShorthand, outlineLonghands, ( outlineProperties, WTF_ARRAY_LENGTH(outlineProperties)));251 DEFINE_STATIC_LOCAL(StylePropertyShorthand, outlineLonghands, (CSSPropertyOutline, outlineProperties, WTF_ARRAY_LENGTH(outlineProperties))); 227 252 return outlineLonghands; 228 253 } … … 231 256 { 232 257 static const CSSPropertyID overflowProperties[] = { CSSPropertyOverflowX, CSSPropertyOverflowY }; 233 DEFINE_STATIC_LOCAL(StylePropertyShorthand, overflowLonghands, ( overflowProperties, WTF_ARRAY_LENGTH(overflowProperties)));258 DEFINE_STATIC_LOCAL(StylePropertyShorthand, overflowLonghands, (CSSPropertyOverflow, overflowProperties, WTF_ARRAY_LENGTH(overflowProperties))); 234 259 return overflowLonghands; 235 260 } … … 243 268 CSSPropertyPaddingLeft 244 269 }; 245 DEFINE_STATIC_LOCAL(StylePropertyShorthand, paddingLonghands, ( paddingProperties, WTF_ARRAY_LENGTH(paddingProperties)));270 DEFINE_STATIC_LOCAL(StylePropertyShorthand, paddingLonghands, (CSSPropertyPadding, paddingProperties, WTF_ARRAY_LENGTH(paddingProperties))); 246 271 return paddingLonghands; 247 272 } … … 255 280 CSSPropertyTransitionDelay 256 281 }; 257 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, ( transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));282 DEFINE_STATIC_LOCAL(StylePropertyShorthand, transitionLonghands, (CSSPropertyTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties))); 258 283 return transitionLonghands; 259 284 } … … 270 295 CSSPropertyWebkitAnimationFillMode 271 296 }; 272 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghands, ( animationProperties, WTF_ARRAY_LENGTH(animationProperties)));297 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghands, (CSSPropertyWebkitAnimation, animationProperties, WTF_ARRAY_LENGTH(animationProperties))); 273 298 return webkitAnimationLonghands; 274 299 } … … 295 320 }; 296 321 297 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, ( animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing)));322 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyWebkitAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing))); 298 323 return webkitAnimationLonghandsForParsing; 299 324 } … … 302 327 { 303 328 static const CSSPropertyID borderAfterProperties[] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle, CSSPropertyWebkitBorderAfterColor }; 304 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderAfterLonghands, ( borderAfterProperties, WTF_ARRAY_LENGTH(borderAfterProperties)));329 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderAfterLonghands, (CSSPropertyWebkitBorderAfter, borderAfterProperties, WTF_ARRAY_LENGTH(borderAfterProperties))); 305 330 return webkitBorderAfterLonghands; 306 331 } … … 309 334 { 310 335 static const CSSPropertyID borderBeforeProperties[] = { CSSPropertyWebkitBorderBeforeWidth, CSSPropertyWebkitBorderBeforeStyle, CSSPropertyWebkitBorderBeforeColor }; 311 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderBeforeLonghands, ( borderBeforeProperties, WTF_ARRAY_LENGTH(borderBeforeProperties)));336 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderBeforeLonghands, (CSSPropertyWebkitBorderBefore, borderBeforeProperties, WTF_ARRAY_LENGTH(borderBeforeProperties))); 312 337 return webkitBorderBeforeLonghands; 313 338 } … … 316 341 { 317 342 static const CSSPropertyID borderEndProperties[] = { CSSPropertyWebkitBorderEndWidth, CSSPropertyWebkitBorderEndStyle, CSSPropertyWebkitBorderEndColor }; 318 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderEndLonghands, ( borderEndProperties, WTF_ARRAY_LENGTH(borderEndProperties)));343 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderEndLonghands, (CSSPropertyWebkitBorderEnd, borderEndProperties, WTF_ARRAY_LENGTH(borderEndProperties))); 319 344 return webkitBorderEndLonghands; 320 345 } … … 323 348 { 324 349 static const CSSPropertyID borderStartProperties[] = { CSSPropertyWebkitBorderStartWidth, CSSPropertyWebkitBorderStartStyle, CSSPropertyWebkitBorderStartColor }; 325 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderStartLonghands, ( borderStartProperties, WTF_ARRAY_LENGTH(borderStartProperties)));350 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitBorderStartLonghands, (CSSPropertyWebkitBorderStart, borderStartProperties, WTF_ARRAY_LENGTH(borderStartProperties))); 326 351 return webkitBorderStartLonghands; 327 352 } … … 330 355 { 331 356 static const CSSPropertyID columnsProperties[] = { CSSPropertyWebkitColumnWidth, CSSPropertyWebkitColumnCount }; 332 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitColumnsLonghands, ( columnsProperties, WTF_ARRAY_LENGTH(columnsProperties)));357 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitColumnsLonghands, (CSSPropertyWebkitColumns, columnsProperties, WTF_ARRAY_LENGTH(columnsProperties))); 333 358 return webkitColumnsLonghands; 334 359 } … … 341 366 CSSPropertyWebkitColumnRuleColor, 342 367 }; 343 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitColumnRuleLonghands, ( columnRuleProperties, WTF_ARRAY_LENGTH(columnRuleProperties)));368 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitColumnRuleLonghands, (CSSPropertyWebkitColumnRule, columnRuleProperties, WTF_ARRAY_LENGTH(columnRuleProperties))); 344 369 return webkitColumnRuleLonghands; 345 370 } … … 348 373 { 349 374 static const CSSPropertyID flexFlowProperties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap }; 350 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitFlexFlowLonghands, ( flexFlowProperties, WTF_ARRAY_LENGTH(flexFlowProperties)));375 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitFlexFlowLonghands, (CSSPropertyWebkitFlexFlow, flexFlowProperties, WTF_ARRAY_LENGTH(flexFlowProperties))); 351 376 return webkitFlexFlowLonghands; 352 377 } … … 355 380 { 356 381 static const CSSPropertyID flexProperties[] = { CSSPropertyWebkitFlexGrow, CSSPropertyWebkitFlexShrink, CSSPropertyWebkitFlexBasis }; 357 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitFlexLonghands, ( flexProperties, WTF_ARRAY_LENGTH(flexProperties)));382 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitFlexLonghands, (CSSPropertyWebkitFlex, flexProperties, WTF_ARRAY_LENGTH(flexProperties))); 358 383 return webkitFlexLonghands; 359 384 } … … 362 387 { 363 388 static const CSSPropertyID marginCollapseProperties[] = { CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse }; 364 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMarginCollapseLonghands, ( marginCollapseProperties, WTF_ARRAY_LENGTH(marginCollapseProperties)));389 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMarginCollapseLonghands, (CSSPropertyWebkitMarginCollapse, marginCollapseProperties, WTF_ARRAY_LENGTH(marginCollapseProperties))); 365 390 return webkitMarginCollapseLonghands; 366 391 } … … 372 397 CSSPropertyWebkitGridEnd 373 398 }; 374 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitGridColumnLonghands, ( webkitGridColumnProperties, WTF_ARRAY_LENGTH(webkitGridColumnProperties)));399 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitGridColumnLonghands, (CSSPropertyWebkitGridColumn, webkitGridColumnProperties, WTF_ARRAY_LENGTH(webkitGridColumnProperties))); 375 400 return webkitGridColumnLonghands; 376 401 … … 383 408 CSSPropertyWebkitGridAfter 384 409 }; 385 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitGridRowLonghands, ( webkitGridRowProperties, WTF_ARRAY_LENGTH(webkitGridRowProperties)));410 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitGridRowLonghands, (CSSPropertyWebkitGridRow, webkitGridRowProperties, WTF_ARRAY_LENGTH(webkitGridRowProperties))); 386 411 return webkitGridRowLonghands; 387 412 … … 397 422 CSSPropertyWebkitMarqueeSpeed 398 423 }; 399 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMarqueeLonghands, ( marqueeProperties, WTF_ARRAY_LENGTH(marqueeProperties)));424 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMarqueeLonghands, (CSSPropertyWebkitMarquee, marqueeProperties, WTF_ARRAY_LENGTH(marqueeProperties))); 400 425 return webkitMarqueeLonghands; 401 426 } … … 413 438 CSSPropertyWebkitMaskClip 414 439 }; 415 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskLonghands, ( maskProperties, WTF_ARRAY_LENGTH(maskProperties)));440 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskLonghands, (CSSPropertyWebkitMask, maskProperties, WTF_ARRAY_LENGTH(maskProperties))); 416 441 return webkitMaskLonghands; 417 442 } … … 420 445 { 421 446 static const CSSPropertyID maskPositionProperties[] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY }; 422 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskPositionLonghands, ( maskPositionProperties, WTF_ARRAY_LENGTH(maskPositionProperties)));447 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskPositionLonghands, (CSSPropertyWebkitMaskPosition, maskPositionProperties, WTF_ARRAY_LENGTH(maskPositionProperties))); 423 448 return webkitMaskPositionLonghands; 424 449 } … … 427 452 { 428 453 static const CSSPropertyID maskRepeatProperties[] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY }; 429 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskRepeatLonghands, ( maskRepeatProperties, WTF_ARRAY_LENGTH(maskRepeatProperties)));454 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitMaskRepeatLonghands, (CSSPropertyWebkitMaskRepeat, maskRepeatProperties, WTF_ARRAY_LENGTH(maskRepeatProperties))); 430 455 return webkitMaskRepeatLonghands; 431 456 } … … 437 462 CSSPropertyWebkitTextEmphasisColor 438 463 }; 439 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextEmphasisLonghands, ( textEmphasisProperties, WTF_ARRAY_LENGTH(textEmphasisProperties)));464 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextEmphasisLonghands, (CSSPropertyWebkitTextEmphasis, textEmphasisProperties, WTF_ARRAY_LENGTH(textEmphasisProperties))); 440 465 return webkitTextEmphasisLonghands; 441 466 } … … 444 469 { 445 470 static const CSSPropertyID textStrokeProperties[] = { CSSPropertyWebkitTextStrokeWidth, CSSPropertyWebkitTextStrokeColor }; 446 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextStrokeLonghands, ( textStrokeProperties, WTF_ARRAY_LENGTH(textStrokeProperties)));471 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTextStrokeLonghands, (CSSPropertyWebkitTextStroke, textStrokeProperties, WTF_ARRAY_LENGTH(textStrokeProperties))); 447 472 return webkitTextStrokeLonghands; 448 473 } … … 456 481 CSSPropertyWebkitTransitionDelay 457 482 }; 458 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransitionLonghands, ( transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));483 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransitionLonghands, (CSSPropertyWebkitTransition, transitionProperties, WTF_ARRAY_LENGTH(transitionProperties))); 459 484 return webkitTransitionLonghands; 460 485 } … … 467 492 CSSPropertyWebkitTransformOriginZ 468 493 }; 469 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransformOriginLonghands, ( transformOriginProperties, WTF_ARRAY_LENGTH(transformOriginProperties)));494 DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitTransformOriginLonghands, (CSSPropertyWebkitTransformOrigin, transformOriginProperties, WTF_ARRAY_LENGTH(transformOriginProperties))); 470 495 return webkitTransformOriginLonghands; 496 } 497 498 const StylePropertyShorthand& widthShorthand() 499 { 500 static const CSSPropertyID widthProperties[] = { 501 CSSPropertyMinWidth, 502 CSSPropertyMaxWidth 503 }; 504 DEFINE_STATIC_LOCAL(StylePropertyShorthand, widthLonghands, (CSSPropertyWidth, widthProperties, WTF_ARRAY_LENGTH(widthProperties))); 505 return widthLonghands; 506 } 507 508 const StylePropertyShorthand& heightShorthand() 509 { 510 static const CSSPropertyID heightProperties[] = { 511 CSSPropertyMinHeight, 512 CSSPropertyMaxHeight 513 }; 514 DEFINE_STATIC_LOCAL(StylePropertyShorthand, heightLonghands, (CSSPropertyHeight, heightProperties, WTF_ARRAY_LENGTH(heightProperties))); 515 return heightLonghands; 471 516 } 472 517 … … 578 623 } 579 624 625 // FIXME : We need to generate all of this. 626 typedef HashMap<CSSPropertyID, Vector<const StylePropertyShorthand*> > longhandsMap; 627 const Vector<const StylePropertyShorthand*> matchingShorthandsForLonghand(CSSPropertyID propertyID) 628 { 629 DEFINE_STATIC_LOCAL(longhandsMap, map, ()); 630 if (map.isEmpty()) { 631 Vector<const StylePropertyShorthand*, 1> background; 632 background.uncheckedAppend(&backgroundShorthand()); 633 map.set(CSSPropertyBackgroundImage, background); 634 map.set(CSSPropertyBackgroundSize, background); 635 map.set(CSSPropertyBackgroundAttachment, background); 636 map.set(CSSPropertyBackgroundOrigin, background); 637 map.set(CSSPropertyBackgroundClip, background); 638 map.set(CSSPropertyBackgroundColor, background); 639 640 Vector<const StylePropertyShorthand*, 2> positionShorthands; 641 positionShorthands.uncheckedAppend(&backgroundShorthand()); 642 positionShorthands.uncheckedAppend(&backgroundPositionShorthand()); 643 map.set(CSSPropertyBackgroundPositionX, positionShorthands); 644 map.set(CSSPropertyBackgroundPositionY, positionShorthands); 645 646 Vector<const StylePropertyShorthand*, 2> repeatShorthands; 647 repeatShorthands.uncheckedAppend(&backgroundShorthand()); 648 repeatShorthands.uncheckedAppend(&backgroundRepeatShorthand()); 649 map.set(CSSPropertyBackgroundRepeatX, repeatShorthands); 650 map.set(CSSPropertyBackgroundRepeatY, repeatShorthands); 651 652 Vector<const StylePropertyShorthand*, 3> bottomWidthShorthands; 653 bottomWidthShorthands.uncheckedAppend(&borderShorthand()); 654 bottomWidthShorthands.uncheckedAppend(&borderBottomShorthand()); 655 bottomWidthShorthands.uncheckedAppend(&borderWidthShorthand()); 656 map.set(CSSPropertyBorderBottomWidth, bottomWidthShorthands); 657 658 Vector<const StylePropertyShorthand*, 3> topColorShorthands; 659 topColorShorthands.uncheckedAppend(&borderShorthand()); 660 topColorShorthands.uncheckedAppend(&borderTopShorthand()); 661 topColorShorthands.uncheckedAppend(&borderColorShorthand()); 662 map.set(CSSPropertyBorderTopColor, topColorShorthands); 663 664 Vector<const StylePropertyShorthand*, 3> rightColorShorthands; 665 rightColorShorthands.uncheckedAppend(&borderShorthand()); 666 rightColorShorthands.uncheckedAppend(&borderRightShorthand()); 667 rightColorShorthands.uncheckedAppend(&borderColorShorthand()); 668 map.set(CSSPropertyBorderRightColor, rightColorShorthands); 669 670 Vector<const StylePropertyShorthand*, 3> leftColorShorthands; 671 leftColorShorthands.uncheckedAppend(&borderShorthand()); 672 leftColorShorthands.uncheckedAppend(&borderLeftShorthand()); 673 leftColorShorthands.uncheckedAppend(&borderColorShorthand()); 674 map.set(CSSPropertyBorderLeftColor, leftColorShorthands); 675 676 Vector<const StylePropertyShorthand*, 3> bottomColorShorthands; 677 bottomColorShorthands.uncheckedAppend(&borderShorthand()); 678 bottomColorShorthands.uncheckedAppend(&borderBottomShorthand()); 679 bottomColorShorthands.uncheckedAppend(&borderColorShorthand()); 680 map.set(CSSPropertyBorderBottomColor, bottomColorShorthands); 681 682 Vector<const StylePropertyShorthand*, 1> borderImage; 683 borderImage.uncheckedAppend(&borderImageShorthand()); 684 map.set(CSSPropertyBorderImageSource, borderImage); 685 map.set(CSSPropertyBorderImageSlice, borderImage); 686 map.set(CSSPropertyBorderImageWidth, borderImage); 687 map.set(CSSPropertyBorderImageOutset, borderImage); 688 map.set(CSSPropertyBorderImageRepeat, borderImage); 689 690 Vector<const StylePropertyShorthand*, 3> leftWidthShorthands; 691 leftWidthShorthands.uncheckedAppend(&borderShorthand()); 692 leftWidthShorthands.uncheckedAppend(&borderLeftShorthand()); 693 leftWidthShorthands.uncheckedAppend(&borderWidthShorthand()); 694 map.set(CSSPropertyBorderLeftWidth, leftWidthShorthands); 695 696 Vector<const StylePropertyShorthand*, 2> radiusShorthands; 697 radiusShorthands.uncheckedAppend(&borderRadiusShorthand()); 698 radiusShorthands.uncheckedAppend(&webkitBorderRadiusShorthand()); 699 map.set(CSSPropertyBorderTopLeftRadius, radiusShorthands); 700 map.set(CSSPropertyBorderTopRightRadius, radiusShorthands); 701 map.set(CSSPropertyBorderBottomRightRadius, radiusShorthands); 702 map.set(CSSPropertyBorderBottomLeftRadius, radiusShorthands); 703 704 Vector<const StylePropertyShorthand*, 3> rightWidthShorthands; 705 rightWidthShorthands.uncheckedAppend(&borderShorthand()); 706 rightWidthShorthands.uncheckedAppend(&borderRightShorthand()); 707 rightWidthShorthands.uncheckedAppend(&borderWidthShorthand()); 708 map.set(CSSPropertyBorderRightWidth, rightWidthShorthands); 709 710 Vector<const StylePropertyShorthand*, 1> spacingShorthand; 711 spacingShorthand.uncheckedAppend(&borderSpacingShorthand()); 712 map.set(CSSPropertyWebkitBorderHorizontalSpacing, spacingShorthand); 713 map.set(CSSPropertyWebkitBorderVerticalSpacing, spacingShorthand); 714 715 Vector<const StylePropertyShorthand*, 3> topStyleShorthands; 716 topStyleShorthands.uncheckedAppend(&borderShorthand()); 717 topStyleShorthands.uncheckedAppend(&borderTopShorthand()); 718 topStyleShorthands.uncheckedAppend(&borderStyleShorthand()); 719 map.set(CSSPropertyBorderTopStyle, topStyleShorthands); 720 721 Vector<const StylePropertyShorthand*, 3> bottomStyleShorthands; 722 bottomStyleShorthands.uncheckedAppend(&borderShorthand()); 723 bottomStyleShorthands.uncheckedAppend(&borderBottomShorthand()); 724 bottomStyleShorthands.uncheckedAppend(&borderStyleShorthand()); 725 map.set(CSSPropertyBorderBottomStyle, bottomStyleShorthands); 726 727 Vector<const StylePropertyShorthand*, 3> leftStyleShorthands; 728 leftStyleShorthands.uncheckedAppend(&borderShorthand()); 729 leftStyleShorthands.uncheckedAppend(&borderLeftShorthand()); 730 leftStyleShorthands.uncheckedAppend(&borderStyleShorthand()); 731 map.set(CSSPropertyBorderLeftStyle, leftStyleShorthands); 732 733 Vector<const StylePropertyShorthand*, 3> rightStyleShorthands; 734 rightStyleShorthands.uncheckedAppend(&borderShorthand()); 735 rightStyleShorthands.uncheckedAppend(&borderRightShorthand()); 736 rightStyleShorthands.uncheckedAppend(&borderStyleShorthand()); 737 map.set(CSSPropertyBorderRightStyle, rightStyleShorthands); 738 739 Vector<const StylePropertyShorthand*, 3> topWidthShorthands; 740 topWidthShorthands.uncheckedAppend(&borderShorthand()); 741 topWidthShorthands.uncheckedAppend(&borderTopShorthand()); 742 topWidthShorthands.uncheckedAppend(&borderWidthShorthand()); 743 map.set(CSSPropertyBorderTopWidth, topWidthShorthands); 744 745 Vector<const StylePropertyShorthand*, 1> listStyle; 746 listStyle.uncheckedAppend(&listStyleShorthand()); 747 map.set(CSSPropertyListStyleType, listStyle); 748 map.set(CSSPropertyListStylePosition, listStyle); 749 map.set(CSSPropertyListStyleImage, listStyle); 750 751 Vector<const StylePropertyShorthand*, 1> font; 752 font.uncheckedAppend(&fontShorthand()); 753 map.set(CSSPropertyFontFamily, font); 754 map.set(CSSPropertyFontSize, font); 755 map.set(CSSPropertyFontStyle, font); 756 map.set(CSSPropertyFontVariant, font); 757 map.set(CSSPropertyFontWeight, font); 758 map.set(CSSPropertyLineHeight, font); 759 760 Vector<const StylePropertyShorthand*, 1> margin; 761 margin.uncheckedAppend(&marginShorthand()); 762 map.set(CSSPropertyMarginTop, margin); 763 map.set(CSSPropertyMarginRight, margin); 764 map.set(CSSPropertyMarginBottom, margin); 765 map.set(CSSPropertyMarginLeft, margin); 766 767 Vector<const StylePropertyShorthand*, 1> marker; 768 marker.uncheckedAppend(&markerShorthand()); 769 map.set(CSSPropertyMarkerStart, marker); 770 map.set(CSSPropertyMarkerMid, marker); 771 map.set(CSSPropertyMarkerEnd, marker); 772 773 Vector<const StylePropertyShorthand*, 1> outline; 774 outline.uncheckedAppend(&outlineShorthand()); 775 map.set(CSSPropertyOutlineColor, outline); 776 map.set(CSSPropertyOutlineStyle, outline); 777 map.set(CSSPropertyOutlineWidth, outline); 778 779 Vector<const StylePropertyShorthand*, 1> padding; 780 padding.uncheckedAppend(&paddingShorthand()); 781 map.set(CSSPropertyPaddingTop, padding); 782 map.set(CSSPropertyPaddingRight, padding); 783 map.set(CSSPropertyPaddingBottom, padding); 784 map.set(CSSPropertyPaddingLeft, padding); 785 786 Vector<const StylePropertyShorthand*, 1> overflow; 787 overflow.uncheckedAppend(&overflowShorthand()); 788 map.set(CSSPropertyOverflowX, overflow); 789 map.set(CSSPropertyOverflowY, overflow); 790 791 Vector<const StylePropertyShorthand*, 1> transition; 792 transition.uncheckedAppend(&transitionShorthand()); 793 map.set(CSSPropertyTransitionProperty, transition); 794 map.set(CSSPropertyTransitionDuration, transition); 795 map.set(CSSPropertyTransitionTimingFunction, transition); 796 map.set(CSSPropertyTransitionDelay, transition); 797 798 Vector<const StylePropertyShorthand*, 1> animation; 799 animation.uncheckedAppend(&webkitAnimationShorthand()); 800 map.set(CSSPropertyWebkitAnimationName, animation); 801 map.set(CSSPropertyWebkitAnimationDuration, animation); 802 map.set(CSSPropertyWebkitAnimationTimingFunction, animation); 803 map.set(CSSPropertyWebkitAnimationDelay, animation); 804 map.set(CSSPropertyWebkitAnimationIterationCount, animation); 805 map.set(CSSPropertyWebkitAnimationDirection, animation); 806 map.set(CSSPropertyWebkitAnimationFillMode, animation); 807 808 Vector<const StylePropertyShorthand*, 1> borderAfter; 809 borderAfter.uncheckedAppend(&webkitBorderAfterShorthand()); 810 map.set(CSSPropertyWebkitBorderAfterWidth, borderAfter); 811 map.set(CSSPropertyWebkitBorderAfterStyle, borderAfter); 812 map.set(CSSPropertyWebkitBorderAfterColor, borderAfter); 813 814 Vector<const StylePropertyShorthand*, 1> borderBefore; 815 borderBefore.uncheckedAppend(&webkitBorderBeforeShorthand()); 816 map.set(CSSPropertyWebkitBorderBeforeWidth, borderBefore); 817 map.set(CSSPropertyWebkitBorderBeforeStyle, borderBefore); 818 map.set(CSSPropertyWebkitBorderBeforeColor, borderBefore); 819 820 Vector<const StylePropertyShorthand*, 1> borderEnd; 821 borderEnd.uncheckedAppend(&webkitBorderEndShorthand()); 822 map.set(CSSPropertyWebkitBorderEndWidth, borderEnd); 823 map.set(CSSPropertyWebkitBorderEndStyle, borderEnd); 824 map.set(CSSPropertyWebkitBorderEndColor, borderEnd); 825 826 Vector<const StylePropertyShorthand*, 1> borderStart; 827 borderStart.uncheckedAppend(&webkitBorderStartShorthand()); 828 map.set(CSSPropertyWebkitBorderStartWidth, borderStart); 829 map.set(CSSPropertyWebkitBorderStartStyle, borderStart); 830 map.set(CSSPropertyWebkitBorderStartColor, borderStart); 831 832 Vector<const StylePropertyShorthand*, 1> columns; 833 columns.uncheckedAppend(&webkitColumnsShorthand()); 834 map.set(CSSPropertyWebkitColumnWidth, columns); 835 map.set(CSSPropertyWebkitColumnCount, columns); 836 837 Vector<const StylePropertyShorthand*, 1> columnRule; 838 columnRule.uncheckedAppend(&webkitColumnRuleShorthand()); 839 map.set(CSSPropertyWebkitColumnRuleWidth, columnRule); 840 map.set(CSSPropertyWebkitColumnRuleStyle, columnRule); 841 map.set(CSSPropertyWebkitColumnRuleColor, columnRule); 842 843 Vector<const StylePropertyShorthand*, 1> flex; 844 flex.uncheckedAppend(&webkitFlexShorthand()); 845 map.set(CSSPropertyWebkitFlexGrow, flex); 846 map.set(CSSPropertyWebkitFlexShrink, flex); 847 map.set(CSSPropertyWebkitFlexBasis, flex); 848 849 Vector<const StylePropertyShorthand*, 1> flexFlow; 850 flexFlow.uncheckedAppend(&webkitFlexFlowShorthand()); 851 map.set(CSSPropertyWebkitFlexDirection, flexFlow); 852 map.set(CSSPropertyWebkitFlexWrap, flexFlow); 853 854 Vector<const StylePropertyShorthand*, 1> grid; 855 grid.uncheckedAppend(&webkitGridColumnShorthand()); 856 map.set(CSSPropertyWebkitGridStart, grid); 857 map.set(CSSPropertyWebkitGridEnd, grid); 858 859 Vector<const StylePropertyShorthand*, 1> gridAfter; 860 gridAfter.uncheckedAppend(&webkitGridRowShorthand()); 861 map.set(CSSPropertyWebkitGridBefore, gridAfter); 862 map.set(CSSPropertyWebkitGridAfter, gridAfter); 863 864 Vector<const StylePropertyShorthand*, 1> marginCollapse; 865 marginCollapse.uncheckedAppend(&webkitMarginCollapseShorthand()); 866 map.set(CSSPropertyWebkitMarginBeforeCollapse, marginCollapse); 867 map.set(CSSPropertyWebkitMarginAfterCollapse, marginCollapse); 868 869 Vector<const StylePropertyShorthand*, 1> marquee; 870 marquee.uncheckedAppend(&webkitMarqueeShorthand()); 871 map.set(CSSPropertyWebkitMarqueeDirection, marquee); 872 map.set(CSSPropertyWebkitMarqueeIncrement, marquee); 873 map.set(CSSPropertyWebkitMarqueeRepetition, marquee); 874 map.set(CSSPropertyWebkitMarqueeStyle, marquee); 875 map.set(CSSPropertyWebkitMarqueeSpeed, marquee); 876 877 Vector<const StylePropertyShorthand*, 1> mask; 878 mask.uncheckedAppend(&webkitMaskShorthand()); 879 map.set(CSSPropertyWebkitMaskImage, mask); 880 map.set(CSSPropertyWebkitMaskSize, mask); 881 map.set(CSSPropertyWebkitMaskOrigin, mask); 882 map.set(CSSPropertyWebkitMaskClip, mask); 883 884 Vector<const StylePropertyShorthand*, 1> maskPosition; 885 maskPosition.uncheckedAppend(&webkitMaskPositionShorthand()); 886 map.set(CSSPropertyWebkitMaskPositionX, maskPosition); 887 map.set(CSSPropertyWebkitMaskPositionY, maskPosition); 888 889 Vector<const StylePropertyShorthand*, 1> maskRepeat; 890 maskRepeat.uncheckedAppend(&webkitMaskRepeatShorthand()); 891 map.set(CSSPropertyWebkitMaskRepeatX, maskRepeat); 892 map.set(CSSPropertyWebkitMaskRepeatY, maskRepeat); 893 894 Vector<const StylePropertyShorthand*, 1> textEmphasis; 895 textEmphasis.uncheckedAppend(&webkitTextEmphasisShorthand()); 896 map.set(CSSPropertyWebkitTextEmphasisStyle, textEmphasis); 897 map.set(CSSPropertyWebkitTextEmphasisColor, textEmphasis); 898 899 Vector<const StylePropertyShorthand*, 1> textStroke; 900 textStroke.uncheckedAppend(&webkitTextStrokeShorthand()); 901 map.set(CSSPropertyWebkitTextStrokeWidth, textStroke); 902 map.set(CSSPropertyWebkitTextStrokeColor, textStroke); 903 904 Vector<const StylePropertyShorthand*, 1> webkitTransition; 905 webkitTransition.uncheckedAppend(&webkitTransitionShorthand()); 906 map.set(CSSPropertyWebkitTransitionProperty, webkitTransition); 907 map.set(CSSPropertyWebkitTransitionDuration, webkitTransition); 908 map.set(CSSPropertyWebkitTransitionTimingFunction, webkitTransition); 909 map.set(CSSPropertyWebkitTransitionDelay, webkitTransition); 910 911 Vector<const StylePropertyShorthand*, 1> transform; 912 transform.uncheckedAppend(&webkitTransformOriginShorthand()); 913 map.set(CSSPropertyWebkitTransformOriginX, transform); 914 map.set(CSSPropertyWebkitTransformOriginY, transform); 915 map.set(CSSPropertyWebkitTransformOriginZ, transform); 916 917 Vector<const StylePropertyShorthand*, 1> width; 918 width.uncheckedAppend(&widthShorthand()); 919 map.set(CSSPropertyMinWidth, width); 920 map.set(CSSPropertyMaxWidth, width); 921 922 Vector<const StylePropertyShorthand*, 1> height; 923 height.uncheckedAppend(&heightShorthand()); 924 map.set(CSSPropertyMinHeight, height); 925 map.set(CSSPropertyMaxHeight, height); 926 } 927 return map.get(propertyID); 928 } 929 930 unsigned indexOfShorthandForLonghand(CSSPropertyID shorthandID, const Vector<const StylePropertyShorthand*>& shorthands) 931 { 932 for (unsigned i = 0; i < shorthands.size(); ++i) { 933 if (shorthands.at(i)->id() == shorthandID) 934 return i; 935 } 936 ASSERT_NOT_REACHED(); 937 return 0; 938 } 939 580 940 } // namespace WebCore -
trunk/Source/WebCore/css/StylePropertyShorthand.h
r149623 r153581 2 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2013 Intel Corporation. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 23 24 24 25 #include "CSSPropertyNames.h" 26 #include <wtf/Vector.h> 25 27 26 28 namespace WebCore { … … 33 35 , m_propertiesForInitialization(0) 34 36 , m_length(0) 37 , m_shorthandID(CSSPropertyInvalid) 35 38 { 36 39 } 37 40 38 StylePropertyShorthand( const CSSPropertyID* properties, unsigned numProperties)41 StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, unsigned numProperties) 39 42 : m_properties(properties) 40 43 , m_propertiesForInitialization(0) 41 44 , m_length(numProperties) 45 , m_shorthandID(id) 42 46 { 43 47 } 44 48 45 StylePropertyShorthand( const CSSPropertyID* properties, const StylePropertyShorthand** propertiesForInitialization, unsigned numProperties)49 StylePropertyShorthand(CSSPropertyID id, const CSSPropertyID* properties, const StylePropertyShorthand** propertiesForInitialization, unsigned numProperties) 46 50 : m_properties(properties) 47 51 , m_propertiesForInitialization(propertiesForInitialization) 48 52 , m_length(numProperties) 53 , m_shorthandID(id) 49 54 { 50 55 } … … 53 58 const StylePropertyShorthand** propertiesForInitialization() const { return m_propertiesForInitialization; } 54 59 unsigned length() const { return m_length; } 60 CSSPropertyID id() const { return m_shorthandID; } 55 61 56 62 private: … … 58 64 const StylePropertyShorthand** m_propertiesForInitialization; 59 65 unsigned m_length; 66 CSSPropertyID m_shorthandID; 60 67 }; 61 68 … … 77 84 const StylePropertyShorthand& listStyleShorthand(); 78 85 const StylePropertyShorthand& fontShorthand(); 86 const StylePropertyShorthand& heightShorthand(); 79 87 const StylePropertyShorthand& marginShorthand(); 88 const StylePropertyShorthand& markerShorthand(); 80 89 const StylePropertyShorthand& outlineShorthand(); 81 90 const StylePropertyShorthand& overflowShorthand(); … … 87 96 const StylePropertyShorthand& webkitBorderBeforeShorthand(); 88 97 const StylePropertyShorthand& webkitBorderEndShorthand(); 98 const StylePropertyShorthand& webkitBorderRadiusShorthand(); 89 99 const StylePropertyShorthand& webkitBorderStartShorthand(); 90 100 const StylePropertyShorthand& webkitColumnsShorthand(); … … 103 113 const StylePropertyShorthand& webkitTransitionShorthand(); 104 114 const StylePropertyShorthand& webkitTransformOriginShorthand(); 115 const StylePropertyShorthand& widthShorthand(); 105 116 106 // Returns an empty list if the property is not a shorthand 117 // Returns an empty list if the property is not a shorthand. 107 118 const StylePropertyShorthand& shorthandForProperty(CSSPropertyID); 119 120 // Return the list of shorthands for a given longhand. 121 const Vector<const StylePropertyShorthand*> matchingShorthandsForLonghand(CSSPropertyID); 122 unsigned indexOfShorthandForLonghand(CSSPropertyID, const Vector<const StylePropertyShorthand*>&); 108 123 109 124 bool isExpandedShorthand(CSSPropertyID); -
trunk/Source/WebCore/css/makeprop.pl
r125934 r153581 33 33 34 34 my @NAMES = applyPreprocessor("CSSPropertyNames.in", $defines, $preprocessor); 35 die "We've reached more than 1024 CSS properties, please make sure to update CSSProperty/StylePropertyMetadata accordingly" if (scalar(@NAMES) > 1024); 35 36 36 37 my %namesHash; … … 204 205 EOF 205 206 206 my $first = 1001;207 my $i = 1001;207 my $first = 3; 208 my $i = 3; 208 209 my $maxLen = 0; 209 210 foreach my $name (@names) {
Note:
See TracChangeset
for help on using the changeset viewer.