Source/WebCore/ChangeLog

 12012-03-29 Alexis Menard <alexis.menard@openbossa.org>
 2
 3 Rename CSSPropertyLonghand class to ShorthandProperties.
 4 https://bugs.webkit.org/show_bug.cgi?id=82624
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Rename CSSPropertyLonghand to ShorthandProperties as what CSSPropertyLonghand
 9 is representing is not a longhand but the list of longhands for a given shorthand.
 10 Also in the same time switch all shorthand declarations to use CSSPropertyID enum
 11 rather than a int so it is clear on what kind of data we are dealing with.
 12
 13 In a following patch I will rename CSSPropertyLonghand file.
 14
 15 No new tests : This is a refactoring, no behaviour change intended.
 16
 17 * css/CSSComputedStyleDeclaration.cpp:
 18 (WebCore):
 19 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
 20 (WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties):
 21 (WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand):
 22 (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet):
 23 * css/CSSComputedStyleDeclaration.h:
 24 (WebCore):
 25 (CSSComputedStyleDeclaration):
 26 * css/CSSParser.cpp:
 27 (WebCore::CSSParser::parseValue):
 28 (WebCore::CSSParser::parseFillShorthand):
 29 (WebCore::CSSParser::parseShorthand):
 30 (WebCore::CSSParser::parse4Values):
 31 * css/CSSParser.h:
 32 (WebCore):
 33 (CSSParser):
 34 * css/CSSProperty.cpp:
 35 (WebCore::resolveToPhysicalProperty):
 36 (WebCore::borderDirections):
 37 (WebCore::CSSProperty::resolveDirectionAwareProperty):
 38 * css/CSSPropertyLonghand.cpp:
 39 (WebCore::backgroundLonghand):
 40 (WebCore::backgroundPositionLonghand):
 41 (WebCore::backgroundRepeatLonghand):
 42 (WebCore::borderLonghand):
 43 (WebCore::borderAbridgedLonghand):
 44 (WebCore::borderBottomLonghand):
 45 (WebCore::borderColorLonghand):
 46 (WebCore::borderImageLonghand):
 47 (WebCore::borderLeftLonghand):
 48 (WebCore::borderRadiusLonghand):
 49 (WebCore::borderRightLonghand):
 50 (WebCore::borderSpacingLonghand):
 51 (WebCore::borderStyleLonghand):
 52 (WebCore::borderTopLonghand):
 53 (WebCore::borderWidthLonghand):
 54 (WebCore::listStyleLonghand):
 55 (WebCore::fontLonghand):
 56 (WebCore::marginLonghand):
 57 (WebCore::outlineLonghand):
 58 (WebCore::overflowLonghand):
 59 (WebCore::paddingLonghand):
 60 (WebCore::webkitAnimationLonghand):
 61 (WebCore::webkitBorderAfterLonghand):
 62 (WebCore::webkitBorderBeforeLonghand):
 63 (WebCore::webkitBorderEndLonghand):
 64 (WebCore::webkitBorderStartLonghand):
 65 (WebCore::webkitColumnsLonghand):
 66 (WebCore::webkitColumnRuleLonghand):
 67 (WebCore::webkitFlexFlowLonghand):
 68 (WebCore::webkitMarginCollapseLonghand):
 69 (WebCore::webkitMarqueeLonghand):
 70 (WebCore::webkitMaskLonghand):
 71 (WebCore::webkitMaskPositionLonghand):
 72 (WebCore::webkitMaskRepeatLonghand):
 73 (WebCore::webkitTextEmphasisLonghand):
 74 (WebCore::webkitTextStrokeLonghand):
 75 (WebCore::webkitTransitionLonghand):
 76 (WebCore::webkitTransformOriginLonghand):
 77 (WebCore::webkitWrapLonghand):
 78 (WebCore::longhandsForProperty):
 79 * css/CSSPropertyLonghand.h:
 80 (WebCore::ShorthandProperties::ShorthandProperties):
 81 (WebCore::ShorthandProperties::properties):
 82 (WebCore::ShorthandProperties::longhandsForInitialization):
 83 (ShorthandProperties):
 84 (WebCore):
 85 * css/StylePropertySet.cpp:
 86 (WebCore::StylePropertySet::getPropertyValue):
 87 (WebCore::StylePropertySet::borderSpacingValue):
 88 (WebCore::StylePropertySet::get4Values):
 89 (WebCore::StylePropertySet::getLayeredShorthandValue):
 90 (WebCore::StylePropertySet::getShorthandValue):
 91 (WebCore::StylePropertySet::getCommonValue):
 92 (WebCore::StylePropertySet::removeShorthandProperty):
 93 (WebCore::StylePropertySet::propertyIsImportant):
 94 (WebCore::StylePropertySet::setProperty):
 95 (WebCore::StylePropertySet::asText):
 96 (WebCore):
 97 (WebCore::StylePropertySet::removePropertiesInSet):
 98 (WebCore::StylePropertySet::copyPropertiesInSet):
 99 * css/StylePropertySet.h:
 100 (WebCore):
 101 (StylePropertySet):
 102 * editing/EditingStyle.cpp:
 103 (WebCore):
 104 (WebCore::removePropertiesInStyle):
 105 * page/animation/AnimationBase.cpp:
 106 (WebCore::ShorthandPropertyWrapper::ShorthandPropertyWrapper):
 107 (WebCore::addShorthandProperties):
 108 * page/animation/CompositeAnimation.cpp:
 109
11102012-03-28 Tommy Widenflycht <tommyw@google.com>
2111
3112 [chromium] MediaStream API (JSEP): Introducing WebPeerConnection00Handler

Source/WebCore/css/CSSComputedStyleDeclaration.cpp

7474namespace WebCore {
7575
7676// List of all properties we know how to compute, omitting shorthands.
77 static const int computedProperties[] = {
 77static const CSSPropertyID computedProperties[] = {
7878 CSSPropertyBackgroundAttachment,
7979 CSSPropertyBackgroundClip,
8080 CSSPropertyBackgroundColor,

@@PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
23372337 return valueForFilter(style.get());
23382338#endif
23392339 case CSSPropertyBackground: {
2340  const int properties[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
 2340 const CSSPropertyID properties[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
23412341 CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,
23422342 CSSPropertyBackgroundPosition };
2343  return getCSSPropertyValuesForShorthandProperties(CSSPropertyLonghand(properties, WTF_ARRAY_LENGTH(properties)));
 2343 return getCSSPropertyValuesForShorthandProperties(ShorthandProperties(properties, WTF_ARRAY_LENGTH(properties)));
23442344 }
23452345 case CSSPropertyBorder: {
23462346 RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);

@@PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::makeMutable()
25742574 return copy();
25752575}
25762576
2577 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties(const CSSPropertyLonghand& longhand) const
 2577PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties(const ShorthandProperties& longhand) const
25782578{
25792579 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
25802580 for (size_t i = 0; i < longhand.length(); ++i) {

@@PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSho
25842584 return list.release();
25852585}
25862586
2587 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand(const CSSPropertyLonghand& longhand) const
 2587PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand(const ShorthandProperties& longhand) const
25882588{
25892589 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
25902590 // Assume the properties are in the usual order top, right, bottom, left.

@@PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSid
26122612 return list.release();
26132613}
26142614
2615 PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const
 2615PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
26162616{
26172617 Vector<CSSProperty> list;
26182618 list.reserveInitialCapacity(length);

Source/WebCore/css/CSSComputedStyleDeclaration.h

2929namespace WebCore {
3030
3131class CSSPrimitiveValue;
32 class CSSPropertyLonghand;
3332class CSSValueList;
3433class CSSValuePool;
3534class Color;

@@class Node;
3736class RenderStyle;
3837class SVGPaint;
3938class ShadowData;
 39class ShorthandProperties;
4040class StylePropertySet;
4141
4242#if ENABLE(CSS_SHADERS)

@@public:
7171 PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
7272#endif
7373
74  PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const;
 74 PassRefPtr<StylePropertySet> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
7575
7676private:
7777 CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);

@@private:
110110 PassRefPtr<CSSValue> valueForFilter(RenderStyle*) const;
111111#endif
112112
113  PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const CSSPropertyLonghand&) const;
114  PassRefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const CSSPropertyLonghand&) const;
 113 PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const ShorthandProperties&) const;
 114 PassRefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const ShorthandProperties&) const;
115115
116116 RefPtr<Node> m_node;
117117 PseudoId m_pseudoElementSpecifier;

Source/WebCore/css/CSSParser.cpp

4949#include "CSSPrimitiveValue.h"
5050#include "CSSProperty.h"
5151#include "CSSPropertyLonghand.h"
52 #include "CSSPropertyNames.h"
5352#include "CSSPropertySourceData.h"
5453#include "CSSReflectValue.h"
5554#include "CSSSelector.h"

@@bool CSSParser::parseValue(int propId, bool important)
23052304 // Position must come before color in this array because a plain old "0" is a legal color
23062305 // in quirks mode but it's usually the X coordinate of a position.
23072306 // FIXME: Add CSSPropertyBackgroundSize to the shorthand.
2308  const int properties[] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
 2307 const CSSPropertyID properties[] = { CSSPropertyBackgroundImage, CSSPropertyBackgroundRepeat,
23092308 CSSPropertyBackgroundAttachment, CSSPropertyBackgroundPosition, CSSPropertyBackgroundOrigin,
23102309 CSSPropertyBackgroundClip, CSSPropertyBackgroundColor };
23112310 return parseFillShorthand(propId, properties, 7, important);
23122311 }
23132312 case CSSPropertyWebkitMask: {
2314  const int properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
 2313 const CSSPropertyID properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
23152314 CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition,
23162315 CSSPropertyWebkitMaskOrigin, CSSPropertyWebkitMaskClip };
23172316 return parseFillShorthand(propId, properties, 6, important);

@@static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtr<CSSValue>& c
25812580
25822581const int cMaxFillProperties = 9;
25832582
2584 bool CSSParser::parseFillShorthand(int propId, const int* properties, int numProperties, bool important)
 2583bool CSSParser::parseFillShorthand(int propId, const CSSPropertyID* properties, int numProperties, bool important)
25852584{
25862585 ASSERT(numProperties <= cMaxFillProperties);
25872586 if (numProperties > cMaxFillProperties)

@@bool CSSParser::parseTransitionShorthand(bool important)
28342833 return true;
28352834}
28362835
2837 bool CSSParser::parseShorthand(int propId, const CSSPropertyLonghand& longhand, bool important)
 2836bool CSSParser::parseShorthand(int propId, const ShorthandProperties& shorthand, bool important)
28382837{
28392838 // We try to match as many properties as possible
28402839 // We set up an array of booleans to mark which property has been found,

@@bool CSSParser::parseShorthand(int propId, const CSSPropertyLonghand& longhand,
28472846
28482847 while (m_valueList->current()) {
28492848 found = false;
2850  for (unsigned propIndex = 0; !found && propIndex < longhand.length(); ++propIndex) {
2851  if (!propertyFound[propIndex] && parseValue(longhand.properties()[propIndex], important)) {
 2849 for (unsigned propIndex = 0; !found && propIndex < shorthand.length(); ++propIndex) {
 2850 if (!propertyFound[propIndex] && parseValue(shorthand.properties()[propIndex], important)) {
28522851 propertyFound[propIndex] = found = true;
28532852 propertiesParsed++;
28542853 }

@@bool CSSParser::parseShorthand(int propId, const CSSPropertyLonghand& longhand,
28602859 return false;
28612860 }
28622861
2863  if (propertiesParsed == longhand.length())
 2862 if (propertiesParsed == shorthand.length())
28642863 return true;
28652864
28662865 // Fill in any remaining properties with the initial value.
28672866 ImplicitScope implicitScope(this, PropertyImplicit);
2868  const CSSPropertyLonghand* const* const longhandsForInitialization = longhand.longhandsForInitialization();
2869  for (unsigned i = 0; i < longhand.length(); ++i) {
 2867 const ShorthandProperties* const* const longhandsForInitialization = shorthand.longhandsForInitialization();
 2868 for (unsigned i = 0; i < shorthand.length(); ++i) {
28702869 if (propertyFound[i])
28712870 continue;
28722871
28732872 if (longhandsForInitialization) {
2874  const CSSPropertyLonghand& initLonghand = *(longhandsForInitialization[i]);
 2873 const ShorthandProperties& initLonghand = *(longhandsForInitialization[i]);
28752874 for (unsigned propIndex = 0; propIndex < initLonghand.length(); ++propIndex)
28762875 addProperty(initLonghand.properties()[propIndex], cssValuePool()->createImplicitInitialValue(), important);
28772876 } else
2878  addProperty(longhand.properties()[i], cssValuePool()->createImplicitInitialValue(), important);
 2877 addProperty(shorthand.properties()[i], cssValuePool()->createImplicitInitialValue(), important);
28792878 }
28802879
28812880 return true;
28822881}
28832882
2884 bool CSSParser::parse4Values(int propId, const int *properties, bool important)
 2883bool CSSParser::parse4Values(int propId, const CSSPropertyID *properties, bool important)
28852884{
28862885 /* From the CSS 2 specs, 8.3
28872886 * If there is only one value, it applies to all sides. If there are two values, the top and

Source/WebCore/css/CSSParser.h

2828#include "CSSParserMode.h"
2929#include "CSSParserValues.h"
3030#include "CSSProperty.h"
 31#include "CSSPropertyNames.h"
3132#include "CSSPropertySourceData.h"
3233#include "CSSSelector.h"
3334#include "Color.h"

@@namespace WebCore {
4647
4748class CSSBorderImageSliceValue;
4849class CSSPrimitiveValue;
49 class CSSPropertyLonghand;
5050class CSSValuePool;
5151class CSSProperty;
5252class CSSRule;

@@class CSSWrapShape;
5858class Document;
5959class MediaQueryExp;
6060class MediaQuerySet;
 61class ShorthandProperties;
6162class StylePropertySet;
6263class StyledElement;
6364class WebKitCSSKeyframeRule;

@@public:
9293 bool hasProperties() const { return !m_parsedProperties.isEmpty(); }
9394
9495 bool parseValue(int propId, bool important);
95  bool parseShorthand(int, const CSSPropertyLonghand&, bool);
96  bool parse4Values(int propId, const int* properties, bool important);
 96 bool parseShorthand(int, const ShorthandProperties&, bool);
 97 bool parse4Values(int propId, const CSSPropertyID* properties, bool important);
9798 bool parseContent(int propId, bool important);
9899 bool parseQuotes(int propId, bool important);
99100

@@public:
113114 PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
114115
115116 bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
116  bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important);
 117 bool parseFillShorthand(int propId, const CSSPropertyID* properties, int numProperties, bool important);
117118
118119 void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
119120

Source/WebCore/css/CSSProperty.cpp

@@String CSSProperty::cssText() const
3636enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
3737enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
3838
39 static int resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const CSSPropertyLonghand& longhand)
 39static int resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const ShorthandProperties& shorthand)
4040{
4141 if (direction == LTR) {
4242 if (writingMode == TopToBottomWritingMode) {
4343 // The common case. The logical and physical box sides match.
4444 // Left = Start, Right = End, Before = Top, After = Bottom
45  return longhand.properties()[logicalSide];
 45 return shorthand.properties()[logicalSide];
4646 }
4747
4848 if (writingMode == BottomToTopWritingMode) {
4949 // Start = Left, End = Right, Before = Bottom, After = Top.
5050 switch (logicalSide) {
5151 case StartSide:
52  return longhand.properties()[LeftSide];
 52 return shorthand.properties()[LeftSide];
5353 case EndSide:
54  return longhand.properties()[RightSide];
 54 return shorthand.properties()[RightSide];
5555 case BeforeSide:
56  return longhand.properties()[BottomSide];
 56 return shorthand.properties()[BottomSide];
5757 default:
58  return longhand.properties()[TopSide];
 58 return shorthand.properties()[TopSide];
5959 }
6060 }
6161

@@static int resolveToPhysicalProperty(TextDirection direction, WritingMode writin
6363 // Start = Top, End = Bottom, Before = Left, After = Right.
6464 switch (logicalSide) {
6565 case StartSide:
66  return longhand.properties()[TopSide];
 66 return shorthand.properties()[TopSide];
6767 case EndSide:
68  return longhand.properties()[BottomSide];
 68 return shorthand.properties()[BottomSide];
6969 case BeforeSide:
70  return longhand.properties()[LeftSide];
 70 return shorthand.properties()[LeftSide];
7171 default:
72  return longhand.properties()[RightSide];
 72 return shorthand.properties()[RightSide];
7373 }
7474 }
7575
7676 // Start = Top, End = Bottom, Before = Right, After = Left
7777 switch (logicalSide) {
7878 case StartSide:
79  return longhand.properties()[TopSide];
 79 return shorthand.properties()[TopSide];
8080 case EndSide:
81  return longhand.properties()[BottomSide];
 81 return shorthand.properties()[BottomSide];
8282 case BeforeSide:
83  return longhand.properties()[RightSide];
 83 return shorthand.properties()[RightSide];
8484 default:
85  return longhand.properties()[LeftSide];
 85 return shorthand.properties()[LeftSide];
8686 }
8787 }
8888

@@static int resolveToPhysicalProperty(TextDirection direction, WritingMode writin
9090 // Start = Right, End = Left, Before = Top, After = Bottom
9191 switch (logicalSide) {
9292 case StartSide:
93  return longhand.properties()[RightSide];
 93 return shorthand.properties()[RightSide];
9494 case EndSide:
95  return longhand.properties()[LeftSide];
 95 return shorthand.properties()[LeftSide];
9696 case BeforeSide:
97  return longhand.properties()[TopSide];
 97 return shorthand.properties()[TopSide];
9898 default:
99  return longhand.properties()[BottomSide];
 99 return shorthand.properties()[BottomSide];
100100 }
101101 }
102102

@@static int resolveToPhysicalProperty(TextDirection direction, WritingMode writin
104104 // Start = Right, End = Left, Before = Bottom, After = Top
105105 switch (logicalSide) {
106106 case StartSide:
107  return longhand.properties()[RightSide];
 107 return shorthand.properties()[RightSide];
108108 case EndSide:
109  return longhand.properties()[LeftSide];
 109 return shorthand.properties()[LeftSide];
110110 case BeforeSide:
111  return longhand.properties()[BottomSide];
 111 return shorthand.properties()[BottomSide];
112112 default:
113  return longhand.properties()[TopSide];
 113 return shorthand.properties()[TopSide];
114114 }
115115 }
116116

@@static int resolveToPhysicalProperty(TextDirection direction, WritingMode writin
118118 // Start = Bottom, End = Top, Before = Left, After = Right
119119 switch (logicalSide) {
120120 case StartSide:
121  return longhand.properties()[BottomSide];
 121 return shorthand.properties()[BottomSide];
122122 case EndSide:
123  return longhand.properties()[TopSide];
 123 return shorthand.properties()[TopSide];
124124 case BeforeSide:
125  return longhand.properties()[LeftSide];
 125 return shorthand.properties()[LeftSide];
126126 default:
127  return longhand.properties()[RightSide];
 127 return shorthand.properties()[RightSide];
128128 }
129129 }
130130
131131 // Start = Bottom, End = Top, Before = Right, After = Left
132132 switch (logicalSide) {
133133 case StartSide:
134  return longhand.properties()[BottomSide];
 134 return shorthand.properties()[BottomSide];
135135 case EndSide:
136  return longhand.properties()[TopSide];
 136 return shorthand.properties()[TopSide];
137137 case BeforeSide:
138  return longhand.properties()[RightSide];
 138 return shorthand.properties()[RightSide];
139139 default:
140  return longhand.properties()[LeftSide];
 140 return shorthand.properties()[LeftSide];
141141 }
142142}
143143
144144enum LogicalExtent { LogicalWidth, LogicalHeight };
145145
146 static int resolveToPhysicalProperty(WritingMode writingMode, LogicalExtent logicalSide, const int* properties)
 146static int resolveToPhysicalProperty(WritingMode writingMode, LogicalExtent logicalSide, const CSSPropertyID* properties)
147147{
148148 if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode)
149149 return properties[logicalSide];
150150 return logicalSide == LogicalWidth ? properties[1] : properties[0];
151151}
152152
153 static const CSSPropertyLonghand& borderDirections()
 153static const ShorthandProperties& borderDirections()
154154{
155  static const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
156  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderDirections, (properties, WTF_ARRAY_LENGTH(properties)));
 155 static const CSSPropertyID properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
 156 DEFINE_STATIC_LOCAL(ShorthandProperties, borderDirections, (properties, WTF_ARRAY_LENGTH(properties)));
157157 return borderDirections;
158158}
159159

@@int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection dir
209209 case CSSPropertyWebkitBorderAfterWidth:
210210 return resolveToPhysicalProperty(direction, writingMode, AfterSide, borderWidthLonghand());
211211 case CSSPropertyWebkitLogicalWidth: {
212  const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
 212 const CSSPropertyID properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
213213 return resolveToPhysicalProperty(writingMode, LogicalWidth, properties);
214214 }
215215 case CSSPropertyWebkitLogicalHeight: {
216  const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
 216 const CSSPropertyID properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
217217 return resolveToPhysicalProperty(writingMode, LogicalHeight, properties);
218218 }
219219 case CSSPropertyWebkitMinLogicalWidth: {
220  const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
 220 const CSSPropertyID properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
221221 return resolveToPhysicalProperty(writingMode, LogicalWidth, properties);
222222 }
223223 case CSSPropertyWebkitMinLogicalHeight: {
224  const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
 224 const CSSPropertyID properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
225225 return resolveToPhysicalProperty(writingMode, LogicalHeight, properties);
226226 }
227227 case CSSPropertyWebkitMaxLogicalWidth: {
228  const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
 228 const CSSPropertyID properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
229229 return resolveToPhysicalProperty(writingMode, LogicalWidth, properties);
230230 }
231231 case CSSPropertyWebkitMaxLogicalHeight: {
232  const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
 232 const CSSPropertyID properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
233233 return resolveToPhysicalProperty(writingMode, LogicalHeight, properties);
234234 }
235235 default:

Source/WebCore/css/CSSPropertyLonghand.cpp

2121#include "config.h"
2222#include "CSSPropertyLonghand.h"
2323
24 #include "CSSPropertyNames.h"
2524#include <wtf/StdLibExtras.h>
2625
2726namespace WebCore {
2827
2928// FIXME: Add CSSPropertyBackgroundSize to the shorthand.
30 const CSSPropertyLonghand& backgroundLonghand()
 29const ShorthandProperties& backgroundLonghand()
3130{
32  static const int backgroundProperties[] = {
 31 static const CSSPropertyID backgroundProperties[] = {
3332 CSSPropertyBackgroundColor,
3433 CSSPropertyBackgroundImage,
3534 CSSPropertyBackgroundRepeatX,

@@const CSSPropertyLonghand& backgroundLonghand()
4039 CSSPropertyBackgroundClip,
4140 CSSPropertyBackgroundOrigin
4241 };
43  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, backgroundLonghand, (backgroundProperties, WTF_ARRAY_LENGTH(backgroundProperties)));
 42 DEFINE_STATIC_LOCAL(ShorthandProperties, backgroundLonghand, (backgroundProperties, WTF_ARRAY_LENGTH(backgroundProperties)));
4443 return backgroundLonghand;
4544}
4645
47 const CSSPropertyLonghand& backgroundPositionLonghand()
 46const ShorthandProperties& backgroundPositionLonghand()
4847{
49  static const int backgroundPositionProperties[] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY };
50  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, backgroundPositionLonghand, (backgroundPositionProperties, WTF_ARRAY_LENGTH(backgroundPositionProperties)));
 48 static const CSSPropertyID backgroundPositionProperties[] = { CSSPropertyBackgroundPositionX, CSSPropertyBackgroundPositionY };
 49 DEFINE_STATIC_LOCAL(ShorthandProperties, backgroundPositionLonghand, (backgroundPositionProperties, WTF_ARRAY_LENGTH(backgroundPositionProperties)));
5150 return backgroundPositionLonghand;
5251}
5352
54 const CSSPropertyLonghand& backgroundRepeatLonghand()
 53const ShorthandProperties& backgroundRepeatLonghand()
5554{
56  static const int backgroundRepeatProperties[] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY };
57  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, backgroundRepeatLonghand, (backgroundRepeatProperties, WTF_ARRAY_LENGTH(backgroundRepeatProperties)));
 55 static const CSSPropertyID backgroundRepeatProperties[] = { CSSPropertyBackgroundRepeatX, CSSPropertyBackgroundRepeatY };
 56 DEFINE_STATIC_LOCAL(ShorthandProperties, backgroundRepeatLonghand, (backgroundRepeatProperties, WTF_ARRAY_LENGTH(backgroundRepeatProperties)));
5857 return backgroundRepeatLonghand;
5958}
6059
61 const CSSPropertyLonghand& borderLonghand()
 60const ShorthandProperties& borderLonghand()
6261{
6362 // Do not change the order of the following four shorthands, and keep them together.
64  static const int borderProperties[4][3] = {
 63 static const CSSPropertyID borderProperties[4][3] = {
6564 { CSSPropertyBorderTopColor, CSSPropertyBorderTopStyle, CSSPropertyBorderTopWidth },
6665 { CSSPropertyBorderRightColor, CSSPropertyBorderRightStyle, CSSPropertyBorderRightWidth },
6766 { CSSPropertyBorderBottomColor, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomWidth },
6867 { CSSPropertyBorderLeftColor, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftWidth }
6968 };
70  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderLonghand, (borderProperties[0], sizeof(borderProperties) / sizeof(borderProperties[0][0])));
 69 DEFINE_STATIC_LOCAL(ShorthandProperties, borderLonghand, (borderProperties[0], sizeof(borderProperties) / sizeof(borderProperties[0][0])));
7170 return borderLonghand;
7271}
7372
74 const CSSPropertyLonghand& borderAbridgedLonghand()
 73const ShorthandProperties& borderAbridgedLonghand()
7574{
76  static const int borderAbridgedProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor };
77  static const CSSPropertyLonghand* propertiesForInitialization[] = {
 75 static const CSSPropertyID borderAbridgedProperties[] = { CSSPropertyBorderWidth, CSSPropertyBorderStyle, CSSPropertyBorderColor };
 76 static const ShorthandProperties* propertiesForInitialization[] = {
7877 &borderWidthLonghand(),
7978 &borderStyleLonghand(),
8079 &borderColorLonghand(),
8180 };
82  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderAbridgedLonghand,
 81 DEFINE_STATIC_LOCAL(ShorthandProperties, borderAbridgedLonghand,
8382 (borderAbridgedProperties, propertiesForInitialization, WTF_ARRAY_LENGTH(borderAbridgedProperties)));
8483 return borderAbridgedLonghand;
8584}
8685
87 const CSSPropertyLonghand& borderBottomLonghand()
 86const ShorthandProperties& borderBottomLonghand()
8887{
89  static const int borderBottomProperties[] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomColor };
90  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderBottomLonghand, (borderBottomProperties, WTF_ARRAY_LENGTH(borderBottomProperties)));
 88 static const CSSPropertyID borderBottomProperties[] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle, CSSPropertyBorderBottomColor };
 89 DEFINE_STATIC_LOCAL(ShorthandProperties, borderBottomLonghand, (borderBottomProperties, WTF_ARRAY_LENGTH(borderBottomProperties)));
9190 return borderBottomLonghand;
9291}
9392
94 const CSSPropertyLonghand& borderColorLonghand()
 93const ShorthandProperties& borderColorLonghand()
9594{
96  static const int borderColorProperties[] = {
 95 static const CSSPropertyID borderColorProperties[] = {
9796 CSSPropertyBorderTopColor,
9897 CSSPropertyBorderRightColor,
9998 CSSPropertyBorderBottomColor,
10099 CSSPropertyBorderLeftColor
101100 };
102  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderColorLonghand, (borderColorProperties, WTF_ARRAY_LENGTH(borderColorProperties)));
 101 DEFINE_STATIC_LOCAL(ShorthandProperties, borderColorLonghand, (borderColorProperties, WTF_ARRAY_LENGTH(borderColorProperties)));
103102 return borderColorLonghand;
104103}
105104
106 const CSSPropertyLonghand& borderImageLonghand()
 105const ShorthandProperties& borderImageLonghand()
107106{
108  static const int borderImageProperties[] = {
 107 static const CSSPropertyID borderImageProperties[] = {
109108 CSSPropertyBorderImageSource,
110109 CSSPropertyBorderImageSlice,
111110 CSSPropertyBorderImageWidth,
112111 CSSPropertyBorderImageOutset,
113112 CSSPropertyBorderImageRepeat
114113 };
115  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderImageLonghand, (borderImageProperties, WTF_ARRAY_LENGTH(borderImageProperties)));
 114 DEFINE_STATIC_LOCAL(ShorthandProperties, borderImageLonghand, (borderImageProperties, WTF_ARRAY_LENGTH(borderImageProperties)));
116115 return borderImageLonghand;
117116}
118117
119 const CSSPropertyLonghand& borderLeftLonghand()
 118const ShorthandProperties& borderLeftLonghand()
120119{
121  static const int borderLeftProperties[] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftColor };
122  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderLeftLonghand, (borderLeftProperties, WTF_ARRAY_LENGTH(borderLeftProperties)));
 120 static const CSSPropertyID borderLeftProperties[] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle, CSSPropertyBorderLeftColor };
 121 DEFINE_STATIC_LOCAL(ShorthandProperties, borderLeftLonghand, (borderLeftProperties, WTF_ARRAY_LENGTH(borderLeftProperties)));
123122 return borderLeftLonghand;
124123}
125124
126 const CSSPropertyLonghand& borderRadiusLonghand()
 125const ShorthandProperties& borderRadiusLonghand()
127126{
128  static const int borderRadiusProperties[] = {
 127 static const CSSPropertyID borderRadiusProperties[] = {
129128 CSSPropertyBorderTopRightRadius,
130129 CSSPropertyBorderTopLeftRadius,
131130 CSSPropertyBorderBottomLeftRadius,
132131 CSSPropertyBorderBottomRightRadius
133132 };
134  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderRadiusLonghand, (borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties)));
 133 DEFINE_STATIC_LOCAL(ShorthandProperties, borderRadiusLonghand, (borderRadiusProperties, WTF_ARRAY_LENGTH(borderRadiusProperties)));
135134 return borderRadiusLonghand;
136135}
137136
138 const CSSPropertyLonghand& borderRightLonghand()
 137const ShorthandProperties& borderRightLonghand()
139138{
140  static const int borderRightProperties[] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, CSSPropertyBorderRightColor };
141  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderRightLonghand, (borderRightProperties, WTF_ARRAY_LENGTH(borderRightProperties)));
 139 static const CSSPropertyID borderRightProperties[] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle, CSSPropertyBorderRightColor };
 140 DEFINE_STATIC_LOCAL(ShorthandProperties, borderRightLonghand, (borderRightProperties, WTF_ARRAY_LENGTH(borderRightProperties)));
142141 return borderRightLonghand;
143142}
144143
145 const CSSPropertyLonghand& borderSpacingLonghand()
 144const ShorthandProperties& borderSpacingLonghand()
146145{
147  static const int borderSpacingProperties[] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing };
148  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderSpacingLonghand, (borderSpacingProperties, WTF_ARRAY_LENGTH(borderSpacingProperties)));
 146 static const CSSPropertyID borderSpacingProperties[] = { CSSPropertyWebkitBorderHorizontalSpacing, CSSPropertyWebkitBorderVerticalSpacing };
 147 DEFINE_STATIC_LOCAL(ShorthandProperties, borderSpacingLonghand, (borderSpacingProperties, WTF_ARRAY_LENGTH(borderSpacingProperties)));
149148 return borderSpacingLonghand;
150149}
151150
152 const CSSPropertyLonghand& borderStyleLonghand()
 151const ShorthandProperties& borderStyleLonghand()
153152{
154  static const int borderStyleProperties[] = {
 153 static const CSSPropertyID borderStyleProperties[] = {
155154 CSSPropertyBorderTopStyle,
156155 CSSPropertyBorderRightStyle,
157156 CSSPropertyBorderBottomStyle,
158157 CSSPropertyBorderLeftStyle
159158 };
160  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderStyleLonghand, (borderStyleProperties, WTF_ARRAY_LENGTH(borderStyleProperties)));
 159 DEFINE_STATIC_LOCAL(ShorthandProperties, borderStyleLonghand, (borderStyleProperties, WTF_ARRAY_LENGTH(borderStyleProperties)));
161160 return borderStyleLonghand;
162161}
163162
164 const CSSPropertyLonghand& borderTopLonghand()
 163const ShorthandProperties& borderTopLonghand()
165164{
166  static const int borderTopProperties[] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderTopColor };
167  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderTopLonghand, (borderTopProperties, WTF_ARRAY_LENGTH(borderTopProperties)));
 165 static const CSSPropertyID borderTopProperties[] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderTopColor };
 166 DEFINE_STATIC_LOCAL(ShorthandProperties, borderTopLonghand, (borderTopProperties, WTF_ARRAY_LENGTH(borderTopProperties)));
168167 return borderTopLonghand;
169168}
170169
171 const CSSPropertyLonghand& borderWidthLonghand()
 170const ShorthandProperties& borderWidthLonghand()
172171{
173  static const int borderWidthProperties[] = {
 172 static const CSSPropertyID borderWidthProperties[] = {
174173 CSSPropertyBorderTopWidth,
175174 CSSPropertyBorderRightWidth,
176175 CSSPropertyBorderBottomWidth,
177176 CSSPropertyBorderLeftWidth
178177 };
179  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, borderWidthLonghand, (borderWidthProperties, WTF_ARRAY_LENGTH(borderWidthProperties)));
 178 DEFINE_STATIC_LOCAL(ShorthandProperties, borderWidthLonghand, (borderWidthProperties, WTF_ARRAY_LENGTH(borderWidthProperties)));
180179 return borderWidthLonghand;
181180}
182181
183 const CSSPropertyLonghand& listStyleLonghand()
 182const ShorthandProperties& listStyleLonghand()
184183{
185  static const int listStyleProperties[] = {
 184 static const CSSPropertyID listStyleProperties[] = {
186185 CSSPropertyListStyleType,
187186 CSSPropertyListStylePosition,
188187 CSSPropertyListStyleImage
189188 };
190  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, listStyleLonghand, (listStyleProperties, WTF_ARRAY_LENGTH(listStyleProperties)));
 189 DEFINE_STATIC_LOCAL(ShorthandProperties, listStyleLonghand, (listStyleProperties, WTF_ARRAY_LENGTH(listStyleProperties)));
191190 return listStyleLonghand;
192191}
193192
194 const CSSPropertyLonghand& fontLonghand()
 193const ShorthandProperties& fontLonghand()
195194{
196  static const int fontProperties[] = {
 195 static const CSSPropertyID fontProperties[] = {
197196 CSSPropertyFontFamily,
198197 CSSPropertyFontSize,
199198 CSSPropertyFontStyle,

@@const CSSPropertyLonghand& fontLonghand()
201200 CSSPropertyFontWeight,
202201 CSSPropertyLineHeight
203202 };
204  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, fontLonghand, (fontProperties, WTF_ARRAY_LENGTH(fontProperties)));
 203 DEFINE_STATIC_LOCAL(ShorthandProperties, fontLonghand, (fontProperties, WTF_ARRAY_LENGTH(fontProperties)));
205204 return fontLonghand;
206205}
207206
208 const CSSPropertyLonghand& marginLonghand()
 207const ShorthandProperties& marginLonghand()
209208{
210  static const int marginProperties[] = {
 209 static const CSSPropertyID marginProperties[] = {
211210 CSSPropertyMarginTop,
212211 CSSPropertyMarginRight,
213212 CSSPropertyMarginBottom,
214213 CSSPropertyMarginLeft
215214 };
216  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, marginLonghand, (marginProperties, WTF_ARRAY_LENGTH(marginProperties)));
 215 DEFINE_STATIC_LOCAL(ShorthandProperties, marginLonghand, (marginProperties, WTF_ARRAY_LENGTH(marginProperties)));
217216 return marginLonghand;
218217}
219218
220 const CSSPropertyLonghand& outlineLonghand()
 219const ShorthandProperties& outlineLonghand()
221220{
222  static const int outlineProperties[] = {
 221 static const CSSPropertyID outlineProperties[] = {
223222 CSSPropertyOutlineColor,
224223 CSSPropertyOutlineStyle,
225224 CSSPropertyOutlineWidth
226225 };
227  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, outlineLonghand, (outlineProperties, WTF_ARRAY_LENGTH(outlineProperties)));
 226 DEFINE_STATIC_LOCAL(ShorthandProperties, outlineLonghand, (outlineProperties, WTF_ARRAY_LENGTH(outlineProperties)));
228227 return outlineLonghand;
229228}
230229
231 const CSSPropertyLonghand& overflowLonghand()
 230const ShorthandProperties& overflowLonghand()
232231{
233  static const int overflowProperties[] = { CSSPropertyOverflowX, CSSPropertyOverflowY };
234  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, overflowLonghand, (overflowProperties, WTF_ARRAY_LENGTH(overflowProperties)));
 232 static const CSSPropertyID overflowProperties[] = { CSSPropertyOverflowX, CSSPropertyOverflowY };
 233 DEFINE_STATIC_LOCAL(ShorthandProperties, overflowLonghand, (overflowProperties, WTF_ARRAY_LENGTH(overflowProperties)));
235234 return overflowLonghand;
236235}
237236
238 const CSSPropertyLonghand& paddingLonghand()
 237const ShorthandProperties& paddingLonghand()
239238{
240  static const int paddingProperties[] = {
 239 static const CSSPropertyID paddingProperties[] = {
241240 CSSPropertyPaddingTop,
242241 CSSPropertyPaddingRight,
243242 CSSPropertyPaddingBottom,
244243 CSSPropertyPaddingLeft
245244 };
246  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, paddingLonghand, (paddingProperties, WTF_ARRAY_LENGTH(paddingProperties)));
 245 DEFINE_STATIC_LOCAL(ShorthandProperties, paddingLonghand, (paddingProperties, WTF_ARRAY_LENGTH(paddingProperties)));
247246 return paddingLonghand;
248247}
249248
250 const CSSPropertyLonghand& webkitAnimationLonghand()
 249const ShorthandProperties& webkitAnimationLonghand()
251250{
252  static const int animationProperties[] = {
 251 static const CSSPropertyID animationProperties[] = {
253252 CSSPropertyWebkitAnimationName,
254253 CSSPropertyWebkitAnimationDuration,
255254 CSSPropertyWebkitAnimationTimingFunction,

@@const CSSPropertyLonghand& webkitAnimationLonghand()
258257 CSSPropertyWebkitAnimationDirection,
259258 CSSPropertyWebkitAnimationFillMode
260259 };
261  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitAnimationLonghand, (animationProperties, WTF_ARRAY_LENGTH(animationProperties)));
 260 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitAnimationLonghand, (animationProperties, WTF_ARRAY_LENGTH(animationProperties)));
262261 return webkitAnimationLonghand;
263262}
264263
265 const CSSPropertyLonghand& webkitBorderAfterLonghand()
 264const ShorthandProperties& webkitBorderAfterLonghand()
266265{
267  static const int borderAfterProperties[] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle, CSSPropertyWebkitBorderAfterColor };
268  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitBorderAfterLonghand, (borderAfterProperties, WTF_ARRAY_LENGTH(borderAfterProperties)));
 266 static const CSSPropertyID borderAfterProperties[] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle, CSSPropertyWebkitBorderAfterColor };
 267 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitBorderAfterLonghand, (borderAfterProperties, WTF_ARRAY_LENGTH(borderAfterProperties)));
269268 return webkitBorderAfterLonghand;
270269}
271270
272 const CSSPropertyLonghand& webkitBorderBeforeLonghand()
 271const ShorthandProperties& webkitBorderBeforeLonghand()
273272{
274  static const int borderBeforeProperties[] = { CSSPropertyWebkitBorderBeforeWidth, CSSPropertyWebkitBorderBeforeStyle, CSSPropertyWebkitBorderBeforeColor };
275  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitBorderBeforeLonghand, (borderBeforeProperties, WTF_ARRAY_LENGTH(borderBeforeProperties)));
 273 static const CSSPropertyID borderBeforeProperties[] = { CSSPropertyWebkitBorderBeforeWidth, CSSPropertyWebkitBorderBeforeStyle, CSSPropertyWebkitBorderBeforeColor };
 274 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitBorderBeforeLonghand, (borderBeforeProperties, WTF_ARRAY_LENGTH(borderBeforeProperties)));
276275 return webkitBorderBeforeLonghand;
277276}
278277
279 const CSSPropertyLonghand& webkitBorderEndLonghand()
 278const ShorthandProperties& webkitBorderEndLonghand()
280279{
281  static const int borderEndProperties[] = { CSSPropertyWebkitBorderEndWidth, CSSPropertyWebkitBorderEndStyle, CSSPropertyWebkitBorderEndColor };
282  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitBorderEndLonghand, (borderEndProperties, WTF_ARRAY_LENGTH(borderEndProperties)));
 280 static const CSSPropertyID borderEndProperties[] = { CSSPropertyWebkitBorderEndWidth, CSSPropertyWebkitBorderEndStyle, CSSPropertyWebkitBorderEndColor };
 281 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitBorderEndLonghand, (borderEndProperties, WTF_ARRAY_LENGTH(borderEndProperties)));
283282 return webkitBorderEndLonghand;
284283}
285284
286 const CSSPropertyLonghand& webkitBorderStartLonghand()
 285const ShorthandProperties& webkitBorderStartLonghand()
287286{
288  static const int borderStartProperties[] = { CSSPropertyWebkitBorderStartWidth, CSSPropertyWebkitBorderStartStyle, CSSPropertyWebkitBorderStartColor };
289  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitBorderStartLonghand, (borderStartProperties, WTF_ARRAY_LENGTH(borderStartProperties)));
 287 static const CSSPropertyID borderStartProperties[] = { CSSPropertyWebkitBorderStartWidth, CSSPropertyWebkitBorderStartStyle, CSSPropertyWebkitBorderStartColor };
 288 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitBorderStartLonghand, (borderStartProperties, WTF_ARRAY_LENGTH(borderStartProperties)));
290289 return webkitBorderStartLonghand;
291290}
292291
293 const CSSPropertyLonghand& webkitColumnsLonghand()
 292const ShorthandProperties& webkitColumnsLonghand()
294293{
295  static const int columnsProperties[] = { CSSPropertyWebkitColumnWidth, CSSPropertyWebkitColumnCount };
296  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitColumnsLonghand, (columnsProperties, WTF_ARRAY_LENGTH(columnsProperties)));
 294 static const CSSPropertyID columnsProperties[] = { CSSPropertyWebkitColumnWidth, CSSPropertyWebkitColumnCount };
 295 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitColumnsLonghand, (columnsProperties, WTF_ARRAY_LENGTH(columnsProperties)));
297296 return webkitColumnsLonghand;
298297}
299298
300 const CSSPropertyLonghand& webkitColumnRuleLonghand()
 299const ShorthandProperties& webkitColumnRuleLonghand()
301300{
302  static const int columnRuleProperties[] = {
 301 static const CSSPropertyID columnRuleProperties[] = {
303302 CSSPropertyWebkitColumnRuleWidth,
304303 CSSPropertyWebkitColumnRuleStyle,
305304 CSSPropertyWebkitColumnRuleColor,
306305 };
307  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitColumnRuleLonghand, (columnRuleProperties, WTF_ARRAY_LENGTH(columnRuleProperties)));
 306 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitColumnRuleLonghand, (columnRuleProperties, WTF_ARRAY_LENGTH(columnRuleProperties)));
308307 return webkitColumnRuleLonghand;
309308}
310309
311 const CSSPropertyLonghand& webkitFlexFlowLonghand()
 310const ShorthandProperties& webkitFlexFlowLonghand()
312311{
313  static const int flexFlowProperties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap };
314  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitFlexFlowLonghand, (flexFlowProperties, WTF_ARRAY_LENGTH(flexFlowProperties)));
 312 static const CSSPropertyID flexFlowProperties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap };
 313 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitFlexFlowLonghand, (flexFlowProperties, WTF_ARRAY_LENGTH(flexFlowProperties)));
315314 return webkitFlexFlowLonghand;
316315}
317316
318 const CSSPropertyLonghand& webkitMarginCollapseLonghand()
 317const ShorthandProperties& webkitMarginCollapseLonghand()
319318{
320  static const int marginCollapseProperties[] = { CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse };
321  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitMarginCollapseLonghand, (marginCollapseProperties, WTF_ARRAY_LENGTH(marginCollapseProperties)));
 319 static const CSSPropertyID marginCollapseProperties[] = { CSSPropertyWebkitMarginBeforeCollapse, CSSPropertyWebkitMarginAfterCollapse };
 320 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitMarginCollapseLonghand, (marginCollapseProperties, WTF_ARRAY_LENGTH(marginCollapseProperties)));
322321 return webkitMarginCollapseLonghand;
323322}
324323
325 const CSSPropertyLonghand& webkitMarqueeLonghand()
 324const ShorthandProperties& webkitMarqueeLonghand()
326325{
327  static const int marqueeProperties[] = {
 326 static const CSSPropertyID marqueeProperties[] = {
328327 CSSPropertyWebkitMarqueeDirection,
329328 CSSPropertyWebkitMarqueeIncrement,
330329 CSSPropertyWebkitMarqueeRepetition,
331330 CSSPropertyWebkitMarqueeStyle,
332331 CSSPropertyWebkitMarqueeSpeed
333332 };
334  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitMarqueeLonghand, (marqueeProperties, WTF_ARRAY_LENGTH(marqueeProperties)));
 333 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitMarqueeLonghand, (marqueeProperties, WTF_ARRAY_LENGTH(marqueeProperties)));
335334 return webkitMarqueeLonghand;
336335}
337336
338 const CSSPropertyLonghand& webkitMaskLonghand()
 337const ShorthandProperties& webkitMaskLonghand()
339338{
340  static const int maskProperties[] = {
 339 static const CSSPropertyID maskProperties[] = {
341340 CSSPropertyWebkitMaskImage,
342341 CSSPropertyWebkitMaskRepeatX,
343342 CSSPropertyWebkitMaskRepeatY,

@@const CSSPropertyLonghand& webkitMaskLonghand()
347346 CSSPropertyWebkitMaskClip,
348347 CSSPropertyWebkitMaskOrigin
349348 };
350  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitMaskLonghand, (maskProperties, WTF_ARRAY_LENGTH(maskProperties)));
 349 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitMaskLonghand, (maskProperties, WTF_ARRAY_LENGTH(maskProperties)));
351350 return webkitMaskLonghand;
352351}
353352
354 const CSSPropertyLonghand& webkitMaskPositionLonghand()
 353const ShorthandProperties& webkitMaskPositionLonghand()
355354{
356  static const int maskPositionProperties[] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY };
357  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitMaskPositionLonghand, (maskPositionProperties, WTF_ARRAY_LENGTH(maskPositionProperties)));
 355 static const CSSPropertyID maskPositionProperties[] = { CSSPropertyWebkitMaskPositionX, CSSPropertyWebkitMaskPositionY };
 356 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitMaskPositionLonghand, (maskPositionProperties, WTF_ARRAY_LENGTH(maskPositionProperties)));
358357 return webkitMaskPositionLonghand;
359358}
360359
361 const CSSPropertyLonghand& webkitMaskRepeatLonghand()
 360const ShorthandProperties& webkitMaskRepeatLonghand()
362361{
363  static const int maskRepeatProperties[] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY };
364  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitMaskRepeatLonghand, (maskRepeatProperties, WTF_ARRAY_LENGTH(maskRepeatProperties)));
 362 static const CSSPropertyID maskRepeatProperties[] = { CSSPropertyWebkitMaskRepeatX, CSSPropertyWebkitMaskRepeatY };
 363 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitMaskRepeatLonghand, (maskRepeatProperties, WTF_ARRAY_LENGTH(maskRepeatProperties)));
365364 return webkitMaskRepeatLonghand;
366365}
367366
368 const CSSPropertyLonghand& webkitTextEmphasisLonghand()
 367const ShorthandProperties& webkitTextEmphasisLonghand()
369368{
370  static const int textEmphasisProperties[] = {
 369 static const CSSPropertyID textEmphasisProperties[] = {
371370 CSSPropertyWebkitTextEmphasisStyle,
372371 CSSPropertyWebkitTextEmphasisColor
373372 };
374  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitTextEmphasisLonghand, (textEmphasisProperties, WTF_ARRAY_LENGTH(textEmphasisProperties)));
 373 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitTextEmphasisLonghand, (textEmphasisProperties, WTF_ARRAY_LENGTH(textEmphasisProperties)));
375374 return webkitTextEmphasisLonghand;
376375}
377376
378 const CSSPropertyLonghand& webkitTextStrokeLonghand()
 377const ShorthandProperties& webkitTextStrokeLonghand()
379378{
380  static const int textStrokeProperties[] = { CSSPropertyWebkitTextStrokeWidth, CSSPropertyWebkitTextStrokeColor };
381  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitTextStrokeLonghand, (textStrokeProperties, WTF_ARRAY_LENGTH(textStrokeProperties)));
 379 static const CSSPropertyID textStrokeProperties[] = { CSSPropertyWebkitTextStrokeWidth, CSSPropertyWebkitTextStrokeColor };
 380 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitTextStrokeLonghand, (textStrokeProperties, WTF_ARRAY_LENGTH(textStrokeProperties)));
382381 return webkitTextStrokeLonghand;
383382}
384383
385 const CSSPropertyLonghand& webkitTransitionLonghand()
 384const ShorthandProperties& webkitTransitionLonghand()
386385{
387  static const int transitionProperties[] = {
 386 static const CSSPropertyID transitionProperties[] = {
388387 CSSPropertyWebkitTransitionProperty,
389388 CSSPropertyWebkitTransitionDuration,
390389 CSSPropertyWebkitTransitionTimingFunction,
391390 CSSPropertyWebkitTransitionDelay
392391 };
393  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitTransitionLonghand, (transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));
 392 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitTransitionLonghand, (transitionProperties, WTF_ARRAY_LENGTH(transitionProperties)));
394393 return webkitTransitionLonghand;
395394}
396395
397 const CSSPropertyLonghand& webkitTransformOriginLonghand()
 396const ShorthandProperties& webkitTransformOriginLonghand()
398397{
399  static const int transformOriginProperties[] = {
 398 static const CSSPropertyID transformOriginProperties[] = {
400399 CSSPropertyWebkitTransformOriginX,
401400 CSSPropertyWebkitTransformOriginY,
402401 CSSPropertyWebkitTransformOriginZ
403402 };
404  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitTransformOriginLonghand, (transformOriginProperties, WTF_ARRAY_LENGTH(transformOriginProperties)));
 403 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitTransformOriginLonghand, (transformOriginProperties, WTF_ARRAY_LENGTH(transformOriginProperties)));
405404 return webkitTransformOriginLonghand;
406405}
407406
408 const CSSPropertyLonghand& webkitWrapLonghand()
 407const ShorthandProperties& webkitWrapLonghand()
409408{
410  static const int webkitWrapProperties[] = {
 409 static const CSSPropertyID webkitWrapProperties[] = {
411410 CSSPropertyWebkitWrapFlow,
412411 CSSPropertyWebkitWrapMargin,
413412 CSSPropertyWebkitWrapPadding
414413 };
415  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, webkitWrapLonghand, (webkitWrapProperties, WTF_ARRAY_LENGTH(webkitWrapProperties)));
 414 DEFINE_STATIC_LOCAL(ShorthandProperties, webkitWrapLonghand, (webkitWrapProperties, WTF_ARRAY_LENGTH(webkitWrapProperties)));
416415 return webkitWrapLonghand;
417416}
418417
419418// Returns an empty list if the property is not a shorthand
420 const CSSPropertyLonghand& longhandForProperty(int propertyID)
 419const ShorthandProperties& longhandsForProperty(int propertyID)
421420{
422421 switch (propertyID) {
423422 case CSSPropertyBackground:

@@const CSSPropertyLonghand& longhandForProperty(int propertyID)
499498 case CSSPropertyWebkitWrap:
500499 return webkitWrapLonghand();
501500 default: {
502  DEFINE_STATIC_LOCAL(CSSPropertyLonghand, defaultLonghand, ());
503  return defaultLonghand;
 501 DEFINE_STATIC_LOCAL(ShorthandProperties, emptyShorthand, ());
 502 return emptyShorthand;
504503 }
505504 }
506505}

Source/WebCore/css/CSSPropertyLonghand.h

2121#ifndef CSSPropertyLonghand_h
2222#define CSSPropertyLonghand_h
2323
 24#include "CSSPropertyNames.h"
 25
2426namespace WebCore {
2527
26 class CSSPropertyLonghand {
 28class ShorthandProperties {
2729public:
28  CSSPropertyLonghand()
 30 ShorthandProperties()
2931 : m_properties(0)
3032 , m_longhandsForInitialization(0)
3133 , m_length(0)
3234 {
3335 }
3436
35  CSSPropertyLonghand(const int* properties, unsigned numProperties)
 37 ShorthandProperties(const CSSPropertyID* properties, unsigned numProperties)
3638 : m_properties(properties)
3739 , m_longhandsForInitialization(0)
3840 , m_length(numProperties)
3941 {
4042 }
4143
42  CSSPropertyLonghand(const int* properties, const CSSPropertyLonghand** longhandsForInitialization, unsigned numProperties)
 44 ShorthandProperties(const CSSPropertyID* properties, const ShorthandProperties** longhandsForInitialization, unsigned numProperties)
4345 : m_properties(properties)
4446 , m_longhandsForInitialization(longhandsForInitialization)
4547 , m_length(numProperties)
4648 {
4749 }
4850
49  const int* properties() const { return m_properties; }
50  const CSSPropertyLonghand** longhandsForInitialization() const { return m_longhandsForInitialization; }
 51 const CSSPropertyID* properties() const { return m_properties; }
 52 const ShorthandProperties** longhandsForInitialization() const { return m_longhandsForInitialization; }
5153 unsigned length() const { return m_length; }
5254
5355private:
54  const int* m_properties;
55  const CSSPropertyLonghand** m_longhandsForInitialization;
 56 const CSSPropertyID* m_properties;
 57 const ShorthandProperties** m_longhandsForInitialization;
5658 unsigned m_length;
5759};
5860
59 const CSSPropertyLonghand& backgroundLonghand();
60 const CSSPropertyLonghand& backgroundPositionLonghand();
61 const CSSPropertyLonghand& backgroundRepeatLonghand();
62 const CSSPropertyLonghand& borderLonghand();
63 const CSSPropertyLonghand& borderAbridgedLonghand();
64 const CSSPropertyLonghand& borderBottomLonghand();
65 const CSSPropertyLonghand& borderColorLonghand();
66 const CSSPropertyLonghand& borderImageLonghand();
67 const CSSPropertyLonghand& borderLeftLonghand();
68 const CSSPropertyLonghand& borderRadiusLonghand();
69 const CSSPropertyLonghand& borderRightLonghand();
70 const CSSPropertyLonghand& borderSpacingLonghand();
71 const CSSPropertyLonghand& borderStyleLonghand();
72 const CSSPropertyLonghand& borderTopLonghand();
73 const CSSPropertyLonghand& borderWidthLonghand();
74 const CSSPropertyLonghand& listStyleLonghand();
75 const CSSPropertyLonghand& fontLonghand();
76 const CSSPropertyLonghand& marginLonghand();
77 const CSSPropertyLonghand& outlineLonghand();
78 const CSSPropertyLonghand& overflowLonghand();
79 const CSSPropertyLonghand& paddingLonghand();
80 const CSSPropertyLonghand& webkitAnimationLonghand();
81 const CSSPropertyLonghand& webkitBorderAfterLonghand();
82 const CSSPropertyLonghand& webkitBorderBeforeLonghand();
83 const CSSPropertyLonghand& webkitBorderEndLonghand();
84 const CSSPropertyLonghand& webkitBorderStartLonghand();
85 const CSSPropertyLonghand& webkitColumnsLonghand();
86 const CSSPropertyLonghand& webkitColumnRuleLonghand();
87 const CSSPropertyLonghand& webkitFlexFlowLonghand();
88 const CSSPropertyLonghand& webkitMarginCollapseLonghand();
89 const CSSPropertyLonghand& webkitMarqueeLonghand();
90 const CSSPropertyLonghand& webkitMaskLonghand();
91 const CSSPropertyLonghand& webkitMaskPositionLonghand();
92 const CSSPropertyLonghand& webkitMaskRepeatLonghand();
93 const CSSPropertyLonghand& webkitTextEmphasisLonghand();
94 const CSSPropertyLonghand& webkitTextStrokeLonghand();
95 const CSSPropertyLonghand& webkitTransitionLonghand();
96 const CSSPropertyLonghand& webkitTransformOriginLonghand();
97 const CSSPropertyLonghand& webkitWrapLonghand();
 61const ShorthandProperties& backgroundLonghand();
 62const ShorthandProperties& backgroundPositionLonghand();
 63const ShorthandProperties& backgroundRepeatLonghand();
 64const ShorthandProperties& borderLonghand();
 65const ShorthandProperties& borderAbridgedLonghand();
 66const ShorthandProperties& borderBottomLonghand();
 67const ShorthandProperties& borderColorLonghand();
 68const ShorthandProperties& borderImageLonghand();
 69const ShorthandProperties& borderLeftLonghand();
 70const ShorthandProperties& borderRadiusLonghand();
 71const ShorthandProperties& borderRightLonghand();
 72const ShorthandProperties& borderSpacingLonghand();
 73const ShorthandProperties& borderStyleLonghand();
 74const ShorthandProperties& borderTopLonghand();
 75const ShorthandProperties& borderWidthLonghand();
 76const ShorthandProperties& listStyleLonghand();
 77const ShorthandProperties& fontLonghand();
 78const ShorthandProperties& marginLonghand();
 79const ShorthandProperties& outlineLonghand();
 80const ShorthandProperties& overflowLonghand();
 81const ShorthandProperties& paddingLonghand();
 82const ShorthandProperties& webkitAnimationLonghand();
 83const ShorthandProperties& webkitBorderAfterLonghand();
 84const ShorthandProperties& webkitBorderBeforeLonghand();
 85const ShorthandProperties& webkitBorderEndLonghand();
 86const ShorthandProperties& webkitBorderStartLonghand();
 87const ShorthandProperties& webkitColumnsLonghand();
 88const ShorthandProperties& webkitColumnRuleLonghand();
 89const ShorthandProperties& webkitFlexFlowLonghand();
 90const ShorthandProperties& webkitMarginCollapseLonghand();
 91const ShorthandProperties& webkitMarqueeLonghand();
 92const ShorthandProperties& webkitMaskLonghand();
 93const ShorthandProperties& webkitMaskPositionLonghand();
 94const ShorthandProperties& webkitMaskRepeatLonghand();
 95const ShorthandProperties& webkitTextEmphasisLonghand();
 96const ShorthandProperties& webkitTextStrokeLonghand();
 97const ShorthandProperties& webkitTransitionLonghand();
 98const ShorthandProperties& webkitTransformOriginLonghand();
 99const ShorthandProperties& webkitWrapLonghand();
98100
99101// Returns an empty list if the property is not a shorthand
100 const CSSPropertyLonghand& longhandForProperty(int);
 102const ShorthandProperties& longhandsForProperty(int);
101103
102104} // namespace WebCore
103105

Source/WebCore/css/StylePropertySet.cpp

2424
2525#include "CSSParser.h"
2626#include "CSSPropertyLonghand.h"
27 #include "CSSPropertyNames.h"
2827#include "CSSValueKeywords.h"
2928#include "CSSValueList.h"
3029#include "CSSValuePool.h"

@@String StylePropertySet::getPropertyValue(int propertyID) const
111110 case CSSPropertyBackground:
112111 return getLayeredShorthandValue(backgroundLonghand());
113112 case CSSPropertyBorder: {
114  const CSSPropertyLonghand properties[3] = { borderWidthLonghand(), borderStyleLonghand(), borderColorLonghand() };
 113 const ShorthandProperties properties[3] = { borderWidthLonghand(), borderStyleLonghand(), borderColorLonghand() };
115114 String res;
116115 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
117116 String value = getCommonValue(properties[i]);

@@String StylePropertySet::getPropertyValue(int propertyID) const
176175 return String();
177176}
178177
179 String StylePropertySet::borderSpacingValue(const CSSPropertyLonghand& longhand) const
 178String StylePropertySet::borderSpacingValue(const ShorthandProperties& shorthand) const
180179{
181  RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(longhand.properties()[0]);
182  RefPtr<CSSValue> verticalValue = getPropertyCSSValue(longhand.properties()[1]);
 180 RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(shorthand.properties()[0]);
 181 RefPtr<CSSValue> verticalValue = getPropertyCSSValue(shorthand.properties()[1]);
183182
184183 if (!horizontalValue)
185184 return String();

@@String StylePropertySet::fontValue() const
248247 return result.toString();
249248}
250249
251 String StylePropertySet::get4Values(const CSSPropertyLonghand& longhand) const
 250String StylePropertySet::get4Values(const ShorthandProperties& shorthand) const
252251{
253252 // Assume the properties are in the usual order top, right, bottom, left.
254  RefPtr<CSSValue> topValue = getPropertyCSSValue(longhand.properties()[0]);
255  RefPtr<CSSValue> rightValue = getPropertyCSSValue(longhand.properties()[1]);
256  RefPtr<CSSValue> bottomValue = getPropertyCSSValue(longhand.properties()[2]);
257  RefPtr<CSSValue> leftValue = getPropertyCSSValue(longhand.properties()[3]);
 253 RefPtr<CSSValue> topValue = getPropertyCSSValue(shorthand.properties()[0]);
 254 RefPtr<CSSValue> rightValue = getPropertyCSSValue(shorthand.properties()[1]);
 255 RefPtr<CSSValue> bottomValue = getPropertyCSSValue(shorthand.properties()[2]);
 256 RefPtr<CSSValue> leftValue = getPropertyCSSValue(shorthand.properties()[3]);
258257
259258 // All 4 properties must be specified.
260259 if (!topValue || !rightValue || !bottomValue || !leftValue)

@@String StylePropertySet::get4Values(const CSSPropertyLonghand& longhand) const
275274 return res;
276275}
277276
278 String StylePropertySet::getLayeredShorthandValue(const CSSPropertyLonghand& longhand) const
 277String StylePropertySet::getLayeredShorthandValue(const ShorthandProperties& shorthand) const
279278{
280279 String res;
281280
282  const unsigned size = longhand.length();
 281 const unsigned size = shorthand.length();
283282 // Begin by collecting the properties into an array.
284283 Vector< RefPtr<CSSValue> > values(size);
285284 size_t numLayers = 0;
286285
287286 for (unsigned i = 0; i < size; ++i) {
288  values[i] = getPropertyCSSValue(longhand.properties()[i]);
 287 values[i] = getPropertyCSSValue(shorthand.properties()[i]);
289288 if (values[i]) {
290289 if (values[i]->isValueList()) {
291290 CSSValueList* valueList = static_cast<CSSValueList*>(values[i].get());

@@String StylePropertySet::getLayeredShorthandValue(const CSSPropertyLonghand& lon
311310 value = values[j];
312311
313312 // Color only belongs in the last layer.
314  if (longhand.properties()[j] == CSSPropertyBackgroundColor) {
 313 if (shorthand.properties()[j] == CSSPropertyBackgroundColor) {
315314 if (i != numLayers - 1)
316315 value = 0;
317316 } else if (i != 0) // Other singletons only belong in the first layer.

@@String StylePropertySet::getLayeredShorthandValue(const CSSPropertyLonghand& lon
322321 // We need to report background-repeat as it was written in the CSS. If the property is implicit,
323322 // then it was written with only one value. Here we figure out which value that was so we can
324323 // report back correctly.
325  if (longhand.properties()[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(longhand.properties()[j])) {
 324 if (shorthand.properties()[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(shorthand.properties()[j])) {
326325
327326 // BUG 49055: make sure the value was not reset in the layer check just above.
328  if (j < size - 1 && longhand.properties()[j + 1] == CSSPropertyBackgroundRepeatY && value) {
 327 if (j < size - 1 && shorthand.properties()[j + 1] == CSSPropertyBackgroundRepeatY && value) {
329328 RefPtr<CSSValue> yValue;
330329 RefPtr<CSSValue> nextValue = values[j + 1];
331330 if (nextValue->isValueList())

@@String StylePropertySet::getLayeredShorthandValue(const CSSPropertyLonghand& lon
376375 return res;
377376}
378377
379 String StylePropertySet::getShorthandValue(const CSSPropertyLonghand& longhand) const
 378String StylePropertySet::getShorthandValue(const ShorthandProperties& shorthand) const
380379{
381380 String res;
382  for (unsigned i = 0; i < longhand.length(); ++i) {
383  if (!isPropertyImplicit(longhand.properties()[i])) {
384  RefPtr<CSSValue> value = getPropertyCSSValue(longhand.properties()[i]);
 381 for (unsigned i = 0; i < shorthand.length(); ++i) {
 382 if (!isPropertyImplicit(shorthand.properties()[i])) {
 383 RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
385384 // FIXME: provide default value if !value or value is initial value
386385 if (value && !value->isInitialValue()) {
387386 if (!res.isNull())

@@String StylePropertySet::getShorthandValue(const CSSPropertyLonghand& longhand)
394393}
395394
396395// only returns a non-null value if all properties have the same, non-null value
397 String StylePropertySet::getCommonValue(const CSSPropertyLonghand& longhand) const
 396String StylePropertySet::getCommonValue(const ShorthandProperties& shorthand) const
398397{
399398 String res;
400  for (unsigned i = 0; i < longhand.length(); ++i) {
401  RefPtr<CSSValue> value = getPropertyCSSValue(longhand.properties()[i]);
 399 for (unsigned i = 0; i < shorthand.length(); ++i) {
 400 RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i]);
402401 // FIXME: CSSInitialValue::cssText should generate the right value.
403402 if (!value || value->isInitialValue())
404403 return String();

@@PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(int propertyID) const
421420
422421bool StylePropertySet::removeShorthandProperty(int propertyID)
423422{
424  CSSPropertyLonghand longhand = longhandForProperty(propertyID);
425  if (!longhand.length())
 423 ShorthandProperties shorthand = longhandsForProperty(propertyID);
 424 if (!shorthand.length())
426425 return false;
427  return removePropertiesInSet(longhand.properties(), longhand.length());
 426 return removePropertiesInSet(shorthand.properties(), shorthand.length());
428427}
429428
430429bool StylePropertySet::removeProperty(int propertyID, String* returnText)

@@bool StylePropertySet::propertyIsImportant(int propertyID) const
459458 if (property)
460459 return property->isImportant();
461460
462  CSSPropertyLonghand longhands = longhandForProperty(propertyID);
463  if (!longhands.length())
 461 ShorthandProperties shorthand = longhandsForProperty(propertyID);
 462 if (!shorthand.length())
464463 return false;
465464
466  for (unsigned i = 0; i < longhands.length(); ++i) {
467  if (!propertyIsImportant(longhands.properties()[i]))
 465 for (unsigned i = 0; i < shorthand.length(); ++i) {
 466 if (!propertyIsImportant(shorthand.properties()[i]))
468467 return false;
469468 }
470469 return true;

@@bool StylePropertySet::setProperty(int propertyID, const String& value, bool imp
498497
499498void StylePropertySet::setProperty(int propertyID, PassRefPtr<CSSValue> prpValue, bool important)
500499{
501  CSSPropertyLonghand longhand = longhandForProperty(propertyID);
502  if (!longhand.length()) {
 500 ShorthandProperties shorthand = longhandsForProperty(propertyID);
 501 if (!shorthand.length()) {
503502 setProperty(CSSProperty(propertyID, prpValue, important));
504503 return;
505504 }
506505
507  removePropertiesInSet(longhand.properties(), longhand.length());
 506 removePropertiesInSet(shorthand.properties(), shorthand.length());
508507
509508 RefPtr<CSSValue> value = prpValue;
510  for (unsigned i = 0; i < longhand.length(); ++i)
511  m_properties.append(CSSProperty(longhand.properties()[i], value, important));
 509 for (unsigned i = 0; i < shorthand.length(); ++i)
 510 m_properties.append(CSSProperty(shorthand.properties()[i], value, important));
512511}
513512
514513void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot)

@@String StylePropertySet::asText() const
608607 if (shorthandPropertyAppeared.get(CSSPropertyBorder - firstCSSProperty))
609608 break;
610609 for (unsigned i = 0; i < borderAbridgedLonghand().length() && shorthandPropertyID; i++) {
611  const CSSPropertyLonghand& longhand = *(borderAbridgedLonghand().longhandsForInitialization()[i]);
 610 const ShorthandProperties& shorthand = *(borderAbridgedLonghand().longhandsForInitialization()[i]);
612611 String commonValue;
613612 bool commonImportance = false;
614  for (size_t j = 0; j < longhand.length(); ++j) {
615  int id = longhand.properties()[j];
 613 for (size_t j = 0; j < shorthand.length(); ++j) {
 614 int id = shorthand.properties()[j];
616615 RefPtr<CSSValue> value = getPropertyCSSValue(id);
617616 String currentValue = value ? value->cssText() : String();
618617 bool isImportant = propertyIsImportant(id);

@@void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls, CSSStyle
804803
805804// This is the list of properties we want to copy in the copyBlockProperties() function.
806805// It is the list of CSS properties that apply specially to block-level elements.
807 static const int blockProperties[] = {
 806static const CSSPropertyID blockProperties[] = {
808807 CSSPropertyOrphans,
809808 CSSPropertyOverflow, // This can be also be applied to replaced elements
810809 CSSPropertyWebkitAspectRatio,

@@void StylePropertySet::removeBlockProperties()
840839 removePropertiesInSet(blockProperties, numBlockProperties);
841840}
842841
843 bool StylePropertySet::removePropertiesInSet(const int* set, unsigned length)
 842bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned length)
844843{
845844 if (m_properties.isEmpty())
846845 return false;

@@PassRefPtr<StylePropertySet> StylePropertySet::copy() const
926925 return adoptRef(new StylePropertySet(m_properties));
927926}
928927
929 PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const int* set, unsigned length) const
 928PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const
930929{
931930 Vector<CSSProperty> list;
932931 list.reserveInitialCapacity(length);

Source/WebCore/css/StylePropertySet.h

2323
2424#include "CSSPrimitiveValue.h"
2525#include "CSSProperty.h"
 26#include "CSSPropertyNames.h"
2627#include <wtf/ListHashSet.h>
2728#include <wtf/Vector.h>
2829#include <wtf/text/WTFString.h>

3031namespace WebCore {
3132
3233class CSSRule;
33 class CSSPropertyLonghand;
3434class CSSStyleDeclaration;
3535class KURL;
3636class PropertySetCSSStyleDeclaration;
 37class ShorthandProperties;
3738class StyledElement;
3839
3940class StylePropertySet : public RefCounted<StylePropertySet> {

@@public:
8283
8384 PassRefPtr<StylePropertySet> copyBlockProperties() const;
8485 void removeBlockProperties();
85  bool removePropertiesInSet(const int* set, unsigned length);
 86 bool removePropertiesInSet(const CSSPropertyID* set, unsigned length);
8687
8788 void merge(const StylePropertySet*, bool argOverridesOnConflict = true);
8889

@@public:
9899 void removeEquivalentProperties(const StylePropertySet*);
99100 void removeEquivalentProperties(const CSSStyleDeclaration*);
100101
101  PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const;
 102 PassRefPtr<StylePropertySet> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
102103
103104 String asText() const;
104105

@@private:
118119
119120 void setNeedsStyleRecalc();
120121
121  String getShorthandValue(const CSSPropertyLonghand&) const;
122  String getCommonValue(const CSSPropertyLonghand&) const;
123  String getLayeredShorthandValue(const CSSPropertyLonghand&) const;
124  String get4Values(const CSSPropertyLonghand&) const;
125  String borderSpacingValue(const CSSPropertyLonghand&) const;
 122 String getShorthandValue(const ShorthandProperties&) const;
 123 String getCommonValue(const ShorthandProperties&) const;
 124 String getLayeredShorthandValue(const ShorthandProperties&) const;
 125 String get4Values(const ShorthandProperties&) const;
 126 String borderSpacingValue(const ShorthandProperties&) const;
126127 String fontValue() const;
127128 bool appendFontLonghandValueIfExplicit(int propertyID, StringBuilder& result) const;
128129

Source/WebCore/editing/EditingStyle.cpp

@@namespace WebCore {
5555
5656// Editing style properties must be preserved during editing operation.
5757// e.g. when a user inserts a new paragraph, all properties listed here must be copied to the new paragraph.
58 static const int editingProperties[] = {
 58static const CSSPropertyID editingProperties[] = {
5959 CSSPropertyBackgroundColor,
6060 CSSPropertyTextDecoration,
6161

@@void EditingStyle::collapseTextDecorationProperties()
603603}
604604
605605// CSS properties that create a visual difference only when applied to text.
606 static const int textOnlyProperties[] = {
 606static const CSSPropertyID textOnlyProperties[] = {
607607 CSSPropertyTextDecoration,
608608 CSSPropertyWebkitTextDecorationsInEffect,
609609 CSSPropertyFontStyle,

@@void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element)
10841084static void removePropertiesInStyle(StylePropertySet* styleToRemovePropertiesFrom, StylePropertySet* style)
10851085{
10861086 unsigned propertyCount = style->propertyCount();
1087  Vector<int> propertiesToRemove(propertyCount);
 1087 Vector<CSSPropertyID> propertiesToRemove(propertyCount);
10881088 for (unsigned i = 0; i < propertyCount; ++i)
1089  propertiesToRemove[i] = style->propertyAt(i).id();
 1089 propertiesToRemove[i] = static_cast<CSSPropertyID>(style->propertyAt(i).id());
10901090
10911091 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data(), propertiesToRemove.size());
10921092}

Source/WebCore/page/animation/AnimationBase.cpp

@@private:
866866
867867class ShorthandPropertyWrapper : public PropertyWrapperBase {
868868public:
869  ShorthandPropertyWrapper(int property, const CSSPropertyLonghand& longhand)
 869 ShorthandPropertyWrapper(int property, const ShorthandProperties& shorthand)
870870 : PropertyWrapperBase(property)
871871 {
872  for (unsigned i = 0; i < longhand.length(); ++i) {
873  PropertyWrapperBase* wrapper = wrapperForProperty(longhand.properties()[i]);
 872 for (unsigned i = 0; i < shorthand.length(); ++i) {
 873 PropertyWrapperBase* wrapper = wrapperForProperty(shorthand.properties()[i]);
874874 if (wrapper)
875875 m_propertyWrappers.append(wrapper);
876876 }

@@static void addShorthandProperties()
11691169
11701170 for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
11711171 int propertyID = animatableShorthandProperties[i];
1172  CSSPropertyLonghand longhand = longhandForProperty(propertyID);
 1172 ShorthandProperties longhand = longhandsForProperty(propertyID);
11731173 if (longhand.length() > 0)
11741174 addPropertyWrapper(propertyID, new ShorthandPropertyWrapper(propertyID, longhand));
11751175 }

Source/WebCore/page/animation/CompositeAnimation.cpp

3030#include "CompositeAnimation.h"
3131
3232#include "AnimationControllerPrivate.h"
33 #include "CSSPropertyLonghand.h"
3433#include "CSSPropertyNames.h"
3534#include "ImplicitAnimation.h"
3635#include "KeyframeAnimation.h"