[Part 2] We should use CSSPropertyID rather than integers when manipulating CSS prope...
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 14:18:19 +0000 (14:18 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 14:18:19 +0000 (14:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82977

Reviewed by Andreas Kling.

Source/WebCore:

CSSPropertyID enum holds all the CSS property ids but many parts of WebKit treat the ids
as integers. While it's not incorrect it is nicer to use the enum as a parameter of
functions manipulating property ids, as we ensure that the value passed will be an
existing value. Almost everything has been changed with the exception of the Animation related
classes which can be done in a following patch.

No new tests : There should be no behavior change in this patch.

* WebCore.exp.in:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::cssText):
(WebCore::CSSComputedStyleDeclaration::valueForShadow):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
(WebCore::logUnimplementedPropertyID):
(WebCore::CSSComputedStyleDeclaration::getPropertyValue):
(WebCore::CSSComputedStyleDeclaration::item):
* css/CSSComputedStyleDeclaration.h:
(CSSComputedStyleDeclaration):
* css/CSSGrammar.y:
* css/CSSParser.cpp:
(WebCore::CSSParser::CSSParser):
(WebCore::isColorPropertyID):
(WebCore::parseColorValue):
(WebCore::isSimpleLengthPropertyID):
(WebCore::parseSimpleLengthValue):
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::parseKeywordValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::addProperty):
(WebCore::CSSParser::parseFillShorthand):
(WebCore::CSSParser::parseShorthand):
(WebCore::CSSParser::parse4Values):
(WebCore::CSSParser::parsePage):
(WebCore::CSSParser::parseSize):
(WebCore::CSSParser::parseQuotes):
(WebCore::CSSParser::parseContent):
(WebCore::CSSParser::parseFillSize):
(WebCore::CSSParser::parseFillProperty):
(WebCore::CSSParser::parseAnimationProperty):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseDashboardRegions):
(WebCore::CSSParser::parseClipShape):
(WebCore::CSSParser::parseShadow):
(WebCore::CSSParser::parseReflect):
(WebCore::BorderImageParseContext::commitBorderImageProperty):
(WebCore::CSSParser::parseBorderImage):
(WebCore::CSSParser::parseBorderImageSlice):
(WebCore::CSSParser::parseBorderRadius):
(WebCore::CSSParser::parseCounter):
(WebCore::CSSParser::parseFlowThread):
(WebCore::CSSParser::parseRegionThread):
(WebCore::CSSParser::parseTransformOrigin):
(WebCore::CSSParser::parsePerspectiveOrigin):
* css/CSSParser.h:
(CSSParser):
(WebCore::ShorthandScope::ShorthandScope):
* css/CSSProperty.cpp:
(WebCore::resolveToPhysicalProperty):
(WebCore::CSSProperty::resolveDirectionAwareProperty):
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSProperty.h:
(WebCore::CSSProperty::CSSProperty):
(CSSProperty):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):
* css/CSSStyleSelector.h:
(CSSStyleSelector):
* css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::setProperty):
(WebCore::PropertySetCSSStyleDeclaration::removeProperty):
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
* css/SVGCSSParser.cpp:
(WebCore::CSSParser::parseSVGValue):
* css/SVGCSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applySVGProperty):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getPropertyCSSValue):
(WebCore::StylePropertySet::removeShorthandProperty):
(WebCore::StylePropertySet::removeProperty):
(WebCore::StylePropertySet::setProperty):
(WebCore::StylePropertySet::asText):
(WebCore::StylePropertySet::findPropertyWithId):
(WebCore::StylePropertySet::removeEquivalentProperties):
* css/StylePropertySet.h:
(StylePropertySet):
* css/StylePropertyShorthand.cpp:
(WebCore::shorthandForProperty):
* css/StylePropertyShorthand.h:
(WebCore):
* dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleProperty):
(WebCore::StyledElement::removeInlineStyleProperty):
(WebCore::StyledElement::addPropertyToAttributeStyle):
* dom/StyledElement.h:
(StyledElement):
(WebCore::StyledElement::addPropertyToAttributeStyle):
* editing/EditingStyle.cpp:
(HTMLElementEquivalent):
(WebCore::EditingStyle::EditingStyle):
(WebCore::EditingStyle::setProperty):
* editing/EditingStyle.h:
(WebCore::EditingStyle::create):
(EditingStyle):
* editing/Editor.cpp:
(WebCore::Editor::selectionStartHasStyle):
(WebCore::Editor::selectionHasStyle):
* editing/Editor.h:
(Editor):
* editing/EditorCommand.cpp:
(WebCore::executeApplyStyle):
(WebCore::executeToggleStyleInList):
(WebCore::executeToggleStyle):
(WebCore::executeApplyParagraphStyle):
(WebCore::stateStyle):
* editing/markup.cpp:
(WebCore):
(WebCore::propertyMissingOrEqualToNone):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::addHTMLLengthToStyle):
(WebCore::HTMLElement::addHTMLColorToStyle):
* html/HTMLElement.h:
(HTMLElement):
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::styleWithProperties):
* page/animation/AnimationBase.cpp:
(WebCore::addShorthandProperties):
* svg/SVGFontFaceElement.cpp:
(WebCore::cssPropertyIdForSVGAttributeName):
(WebCore::SVGFontFaceElement::parseAttribute):
* svg/SVGStyledElement.cpp:
(WebCore::mapAttributeToCSSProperty):
(WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName):
(WebCore::SVGStyledElement::collectStyleForAttribute):
(WebCore::SVGStyledElement::svgAttributeChanged):
(WebCore::SVGStyledElement::getPresentationAttribute):
* svg/SVGStyledElement.h:
(WebCore):
(SVGStyledElement):

Source/WebKit/qt:

Update the code to use CSSPropertyID rather than an integer.

* Api/qwebelement.cpp:
(QWebElement::setStyleProperty):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113031 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.h
Source/WebCore/css/CSSGrammar.y
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSStyleSelector.h
Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/SVGCSSParser.cpp
Source/WebCore/css/SVGCSSStyleSelector.cpp
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/StylePropertySet.h
Source/WebCore/css/StylePropertyShorthand.cpp
Source/WebCore/css/StylePropertyShorthand.h
Source/WebCore/dom/StyledElement.cpp
Source/WebCore/dom/StyledElement.h
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/EditingStyle.h
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLElement.h
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/svg/SVGFontFaceElement.cpp
Source/WebCore/svg/SVGStyledElement.cpp
Source/WebCore/svg/SVGStyledElement.h
Source/WebKit/qt/Api/qwebelement.cpp
Source/WebKit/qt/ChangeLog

index fc27e4d..909c41d 100644 (file)
@@ -1,3 +1,151 @@
+2012-04-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        [Part 2] We should use CSSPropertyID rather than integers when manipulating CSS property ids.
+        https://bugs.webkit.org/show_bug.cgi?id=82977
+
+        Reviewed by Andreas Kling.
+
+        CSSPropertyID enum holds all the CSS property ids but many parts of WebKit treat the ids
+        as integers. While it's not incorrect it is nicer to use the enum as a parameter of
+        functions manipulating property ids, as we ensure that the value passed will be an
+        existing value. Almost everything has been changed with the exception of the Animation related
+        classes which can be done in a following patch.
+
+        No new tests : There should be no behavior change in this patch.
+
+        * WebCore.exp.in:
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::cssText):
+        (WebCore::CSSComputedStyleDeclaration::valueForShadow):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        (WebCore::logUnimplementedPropertyID):
+        (WebCore::CSSComputedStyleDeclaration::getPropertyValue):
+        (WebCore::CSSComputedStyleDeclaration::item):
+        * css/CSSComputedStyleDeclaration.h:
+        (CSSComputedStyleDeclaration):
+        * css/CSSGrammar.y:
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::CSSParser):
+        (WebCore::isColorPropertyID):
+        (WebCore::parseColorValue):
+        (WebCore::isSimpleLengthPropertyID):
+        (WebCore::parseSimpleLengthValue):
+        (WebCore::isValidKeywordPropertyAndValue):
+        (WebCore::isKeywordPropertyID):
+        (WebCore::parseKeywordValue):
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::addProperty):
+        (WebCore::CSSParser::parseFillShorthand):
+        (WebCore::CSSParser::parseShorthand):
+        (WebCore::CSSParser::parse4Values):
+        (WebCore::CSSParser::parsePage):
+        (WebCore::CSSParser::parseSize):
+        (WebCore::CSSParser::parseQuotes):
+        (WebCore::CSSParser::parseContent):
+        (WebCore::CSSParser::parseFillSize):
+        (WebCore::CSSParser::parseFillProperty):
+        (WebCore::CSSParser::parseAnimationProperty):
+        (WebCore::CSSParser::parseGridTrackList):
+        (WebCore::CSSParser::parseDashboardRegions):
+        (WebCore::CSSParser::parseClipShape):
+        (WebCore::CSSParser::parseShadow):
+        (WebCore::CSSParser::parseReflect):
+        (WebCore::BorderImageParseContext::commitBorderImageProperty):
+        (WebCore::CSSParser::parseBorderImage):
+        (WebCore::CSSParser::parseBorderImageSlice):
+        (WebCore::CSSParser::parseBorderRadius):
+        (WebCore::CSSParser::parseCounter):
+        (WebCore::CSSParser::parseFlowThread):
+        (WebCore::CSSParser::parseRegionThread):
+        (WebCore::CSSParser::parseTransformOrigin):
+        (WebCore::CSSParser::parsePerspectiveOrigin):
+        * css/CSSParser.h:
+        (CSSParser):
+        (WebCore::ShorthandScope::ShorthandScope):
+        * css/CSSProperty.cpp:
+        (WebCore::resolveToPhysicalProperty):
+        (WebCore::CSSProperty::resolveDirectionAwareProperty):
+        (WebCore::CSSProperty::isInheritedProperty):
+        * css/CSSProperty.h:
+        (WebCore::CSSProperty::CSSProperty):
+        (CSSProperty):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+        * css/CSSStyleSelector.h:
+        (CSSStyleSelector):
+        * css/PropertySetCSSStyleDeclaration.cpp:
+        (WebCore::PropertySetCSSStyleDeclaration::setProperty):
+        (WebCore::PropertySetCSSStyleDeclaration::removeProperty):
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue):
+        * css/SVGCSSParser.cpp:
+        (WebCore::CSSParser::parseSVGValue):
+        * css/SVGCSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applySVGProperty):
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::getPropertyCSSValue):
+        (WebCore::StylePropertySet::removeShorthandProperty):
+        (WebCore::StylePropertySet::removeProperty):
+        (WebCore::StylePropertySet::setProperty):
+        (WebCore::StylePropertySet::asText):
+        (WebCore::StylePropertySet::findPropertyWithId):
+        (WebCore::StylePropertySet::removeEquivalentProperties):
+        * css/StylePropertySet.h:
+        (StylePropertySet):
+        * css/StylePropertyShorthand.cpp:
+        (WebCore::shorthandForProperty):
+        * css/StylePropertyShorthand.h:
+        (WebCore):
+        * dom/StyledElement.cpp:
+        (WebCore::StyledElement::setInlineStyleProperty):
+        (WebCore::StyledElement::removeInlineStyleProperty):
+        (WebCore::StyledElement::addPropertyToAttributeStyle):
+        * dom/StyledElement.h:
+        (StyledElement):
+        (WebCore::StyledElement::addPropertyToAttributeStyle):
+        * editing/EditingStyle.cpp:
+        (HTMLElementEquivalent):
+        (WebCore::EditingStyle::EditingStyle):
+        (WebCore::EditingStyle::setProperty):
+        * editing/EditingStyle.h:
+        (WebCore::EditingStyle::create):
+        (EditingStyle):
+        * editing/Editor.cpp:
+        (WebCore::Editor::selectionStartHasStyle):
+        (WebCore::Editor::selectionHasStyle):
+        * editing/Editor.h:
+        (Editor):
+        * editing/EditorCommand.cpp:
+        (WebCore::executeApplyStyle):
+        (WebCore::executeToggleStyleInList):
+        (WebCore::executeToggleStyle):
+        (WebCore::executeApplyParagraphStyle):
+        (WebCore::stateStyle):
+        * editing/markup.cpp:
+        (WebCore):
+        (WebCore::propertyMissingOrEqualToNone):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::addHTMLLengthToStyle):
+        (WebCore::HTMLElement::addHTMLColorToStyle):
+        * html/HTMLElement.h:
+        (HTMLElement):
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyle::styleWithProperties):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::addShorthandProperties):
+        * svg/SVGFontFaceElement.cpp:
+        (WebCore::cssPropertyIdForSVGAttributeName):
+        (WebCore::SVGFontFaceElement::parseAttribute):
+        * svg/SVGStyledElement.cpp:
+        (WebCore::mapAttributeToCSSProperty):
+        (WebCore::SVGStyledElement::cssPropertyIdForSVGAttributeName):
+        (WebCore::SVGStyledElement::collectStyleForAttribute):
+        (WebCore::SVGStyledElement::svgAttributeChanged):
+        (WebCore::SVGStyledElement::getPresentationAttribute):
+        * svg/SVGStyledElement.h:
+        (WebCore):
+        (SVGStyledElement):
+
 2012-04-03  Levi Weintraub  <leviw@chromium.org>
 
         Revert RenderTheme paint and layout functions to ints
index 191360c..898ca47 100644 (file)
@@ -1437,7 +1437,7 @@ __ZNK7WebCore6Editor13canEditRichlyEv
 __ZNK7WebCore6Editor16compositionRangeEv
 __ZNK7WebCore6Editor16fontForSelectionERb
 __ZNK7WebCore6Editor17firstRectForRangeEPNS_5RangeE
-__ZNK7WebCore6Editor17selectionHasStyleEiRKN3WTF6StringE
+__ZNK7WebCore6Editor17selectionHasStyleENS_13CSSPropertyIDERKN3WTF6StringE
 __ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
 __ZNK7WebCore6Editor23getCompositionSelectionERjS1_
 __ZNK7WebCore6Editor26selectionStartHasMarkerForENS_14DocumentMarker10MarkerTypeEii
index 04840be..19049b1 100644 (file)
@@ -1033,7 +1033,7 @@ String CSSComputedStyleDeclaration::cssText() const
     for (unsigned i = 0; i < numComputedProperties; i++) {
         if (i)
             result += " ";
-        result += getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));
+        result += getPropertyName(computedProperties[i]);
         result += ": ";
         result += getPropertyValue(computedProperties[i]);
         result += ";";
@@ -1086,14 +1086,12 @@ bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const
     return style->fontDescription().useFixedDefaultSize();
 }
 
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, int id, RenderStyle* style) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, RenderStyle* style) const
 {
     CSSValuePool* cssValuePool = m_node->document()->cssValuePool().get();
     if (!shadow)
         return cssValuePool->createIdentifierValue(CSSValueNone);
 
-    CSSPropertyID propertyID = static_cast<CSSPropertyID>(id);
-
     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
     for (const ShadowData* s = shadow; s; s = s->next()) {
         RefPtr<CSSPrimitiveValue> x = zoomAdjustedPixelValue(s->x(), style, cssValuePool);
@@ -1107,7 +1105,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::valueForShadow(const ShadowDat
     return list.release();
 }
 
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID) const
 {
     return getPropertyCSSValue(propertyID, UpdateLayout);
 }
@@ -1247,13 +1245,13 @@ static PassRefPtr<CSSValue> counterToCSSValue(const RenderStyle* style, int prop
     return list.release();
 }
 
-static void logUnimplementedPropertyID(int propertyID)
+static void logUnimplementedPropertyID(CSSPropertyID propertyID)
 {
     DEFINE_STATIC_LOCAL(HashSet<int>, propertyIDSet, ());
     if (!propertyIDSet.add(propertyID).isNewEntry)
         return;
 
-    LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(static_cast<CSSPropertyID>(propertyID)));
+    LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
 }
 
 static PassRefPtr<CSSValueList> fontFamilyFromStyle(RenderStyle* style, CSSValuePool* cssValuePool)
@@ -1324,7 +1322,7 @@ static PassRefPtr<CSSPrimitiveValue> fontWeightFromStyle(RenderStyle* style, CSS
     return cssValuePool->createIdentifierValue(CSSValueNormal);
 }
 
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
 {
     Node* node = m_node.get();
     if (!node)
@@ -1337,7 +1335,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
     RenderObject* renderer = node->renderer();
 
     RefPtr<RenderStyle> style;
-    if (renderer && hasCompositedLayer(renderer) && AnimationController::supportsAcceleratedAnimationOfProperty(static_cast<CSSPropertyID>(propertyID))) {
+    if (renderer && hasCompositedLayer(renderer) && AnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
         style = renderer->animation()->getAnimatedStyleForRenderer(renderer);
         if (m_pseudoElementSpecifier) {
             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
@@ -1360,7 +1358,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
 
     propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
 
-    switch (static_cast<CSSPropertyID>(propertyID)) {
+    switch (propertyID) {
         case CSSPropertyInvalid:
             break;
 
@@ -2362,7 +2360,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
         }
         case CSSPropertyBorder: {
             RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);
-            const int properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
+            const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
                                         CSSPropertyBorderLeft };
             for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
                 if (value->cssText() !=  getPropertyCSSValue(properties[i], DoNotUpdateLayout)->cssText())
@@ -2536,7 +2534,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
     return 0;
 }
 
-String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const
+String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
 {
     RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
     if (value)
@@ -2563,7 +2561,7 @@ String CSSComputedStyleDeclaration::item(unsigned i) const
     if (i >= length())
         return "";
 
-    return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));
+    return getPropertyName(computedProperties[i]);
 }
 
 bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
@@ -2649,7 +2647,7 @@ CSSRule* CSSComputedStyleDeclaration::parentRule() const
 
 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
 {
-    int propertyID = cssPropertyID(propertyName);
+    CSSPropertyID propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return 0;
     return getPropertyCSSValue(propertyID);
@@ -2657,7 +2655,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const Stri
 
 String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
 {
-    int propertyID = cssPropertyID(propertyName);
+    CSSPropertyID propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
     return getPropertyValue(propertyID);
index 8d1b359..f64d23b 100644 (file)
@@ -57,18 +57,18 @@ public:
     virtual void ref() OVERRIDE;
     virtual void deref() OVERRIDE;
 
-    PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
-    String getPropertyValue(int propertyID) const;
-    bool getPropertyPriority(int propertyID) const;
+    PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const;
+    String getPropertyValue(CSSPropertyID) const;
+    bool getPropertyPriority(CSSPropertyID) const;
 
     virtual PassRefPtr<StylePropertySet> copy() const;
     virtual PassRefPtr<StylePropertySet> makeMutable();
 
-    PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const;
+    PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
     PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
     bool useFixedFontDefaultSize() const;
 #if ENABLE(SVG)
-    PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
+    PassRefPtr<CSSValue> getSVGPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
 #endif
 
     PassRefPtr<StylePropertySet> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
@@ -95,7 +95,7 @@ private:
 
     virtual bool cssPropertyMatches(const CSSProperty*) const;
 
-    PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const;
+    PassRefPtr<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, RenderStyle*) const;
     PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
 #if ENABLE(SVG)
     PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
index 8f124cb..a841002 100644 (file)
@@ -1307,7 +1307,7 @@ declaration:
         if ($1 && $4) {
             p->m_valueList = p->sinkFloatingValueList($4);
             int oldParsedProperties = p->m_parsedProperties.size();
-            $$ = p->parseValue($1, $5);
+            $$ = p->parseValue(static_cast<CSSPropertyID>($1), $5);
             if (!$$)
                 p->rollbackLastProperties(p->m_parsedProperties.size() - oldParsedProperties);
             else
index 5e6e40d..828eff8 100644 (file)
@@ -183,7 +183,7 @@ inline void CSSParser::ensureCSSValuePool()
 CSSParser::CSSParser(CSSParserMode cssParserMode)
     : m_cssParserMode(cssParserMode)
     , m_important(false)
-    , m_id(0)
+    , m_id(CSSPropertyInvalid)
     , m_styleSheet(0)
     , m_inParseShorthand(0)
     , m_currentShorthand(0)
@@ -294,7 +294,7 @@ PassRefPtr<StyleKeyframe> CSSParser::parseKeyframeRule(CSSStyleSheet *sheet, con
     return m_keyframe.release();
 }
 
-static inline bool isColorPropertyID(int propertyId)
+static inline bool isColorPropertyID(CSSPropertyID propertyId)
 {
     switch (propertyId) {
     case CSSPropertyColor:
@@ -321,7 +321,7 @@ static inline bool isColorPropertyID(int propertyId)
     }
 }
 
-static bool parseColorValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
+static bool parseColorValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
 {
     bool strict = isStrictParserMode(cssParserMode);
     if (!string.length())
@@ -364,7 +364,7 @@ static bool parseColorValue(StylePropertySet* declaration, int propertyId, const
     return true;
 }
 
-static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativeNumbers)
+static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acceptsNegativeNumbers)
 {
     switch (propertyId) {
     case CSSPropertyFontSize:
@@ -408,7 +408,7 @@ static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativ
     }
 }
 
-static bool parseSimpleLengthValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
+static bool parseSimpleLengthValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
 {
     bool acceptsNegativeNumbers;
     bool strict = isStrictParserMode(cssParserMode);
@@ -483,7 +483,7 @@ static bool parseSimpleLengthValue(StylePropertySet* declaration, int propertyId
     return true;
 }
 
-static inline bool isValidKeywordPropertyAndValue(int propertyId, int valueID)
+static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int valueID)
 {
     if (!valueID)
         return false;
@@ -804,7 +804,7 @@ static inline bool isValidKeywordPropertyAndValue(int propertyId, int valueID)
     return false;
 }
 
-static inline bool isKeywordPropertyID(int propertyId)
+static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
 {
     switch (propertyId) {
     case CSSPropertyBorderBottomStyle:
@@ -900,7 +900,7 @@ static inline bool isKeywordPropertyID(int propertyId)
     }
 }
 
-static bool parseKeywordValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
+static bool parseKeywordValue(StylePropertySet* declaration, CSSPropertyID propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
 {
     if (string.isEmpty())
         return false;
@@ -940,25 +940,25 @@ PassRefPtr<CSSValueList> CSSParser::parseFontFaceValue(const AtomicString& strin
     return static_pointer_cast<CSSValueList>(dummyStyle->getPropertyCSSValue(CSSPropertyFontFamily));
 }
 
-bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
+bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSParserMode cssParserMode, CSSStyleSheet* contextStyleSheet)
 {
-    if (parseSimpleLengthValue(declaration, propertyId, string, important, cssParserMode, contextStyleSheet))
+    if (parseSimpleLengthValue(declaration, propertyID, string, important, cssParserMode, contextStyleSheet))
         return true;
-    if (parseColorValue(declaration, propertyId, string, important, cssParserMode, contextStyleSheet))
+    if (parseColorValue(declaration, propertyID, string, important, cssParserMode, contextStyleSheet))
         return true;
-    if (parseKeywordValue(declaration, propertyId, string, important, contextStyleSheet))
+    if (parseKeywordValue(declaration, propertyID, string, important, contextStyleSheet))
         return true;
     CSSParser parser(cssParserMode);
-    return parser.parseValue(declaration, propertyId, string, important, contextStyleSheet);
+    return parser.parseValue(declaration, propertyID, string, important, contextStyleSheet);
 }
 
-bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
+bool CSSParser::parseValue(StylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important, CSSStyleSheet* contextStyleSheet)
 {
     setStyleSheet(contextStyleSheet);
 
     setupParser("@-webkit-value{", string, "} ");
 
-    m_id = propertyId;
+    m_id = propertyID;
     m_important = important;
 
     cssyyparse(this);
@@ -1107,7 +1107,7 @@ PassOwnPtr<MediaQuery> CSSParser::parseMediaQuery(const String& string)
     return m_mediaQuery.release();
 }
 
-void CSSParser::addProperty(int propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
+void CSSParser::addProperty(CSSPropertyID propId, PassRefPtr<CSSValue> value, bool important, bool implicit)
 {
     m_parsedProperties.append(CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand || implicit));
 }
@@ -1359,7 +1359,7 @@ inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int id, CSSP
     return 0;
 }
 
-bool CSSParser::parseValue(int propId, bool important)
+bool CSSParser::parseValue(CSSPropertyID propId, bool important)
 {
     if (!m_valueList)
         return false;
@@ -1406,7 +1406,7 @@ bool CSSParser::parseValue(int propId, bool important)
     bool validPrimitive = false;
     RefPtr<CSSValue> parsedValue;
 
-    switch (static_cast<CSSPropertyID>(propId)) {
+    switch (propId) {
         /* The comment to the left defines all valid value of this properties as defined
          * in CSS 2, Appendix F. Property index
          */
@@ -1651,7 +1651,7 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyWebkitMaskRepeatY: {
         RefPtr<CSSValue> val1;
         RefPtr<CSSValue> val2;
-        int propId1, propId2;
+        CSSPropertyID propId1, propId2;
         bool result = false;
         if (parseFillProperty(propId, propId1, propId2, val1, val2)) {
             OwnPtr<ShorthandScope> shorthandScope;
@@ -2090,7 +2090,7 @@ bool CSSParser::parseValue(int propId, bool important)
         RefPtr<CSSValue> val1;
         RefPtr<CSSValue> val2;
         RefPtr<CSSValue> val3;
-        int propId1, propId2, propId3;
+        CSSPropertyID propId1, propId2, propId3;
         if (parseTransformOrigin(propId, propId1, propId2, propId3, val1, val2, val3)) {
             addProperty(propId1, val1.release(), important);
             if (val2)
@@ -2121,7 +2121,7 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyWebkitPerspectiveOriginY: {
         RefPtr<CSSValue> val1;
         RefPtr<CSSValue> val2;
-        int propId1, propId2;
+        CSSPropertyID propId1, propId2;
         if (parsePerspectiveOrigin(propId, propId1, propId2, val1, val2)) {
             addProperty(propId1, val1.release(), important);
             if (val2)
@@ -2566,7 +2566,7 @@ static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtr<CSSValue>& c
 
 const int cMaxFillProperties = 9;
 
-bool CSSParser::parseFillShorthand(int propId, const CSSPropertyID* properties, int numProperties, bool important)
+bool CSSParser::parseFillShorthand(CSSPropertyID propId, const CSSPropertyID* properties, int numProperties, bool important)
 {
     ASSERT(numProperties <= cMaxFillProperties);
     if (numProperties > cMaxFillProperties)
@@ -2615,7 +2615,7 @@ bool CSSParser::parseFillShorthand(int propId, const CSSPropertyID* properties,
             if (!parsedProperty[i]) {
                 RefPtr<CSSValue> val1;
                 RefPtr<CSSValue> val2;
-                int propId1, propId2;
+                CSSPropertyID propId1, propId2;
                 CSSParserValue* parserValue = m_valueList->current();
                 if (parseFillProperty(properties[i], propId1, propId2, val1, val2)) {
                     parsedProperty[i] = found = true;
@@ -2819,7 +2819,7 @@ bool CSSParser::parseTransitionShorthand(bool important)
     return true;
 }
 
-bool CSSParser::parseShorthand(int propId, const StylePropertyShorthand& shorthand, bool important)
+bool CSSParser::parseShorthand(CSSPropertyID propId, const StylePropertyShorthand& shorthand, bool important)
 {
     // We try to match as many properties as possible
     // We set up an array of booleans to mark which property has been found,
@@ -2866,7 +2866,7 @@ bool CSSParser::parseShorthand(int propId, const StylePropertyShorthand& shortha
     return true;
 }
 
-bool CSSParser::parse4Values(int propId, const CSSPropertyID *properties,  bool important)
+bool CSSParser::parse4Values(CSSPropertyID propId, const CSSPropertyID *properties,  bool important)
 {
     /* From the CSS 2 specs, 8.3
      * If there is only one value, it applies to all sides. If there are two values, the top and
@@ -2925,7 +2925,7 @@ bool CSSParser::parse4Values(int propId, const CSSPropertyID *properties,  bool
 }
 
 // auto | <identifier>
-bool CSSParser::parsePage(int propId, bool important)
+bool CSSParser::parsePage(CSSPropertyID propId, bool important)
 {
     ASSERT(propId == CSSPropertyPage);
 
@@ -2947,7 +2947,7 @@ bool CSSParser::parsePage(int propId, bool important)
 }
 
 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
-bool CSSParser::parseSize(int propId, bool important)
+bool CSSParser::parseSize(CSSPropertyID propId, bool important)
 {
     ASSERT(propId == CSSPropertySize);
 
@@ -3021,7 +3021,7 @@ CSSParser::SizeParameterType CSSParser::parseSizeParameter(CSSValueList* parsedV
 
 // [ <string> <string> ]+ | inherit | none
 // inherit and none are handled in parseValue.
-bool CSSParser::parseQuotes(int propId, bool important)
+bool CSSParser::parseQuotes(CSSPropertyID propId, bool important)
 {
     RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
     while (CSSParserValue* val = m_valueList->current()) {
@@ -3044,7 +3044,7 @@ bool CSSParser::parseQuotes(int propId, bool important)
 // [ <string> | <uri> | <counter> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
 // in CSS 2.1 this got somewhat reduced:
 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
-bool CSSParser::parseContent(int propId, bool important)
+bool CSSParser::parseContent(CSSPropertyID propId, bool important)
 {
     RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
 
@@ -3346,7 +3346,7 @@ void CSSParser::parseFillRepeat(RefPtr<CSSValue>& value1, RefPtr<CSSValue>& valu
     }
 }
 
-PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
+PassRefPtr<CSSValue> CSSParser::parseFillSize(CSSPropertyID propId, bool& allowComma)
 {
     allowComma = true;
     CSSParserValue* value = m_valueList->current();
@@ -3364,7 +3364,6 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
         parsedValue1 = createPrimitiveNumericValue(value);
     }
 
-    CSSPropertyID property = static_cast<CSSPropertyID>(propId);
     RefPtr<CSSPrimitiveValue> parsedValue2;
     if ((value = m_valueList->next())) {
         if (value->unit == CSSParserValue::Operator && value->iValue == ',')
@@ -3374,7 +3373,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
                 return 0;
             parsedValue2 = createPrimitiveNumericValue(value);
         }
-    } else if (!parsedValue2 && property == CSSPropertyWebkitBackgroundSize) {
+    } else if (!parsedValue2 && propId == CSSPropertyWebkitBackgroundSize) {
         // For backwards compatibility we set the second value to the first if it is omitted.
         // We only need to do this for -webkit-background-size. It should be safe to let masks match
         // the real property.
@@ -3386,7 +3385,7 @@ PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
     return cssValuePool()->createValue(Pair::create(parsedValue1.release(), parsedValue2.release()));
 }
 
-bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
+bool CSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,
                                   RefPtr<CSSValue>& retValue1, RefPtr<CSSValue>& retValue2)
 {
     RefPtr<CSSValueList> values;
@@ -3506,6 +3505,9 @@ bool CSSParser::parseFillProperty(int propId, int& propId1, int& propId2,
                         m_valueList->next();
                     break;
                 }
+                default:
+                    ASSERT_NOT_REACHED();
+                    return false;
             }
             if (!currValue)
                 return false;
@@ -3728,7 +3730,7 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationTimingFunction()
     return 0;
 }
 
-bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
+bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& result)
 {
     RefPtr<CSSValueList> values;
     CSSParserValue* val;
@@ -3795,6 +3797,9 @@ bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
                     if (currValue)
                         m_valueList->next();
                     break;
+                default:
+                    ASSERT_NOT_REACHED();
+                    return false;
             }
 
             if (!currValue)
@@ -3831,7 +3836,7 @@ bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
 }
 
 #if ENABLE(CSS_GRID_LAYOUT)
-bool CSSParser::parseGridTrackList(int propId, bool important)
+bool CSSParser::parseGridTrackList(CSSPropertyID propId, bool important)
 {
     CSSParserValue* value = m_valueList->current();
     if (value->id == CSSValueNone) {
@@ -3875,7 +3880,7 @@ static CSSParserValue* skipCommaInDashboardRegion(CSSParserValueList *args)
     return args->current();
 }
 
-bool CSSParser::parseDashboardRegions(int propId, bool important)
+bool CSSParser::parseDashboardRegions(CSSPropertyID propId, bool important)
 {
     bool valid = true;
 
@@ -4052,7 +4057,7 @@ PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bo
     return cssValuePool()->createValue(Counter::create(identifier.release(), listStyle.release(), separator.release()));
 }
 
-bool CSSParser::parseClipShape(int propId, bool important)
+bool CSSParser::parseClipShape(CSSPropertyID propId, bool important)
 {
     CSSParserValue* value = m_valueList->current();
     CSSParserValueList* args = value->function->args.get();
@@ -5398,9 +5403,9 @@ struct ShadowParseContext {
     bool allowBreak;
 };
 
-PassRefPtr<CSSValueList> CSSParser::parseShadow(CSSParserValueList* valueList, int propId)
+PassRefPtr<CSSValueList> CSSParser::parseShadow(CSSParserValueList* valueList, CSSPropertyID propId)
 {
-    ShadowParseContext context(static_cast<CSSPropertyID>(propId), this);
+    ShadowParseContext context(propId, this);
     CSSParserValue* val;
     while ((val = valueList->current())) {
         // Check for a comma break first.
@@ -5411,7 +5416,7 @@ PassRefPtr<CSSValueList> CSSParser::parseShadow(CSSParserValueList* valueList, i
                 return 0;
 #if ENABLE(SVG)
             // -webkit-svg-shadow does not support multiple values.
-            if (static_cast<CSSPropertyID>(propId) == CSSPropertyWebkitSvgShadow)
+            if (propId == CSSPropertyWebkitSvgShadow)
                 return 0;
 #endif
             // The value is good.  Commit it.
@@ -5463,7 +5468,7 @@ PassRefPtr<CSSValueList> CSSParser::parseShadow(CSSParserValueList* valueList, i
     return 0;
 }
 
-bool CSSParser::parseReflect(int propId, bool important)
+bool CSSParser::parseReflect(CSSPropertyID propId, bool important)
 {
     // box-reflect: <direction> <offset> <mask>
 
@@ -5650,7 +5655,7 @@ struct BorderImageParseContext {
         commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat, important);
     }
 
-    void commitBorderImageProperty(int propId, CSSParser* parser, PassRefPtr<CSSValue> value, bool important)
+    void commitBorderImageProperty(CSSPropertyID propId, CSSParser* parser, PassRefPtr<CSSValue> value, bool important)
     {
         if (value)
             parser->addProperty(propId, value, important);
@@ -5677,7 +5682,7 @@ struct BorderImageParseContext {
     RefPtr<CSSValue> m_repeat;
 };
 
-bool CSSParser::parseBorderImage(int propId, RefPtr<CSSValue>& result, bool important)
+bool CSSParser::parseBorderImage(CSSPropertyID propId, RefPtr<CSSValue>& result, bool important)
 {
     ShorthandScope scope(this, propId);
     BorderImageParseContext context;
@@ -5867,7 +5872,7 @@ private:
     bool m_fill;
 };
 
-bool CSSParser::parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>& result)
+bool CSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtr<CSSBorderImageSliceValue>& result)
 {
     BorderImageSliceParseContext context(this);
     CSSParserValue* val;
@@ -6029,7 +6034,7 @@ static void completeBorderRadii(RefPtr<CSSPrimitiveValue> radii[4])
     radii[3] = radii[1];
 }
 
-bool CSSParser::parseBorderRadius(int propId, bool important)
+bool CSSParser::parseBorderRadius(CSSPropertyID propId, bool important)
 {
     unsigned num = m_valueList->size();
     if (num > 9)
@@ -6117,7 +6122,7 @@ bool CSSParser::parseAspectRatio(bool important)
     return true;
 }
 
-bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
+bool CSSParser::parseCounter(CSSPropertyID propId, int defaultValue, bool important)
 {
     enum { ID, VAL } state = ID;
 
@@ -7324,7 +7329,7 @@ bool CSSParser::parseFlowThread(const String& flowName, Document* doc)
 }
 
 // none | <ident>
-bool CSSParser::parseFlowThread(int propId, bool important)
+bool CSSParser::parseFlowThread(CSSPropertyID propId, bool important)
 {
     ASSERT(propId == CSSPropertyWebkitFlowInto);
     ASSERT(cssRegionsEnabled());
@@ -7356,7 +7361,7 @@ bool CSSParser::parseFlowThread(int propId, bool important)
 }
 
 // -webkit-flow-from: none | <ident>
-bool CSSParser::parseRegionThread(int propId, bool important)
+bool CSSParser::parseRegionThread(CSSPropertyID propId, bool important)
 {
     ASSERT(propId == CSSPropertyWebkitFlowFrom);
     ASSERT(cssRegionsEnabled());
@@ -7386,7 +7391,7 @@ bool CSSParser::parseRegionThread(int propId, bool important)
     return true;
 }
 
-bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
+bool CSSParser::parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2, RefPtr<CSSValue>& value3)
 {
     propId1 = propId;
     propId2 = propId;
@@ -7422,12 +7427,15 @@ bool CSSParser::parseTransformOrigin(int propId, int& propId1, int& propId2, int
                 m_valueList->next();
             break;
         }
+        default:
+            ASSERT_NOT_REACHED();
+            return false;
     }
 
     return value;
 }
 
-bool CSSParser::parsePerspectiveOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2)
+bool CSSParser::parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, RefPtr<CSSValue>& value, RefPtr<CSSValue>& value2)
 {
     propId1 = propId;
     propId2 = propId;
@@ -7452,6 +7460,9 @@ bool CSSParser::parsePerspectiveOrigin(int propId, int& propId1, int& propId2, R
                 m_valueList->next();
             break;
         }
+        default:
+            ASSERT_NOT_REACHED();
+            return false;
     }
 
     return value;
index 4a4b897..cb8b76f 100644 (file)
@@ -75,7 +75,7 @@ public:
     void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0);
     PassRefPtr<StyleRuleBase> parseRule(CSSStyleSheet*, const String&);
     PassRefPtr<StyleKeyframe> parseKeyframeRule(CSSStyleSheet*, const String&);
-    static bool parseValue(StylePropertySet*, int propId, const String&, bool important, CSSParserMode, CSSStyleSheet* contextStyleSheet);
+    static bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool, CSSParserMode, CSSStyleSheet*);
     static bool parseColor(RGBA32& color, const String&, bool strict = false);
     static bool parseSystemColor(RGBA32& color, const String&, Document*);
     static PassRefPtr<CSSValueList> parseFontFaceValue(const AtomicString&, CSSStyleSheet* contextStyleSheet);
@@ -87,15 +87,15 @@ public:
 
     CSSValuePool* cssValuePool() const { return m_cssValuePool.get(); }
 
-    void addProperty(int propId, PassRefPtr<CSSValue>, bool important, bool implicit = false);
+    void addProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool, bool implicit = false);
     void rollbackLastProperties(int num);
     bool hasProperties() const { return !m_parsedProperties.isEmpty(); }
 
-    bool parseValue(int propId, bool important);
-    bool parseShorthand(int, const StylePropertyShorthand&, bool);
-    bool parse4Values(int propId, const CSSPropertyID* properties, bool important);
-    bool parseContent(int propId, bool important);
-    bool parseQuotes(int propId, bool important);
+    bool parseValue(CSSPropertyID, bool);
+    bool parseShorthand(CSSPropertyID, const StylePropertyShorthand&, bool);
+    bool parse4Values(CSSPropertyID, const CSSPropertyID*, bool);
+    bool parseContent(CSSPropertyID, bool);
+    bool parseQuotes(CSSPropertyID, bool);
 
     PassRefPtr<CSSValue> parseAttr(CSSParserValueList* args);
 
@@ -110,10 +110,10 @@ public:
     void parseFillPosition(CSSParserValueList*, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
 
     void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-    PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
+    PassRefPtr<CSSValue> parseFillSize(CSSPropertyID propId, bool &allowComma);
 
-    bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-    bool parseFillShorthand(int propId, const CSSPropertyID* properties, int numProperties, bool important);
+    bool parseFillProperty(CSSPropertyID, CSSPropertyID&, CSSPropertyID&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+    bool parseFillShorthand(CSSPropertyID, const CSSPropertyID*, int, bool);
 
     void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
 
@@ -131,17 +131,17 @@ public:
 
     bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
     bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result);
-    bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
+    bool parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>&);
     bool parseTransitionShorthand(bool important);
     bool parseAnimationShorthand(bool important);
 
 #if ENABLE(CSS_GRID_LAYOUT)
-    bool parseGridTrackList(int propId, bool important);
+    bool parseGridTrackList(CSSPropertyID, bool);
 #endif
 
-    bool parseDashboardRegions(int propId, bool important);
+    bool parseDashboardRegions(CSSPropertyID, bool);
 
-    bool parseClipShape(int propId, bool important);
+    bool parseClipShape(CSSPropertyID, bool);
 
     bool parseExclusionShape(bool shapeInside, bool important);
     PassRefPtr<CSSWrapShape> parseExclusionShapeRect(CSSParserValueList* args);
@@ -152,7 +152,7 @@ public:
     bool parseFont(bool important);
     PassRefPtr<CSSValueList> parseFontFamily();
 
-    bool parseCounter(int propId, int defaultValue, bool important);
+    bool parseCounter(CSSPropertyID, int, bool);
     PassRefPtr<CSSValue> parseCounterContent(CSSParserValueList* args, bool counters);
 
     bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha);
@@ -169,24 +169,24 @@ public:
     bool parseFontFaceUnicodeRange();
 
 #if ENABLE(SVG)
-    bool parseSVGValue(int propId, bool important);
+    bool parseSVGValue(CSSPropertyID propId, bool important);
     PassRefPtr<CSSValue> parseSVGPaint();
     PassRefPtr<CSSValue> parseSVGColor();
     PassRefPtr<CSSValue> parseSVGStrokeDasharray();
 #endif
 
     // CSS3 Parsing Routines (for properties specific to CSS3)
-    PassRefPtr<CSSValueList> parseShadow(CSSParserValueList*, int propId);
-    bool parseBorderImage(int propId, RefPtr<CSSValue>&, bool important = false);
+    PassRefPtr<CSSValueList> parseShadow(CSSParserValueList*, CSSPropertyID);
+    bool parseBorderImage(CSSPropertyID, RefPtr<CSSValue>&, bool important = false);
     bool parseBorderImageRepeat(RefPtr<CSSValue>&);
-    bool parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>&);
+    bool parseBorderImageSlice(CSSPropertyID, RefPtr<CSSBorderImageSliceValue>&);
     bool parseBorderImageWidth(RefPtr<CSSPrimitiveValue>&);
     bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
-    bool parseBorderRadius(int propId, bool important);
+    bool parseBorderRadius(CSSPropertyID, bool);
 
     bool parseAspectRatio(bool important);
 
-    bool parseReflect(int propId, bool important);
+    bool parseReflect(CSSPropertyID, bool important);
 
     PassRefPtr<CSSFlexValue> parseFlex(CSSParserValueList* args);
 
@@ -213,8 +213,8 @@ public:
 #endif
 
     PassRefPtr<CSSValueList> parseTransform();
-    bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-    bool parsePerspectiveOrigin(int propId, int& propId1, int& propId2,  RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+    bool parseTransformOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2, CSSPropertyID& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+    bool parsePerspectiveOrigin(CSSPropertyID propId, CSSPropertyID& propId1, CSSPropertyID& propId2,  RefPtr<CSSValue>&, RefPtr<CSSValue>&);
 
     bool parseTextEmphasisStyle(bool important);
 
@@ -226,8 +226,8 @@ public:
 
     bool cssRegionsEnabled() const;
     bool parseFlowThread(const String& flowName, Document*);
-    bool parseFlowThread(int propId, bool important);
-    bool parseRegionThread(int propId, bool important);
+    bool parseFlowThread(CSSPropertyID, bool);
+    bool parseRegionThread(CSSPropertyID, bool);
 
     bool parseFontVariantLigatures(bool important);
 
@@ -289,7 +289,7 @@ public:
 
     CSSParserMode m_cssParserMode;
     bool m_important;
-    int m_id;
+    CSSPropertyID m_id;
     CSSStyleSheet* m_styleSheet;
     RefPtr<StyleRuleBase> m_rule;
     RefPtr<StyleKeyframe> m_keyframe;
@@ -369,7 +369,7 @@ private:
     bool isGeneratedImageValue(CSSParserValue*) const;
     bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&);
 
-    bool parseValue(StylePropertySet*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet);
+    bool parseValue(StylePropertySet*, CSSPropertyID, const String&, bool important, CSSStyleSheet*);
 
     enum SizeParameterType {
         None,
@@ -379,8 +379,8 @@ private:
         Orientation,
     };
 
-    bool parsePage(int propId, bool important);
-    bool parseSize(int propId, bool important);
+    bool parsePage(CSSPropertyID propId, bool important);
+    bool parseSize(CSSPropertyID propId, bool important);
     SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType);
 
     bool parseFontFaceSrcURI(CSSValueList*);
@@ -475,7 +475,7 @@ void cssPropertyNameIOSAliasing(const char* propertyName, const char*& propertyN
 class ShorthandScope {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    ShorthandScope(CSSParser* parser, int propId) : m_parser(parser)
+    ShorthandScope(CSSParser* parser, CSSPropertyID propId) : m_parser(parser)
     {
         if (!(m_parser->m_inParseShorthand++))
             m_parser->m_currentShorthand = propId;
index 19578de..ad8797a 100644 (file)
@@ -50,7 +50,7 @@ void CSSProperty::wrapValueInCommaSeparatedList()
 enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
 enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
 
-static int resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand)
+static CSSPropertyID resolveToPhysicalProperty(TextDirection direction, WritingMode writingMode, LogicalBoxSide logicalSide, const StylePropertyShorthand& shorthand)
 {
     if (direction == LTR) {
         if (writingMode == TopToBottomWritingMode) {
@@ -157,7 +157,7 @@ static int resolveToPhysicalProperty(TextDirection direction, WritingMode writin
 
 enum LogicalExtent { LogicalWidth, LogicalHeight };
 
-static int resolveToPhysicalProperty(WritingMode writingMode, LogicalExtent logicalSide, const CSSPropertyID* properties)
+static CSSPropertyID resolveToPhysicalProperty(WritingMode writingMode, LogicalExtent logicalSide, const CSSPropertyID* properties)
 {
     if (writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode)
         return properties[logicalSide];
@@ -171,9 +171,9 @@ static const StylePropertyShorthand& borderDirections()
     return borderDirections;
 }
 
-int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction, WritingMode writingMode)
+CSSPropertyID CSSProperty::resolveDirectionAwareProperty(CSSPropertyID propertyID, TextDirection direction, WritingMode writingMode)
 {
-    switch (static_cast<CSSPropertyID>(propertyID)) {
+    switch (propertyID) {
     case CSSPropertyWebkitMarginEnd:
         return resolveToPhysicalProperty(direction, writingMode, EndSide, marginShorthand());
     case CSSPropertyWebkitMarginStart:
@@ -251,9 +251,9 @@ int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection dir
     }
 }
 
-bool CSSProperty::isInheritedProperty(unsigned propertyID)
+bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
 {
-    switch (static_cast<CSSPropertyID>(propertyID)) {
+    switch (propertyID) {
     case CSSPropertyBorderCollapse:
     case CSSPropertyBorderSpacing:
     case CSSPropertyCaptionSide:
index b94f90a..1220d17 100644 (file)
@@ -32,7 +32,7 @@ namespace WebCore {
 
 class CSSProperty {
 public:
-    CSSProperty(unsigned propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false)
+    CSSProperty(CSSPropertyID propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false)
         : m_id(propID)
         , m_shorthandID(shorthandID)
         , m_important(important)
@@ -55,8 +55,8 @@ public:
 
     void wrapValueInCommaSeparatedList();
 
-    static int resolveDirectionAwareProperty(int propertyID, TextDirection, WritingMode);
-    static bool isInheritedProperty(unsigned propertyID);
+    static CSSPropertyID resolveDirectionAwareProperty(CSSPropertyID, TextDirection, WritingMode);
+    static bool isInheritedProperty(CSSPropertyID);
 
 private:
     // Make sure the following fits in 4 bytes. Really.
index e90e2fd..e981f04 100644 (file)
@@ -2591,7 +2591,7 @@ void CSSStyleSelector::applyProperties(const StylePropertySet* properties, Style
             ASSERT(!current.value()->isInheritedValue());
             continue;
         }
-        int property = current.id();
+        CSSPropertyID property = current.id();
 
         if (filterRegionProperties && !CSSStyleSelector::isValidRegionStyleProperty(property))
             continue;
@@ -2925,7 +2925,7 @@ CSSStyleRule* CSSStyleSelector::ensureFullCSSOMWrapperForInspector(StyleRule* ru
     return m_styleRuleToCSSOMWrapperMap.get(rule).get();
 }
 
-void CSSStyleSelector::applyPropertyToStyle(int id, CSSValue* value, RenderStyle* style)
+void CSSStyleSelector::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, RenderStyle* style)
 {
     initElement(0);
     initForStyleResolve(0, style);
@@ -2933,15 +2933,15 @@ void CSSStyleSelector::applyPropertyToStyle(int id, CSSValue* value, RenderStyle
     applyPropertyToCurrentStyle(id, value);
 }
 
-void CSSStyleSelector::applyPropertyToCurrentStyle(int id, CSSValue* value)
+void CSSStyleSelector::applyPropertyToCurrentStyle(CSSPropertyID id, CSSValue* value)
 {
     if (value)
         applyProperty(id, value);
 }
 
-inline bool isValidVisitedLinkProperty(int id)
+inline bool isValidVisitedLinkProperty(CSSPropertyID id)
 {
-    switch(static_cast<CSSPropertyID>(id)) {
+    switch (id) {
         case CSSPropertyBackgroundColor:
         case CSSPropertyBorderLeftColor:
         case CSSPropertyBorderRightColor:
@@ -2975,9 +2975,9 @@ inline bool isValidVisitedLinkProperty(int id)
 
 // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule
 // FIXME: add incremental support for other region styling properties.
-inline bool CSSStyleSelector::isValidRegionStyleProperty(int id)
+inline bool CSSStyleSelector::isValidRegionStyleProperty(CSSPropertyID id)
 {
-    switch (static_cast<CSSPropertyID>(id)) {
+    switch (id) {
     case CSSPropertyBackgroundColor:
         return true;
     default:
@@ -3062,7 +3062,7 @@ static bool createGridPosition(CSSValue* value, Length& position)
 }
 #endif
 
-void CSSStyleSelector::applyProperty(int id, CSSValue *value)
+void CSSStyleSelector::applyProperty(CSSPropertyID id, CSSValue *value)
 {
     bool isInherit = m_parentNode && value->isInheritedValue();
     bool isInitial = value->isInitialValue() || (!m_parentNode && value->isInheritedValue());
@@ -3074,13 +3074,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         return;
     }
 
-    CSSPropertyID property = static_cast<CSSPropertyID>(id);
-
-    if (isInherit && m_parentStyle && !m_parentStyle->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(property))
+    if (isInherit && m_parentStyle && !m_parentStyle->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(id))
         m_parentStyle->setHasExplicitlyInheritedProperties();
 
     // check lookup table for implementations and use when available
-    const PropertyHandler& handler = m_applyProperty.propertyHandler(property);
+    const PropertyHandler& handler = m_applyProperty.propertyHandler(id);
     if (handler.isValid()) {
         if (isInherit)
             handler.applyInheritValue(this);
@@ -3098,7 +3096,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     // What follows is a list that maps the CSS properties into their corresponding front-end
     // RenderStyle values.  Shorthands (e.g. border, background) occur in this list as well and
     // are only hit when mapping "inherit" or "initial" into front-end values.
-    switch (property) {
+    switch (id) {
 // lists
     case CSSPropertyContent:
         // list of string, uri, counter, attr, i
@@ -3458,7 +3456,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
             reflection->setOffset(reflectValue->offset()->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(style(), m_rootElementStyle, zoomFactor));
         NinePieceImage mask;
         mask.setMaskDefaults();
-        mapNinePieceImage(property, reflectValue->mask(), mask);
+        mapNinePieceImage(id, reflectValue->mask(), mask);
         reflection->setMask(mask);
 
         m_style->setBoxReflect(reflection.release());
@@ -3740,7 +3738,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     case CSSPropertyWebkitMaxLogicalWidth:
     case CSSPropertyWebkitMaxLogicalHeight:
     {
-        int newId = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->writingMode());
+        CSSPropertyID newId = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->writingMode());
         ASSERT(newId != id);
         return applyProperty(newId, value);
     }
index 7d0bfb1..05d3101 100644 (file)
@@ -201,9 +201,9 @@ public:
 public:
     void setStyle(PassRefPtr<RenderStyle> s) { m_style = s; } // Used by the document when setting up its root style.
 
-    void applyPropertyToStyle(int id, CSSValue*, RenderStyle*);
+    void applyPropertyToStyle(CSSPropertyID, CSSValue*, RenderStyle*);
 
-    void applyPropertyToCurrentStyle(int id, CSSValue*);
+    void applyPropertyToCurrentStyle(CSSPropertyID, CSSValue*);
 
     void updateFont();
 
@@ -356,7 +356,7 @@ private:
     template <bool firstPass>
     void applyProperties(const StylePropertySet* properties, StyleRule*, bool isImportant, bool inheritedOnly, bool filterRegionProperties);
 
-    static bool isValidRegionStyleProperty(int id);
+    static bool isValidRegionStyleProperty(CSSPropertyID);
 
     void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPage, const String& pageName);
     void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>&, bool isLeftPage, bool isFirstPage, const String& pageName);
@@ -432,10 +432,10 @@ public:
 private:
     bool canShareStyleWithControl(StyledElement*) const;
 
-    void applyProperty(int id, CSSValue*);
+    void applyProperty(CSSPropertyID, CSSValue*);
 
 #if ENABLE(SVG)
-    void applySVGProperty(int id, CSSValue*);
+    void applySVGProperty(CSSPropertyID, CSSValue*);
 #endif
 
     PassRefPtr<StyleImage> loadPendingImage(StylePendingImage*);
index 78e3516..e9b41a3 100644 (file)
@@ -209,7 +209,7 @@ void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, con
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
 #endif
-    int propertyID = cssPropertyID(propertyName);
+    CSSPropertyID propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return;
     bool important = priority.find("important", 0, false) != notFound;
@@ -230,7 +230,7 @@ String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName
 #if ENABLE(MUTATION_OBSERVERS)
     StyleAttributeMutationScope mutationScope(this);
 #endif
-    int propertyID = cssPropertyID(propertyName);
+    CSSPropertyID propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return String();
     ec = 0;
index 7ef3b07..d60bdf2 100644 (file)
@@ -68,7 +68,7 @@ PassRefPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForCurrentColor(
     return paint.release();
 }
 
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
 {
     Node* node = m_node.get();
     if (!node)
index 434ad2e..d3ec06e 100644 (file)
@@ -37,7 +37,7 @@ using namespace std;
 
 namespace WebCore {
 
-bool CSSParser::parseSVGValue(int propId, bool important)
+bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
 {
     CSSParserValue* value = m_valueList->current();
     if (!value)
index 318d72b..577411a 100644 (file)
@@ -102,7 +102,7 @@ static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor)
     return color;
 }
 
-void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
+void CSSStyleSelector::applySVGProperty(CSSPropertyID id, CSSValue* value)
 {
     ASSERT(value);
     CSSPrimitiveValue* primitiveValue = 0;
index a678714..a8f2186 100644 (file)
@@ -413,13 +413,13 @@ String StylePropertySet::getCommonValue(const StylePropertyShorthand& shorthand)
     return res;
 }
 
-PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(int propertyID) const
+PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const
 {
     const CSSProperty* property = findPropertyWithId(propertyID);
     return property ? property->value() : 0;
 }
 
-bool StylePropertySet::removeShorthandProperty(int propertyID)
+bool StylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
 {
     StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
     if (!shorthand.length())
@@ -427,7 +427,7 @@ bool StylePropertySet::removeShorthandProperty(int propertyID)
     return removePropertiesInSet(shorthand.properties(), shorthand.length());
 }
 
-bool StylePropertySet::removeProperty(int propertyID, String* returnText)
+bool StylePropertySet::removeProperty(CSSPropertyID propertyID, String* returnText)
 {
     if (removeShorthandProperty(propertyID)) {
         // FIXME: Return an equivalent shorthand when possible.
@@ -482,7 +482,7 @@ bool StylePropertySet::isPropertyImplicit(CSSPropertyID propertyID) const
     return property ? property->isImplicit() : false;
 }
 
-bool StylePropertySet::setProperty(int propertyID, const String& value, bool important, CSSStyleSheet* contextStyleSheet)
+bool StylePropertySet::setProperty(CSSPropertyID propertyID, const String& value, bool important, CSSStyleSheet* contextStyleSheet)
 {
     // Setting the value to an empty string just removes the property in both IE and Gecko.
     // Setting it to null seems to produce less consistent results, but we treat it just the same.
@@ -496,7 +496,7 @@ bool StylePropertySet::setProperty(int propertyID, const String& value, bool imp
     return CSSParser::parseValue(this, propertyID, value, important, cssParserMode(), contextStyleSheet);
 }
 
-void StylePropertySet::setProperty(int propertyID, PassRefPtr<CSSValue> prpValue, bool important)
+void StylePropertySet::setProperty(CSSPropertyID propertyID, PassRefPtr<CSSValue> prpValue, bool important)
 {
     StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
     if (!shorthand.length()) {
@@ -523,7 +523,7 @@ void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slo
     m_properties.append(property);
 }
 
-bool StylePropertySet::setProperty(int propertyID, int identifier, bool important, CSSStyleSheet* contextStyleSheet)
+bool StylePropertySet::setProperty(CSSPropertyID propertyID, int identifier, bool important, CSSStyleSheet* contextStyleSheet)
 {
     RefPtr<CSSPrimitiveValue> value;    
     if (Document* document = contextStyleSheet ? contextStyleSheet->findDocument() : 0)
@@ -729,7 +729,7 @@ String StylePropertySet::asText() const
         if (value == "initial" && !CSSProperty::isInheritedProperty(propertyID))
             continue;
 
-        result.append(getPropertyName(static_cast<CSSPropertyID>(propertyID)));
+        result.append(getPropertyName(propertyID));
         result.append(": ");
         result.append(value);
         result.append(prop.isImportant() ? " !important" : "");
@@ -871,7 +871,7 @@ bool StylePropertySet::removePropertiesInSet(const CSSPropertyID* set, unsigned
     return changed;
 }
 
-const CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) const
+const CSSProperty* StylePropertySet::findPropertyWithId(CSSPropertyID propertyID) const
 {
     for (int n = m_properties.size() - 1 ; n >= 0; --n) {
         if (propertyID == m_properties[n].id())
@@ -880,7 +880,7 @@ const CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) const
     return 0;
 }
 
-CSSProperty* StylePropertySet::findPropertyWithId(int propertyID)
+CSSProperty* StylePropertySet::findPropertyWithId(CSSPropertyID propertyID)
 {
     for (int n = m_properties.size() - 1 ; n >= 0; --n) {
         if (propertyID == m_properties[n].id())
@@ -897,7 +897,7 @@ bool StylePropertySet::propertyMatches(const CSSProperty* property) const
     
 void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style)
 {
-    Vector<int> propertiesToRemove;
+    Vector<CSSPropertyID> propertiesToRemove;
     size_t size = m_properties.size();
     for (size_t i = 0; i < size; ++i) {
         const CSSProperty& property = m_properties[i];
@@ -911,7 +911,7 @@ void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style)
 
 void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style)
 {
-    Vector<int> propertiesToRemove;
+    Vector<CSSPropertyID> propertiesToRemove;
     size_t size = m_properties.size();
     for (size_t i = 0; i < size; ++i) {
         const CSSProperty& property = m_properties[i];
index a1a17fb..908ab29 100644 (file)
@@ -61,21 +61,21 @@ public:
 
     void shrinkToFit() { m_properties.shrinkToFit(); }
 
-    PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
+    PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const;
     String getPropertyValue(CSSPropertyID) const;
     bool propertyIsImportant(CSSPropertyID) const;
     CSSPropertyID getPropertyShorthand(CSSPropertyID) const;
     bool isPropertyImplicit(CSSPropertyID) const;
 
     // These expand shorthand properties into multiple properties.
-    bool setProperty(int propertyID, const String& value, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
-    void setProperty(int propertyID, PassRefPtr<CSSValue>, bool important = false);
+    bool setProperty(CSSPropertyID, const String&, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
+    void setProperty(CSSPropertyID, PassRefPtr<CSSValue>, bool important = false);
 
     // These do not. FIXME: This is too messy, we can do better.
-    bool setProperty(int propertyID, int value, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
+    bool setProperty(CSSPropertyID, int, bool important = false, CSSStyleSheet* contextStyleSheet = 0);
     void setProperty(const CSSProperty&, CSSProperty* slot = 0);
     
-    bool removeProperty(int propertyID, String* returnText = 0);
+    bool removeProperty(CSSPropertyID, String* returnText = 0);
 
     void parseDeclaration(const String& styleDeclaration, CSSStyleSheet* contextStyleSheet);
 
@@ -128,11 +128,11 @@ private:
     String fontValue() const;
     bool appendFontLonghandValueIfExplicit(CSSPropertyID, StringBuilder&) const;
 
-    bool removeShorthandProperty(int propertyID);
+    bool removeShorthandProperty(CSSPropertyID);
     bool propertyMatches(const CSSProperty*) const;
 
-    const CSSProperty* findPropertyWithId(int propertyID) const;
-    CSSProperty* findPropertyWithId(int propertyID);
+    const CSSProperty* findPropertyWithId(CSSPropertyID) const;
+    CSSProperty* findPropertyWithId(CSSPropertyID);
 
     Vector<CSSProperty, 4> m_properties;
 
index b4de117..1aae48d 100644 (file)
@@ -416,7 +416,7 @@ const StylePropertyShorthand& webkitWrapShorthand()
 }
 
 // Returns an empty list if the property is not a shorthand
-const StylePropertyShorthand& shorthandForProperty(int propertyID)
+const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID)
 {
     switch (propertyID) {
     case CSSPropertyBackground:
index 218833d..175e3e1 100644 (file)
@@ -99,7 +99,7 @@ const StylePropertyShorthand& webkitTransformOriginShorthand();
 const StylePropertyShorthand& webkitWrapShorthand();
 
 // Returns an empty list if the property is not a shorthand
-const StylePropertyShorthand& shorthandForProperty(int);
+const StylePropertyShorthand& shorthandForProperty(CSSPropertyID);
 
 } // namespace WebCore
 
index 55bc41d..6429204 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "Attribute.h"
 #include "CSSImageValue.h"
+#include "CSSPropertyNames.h"
 #include "CSSStyleSelector.h"
 #include "CSSStyleSheet.h"
 #include "CSSValueKeywords.h"
@@ -145,21 +146,21 @@ void StyledElement::inlineStyleChanged()
     InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
 }
     
-bool StyledElement::setInlineStyleProperty(int propertyID, int identifier, bool important)
+bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, int identifier, bool important)
 {
     ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, document()->cssValuePool()->createIdentifierValue(identifier), important);
     inlineStyleChanged();
     return true;
 }
 
-bool StyledElement::setInlineStyleProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important)
+bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important)
 {
     ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, document()->cssValuePool()->createValue(value, unit), important);
     inlineStyleChanged();
     return true;
 }
 
-bool StyledElement::setInlineStyleProperty(int propertyID, const String& value, bool important)
+bool StyledElement::setInlineStyleProperty(CSSPropertyID propertyID, const String& value, bool important)
 {
     bool changes = ensureAttributeData()->ensureMutableInlineStyle(this)->setProperty(propertyID, value, important, document()->elementSheet());
     if (changes)
@@ -167,7 +168,7 @@ bool StyledElement::setInlineStyleProperty(int propertyID, const String& value,
     return changes;
 }
 
-bool StyledElement::removeInlineStyleProperty(int propertyID)
+bool StyledElement::removeInlineStyleProperty(CSSPropertyID propertyID)
 {
     StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0;
     if (!inlineStyle)
@@ -278,12 +279,12 @@ void StyledElement::updateAttributeStyle()
         cacheIterator->second = newEntry.release();
 }
 
-void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, int propertyID, int identifier)
+void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, CSSPropertyID propertyID, int identifier)
 {
     style->setProperty(propertyID, document()->cssValuePool()->createIdentifierValue(identifier));
 }
 
-void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, int propertyID, double value, CSSPrimitiveValue::UnitTypes unit)
+void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, CSSPropertyID propertyID, double value, CSSPrimitiveValue::UnitTypes unit)
 {
     style->setProperty(propertyID, document()->cssValuePool()->createValue(value, unit));
 }
index 9ae7c1d..d1d208f 100644 (file)
@@ -44,10 +44,10 @@ public:
     const StylePropertySet* ensureInlineStyle() { return ensureAttributeData()->ensureInlineStyle(this); }
     
     // Unlike StylePropertySet setters, these implement invalidation.
-    bool setInlineStyleProperty(int propertyID, int identifier, bool important = false);
-    bool setInlineStyleProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes, bool important = false);
-    bool setInlineStyleProperty(int propertyID, const String& value, bool important = false);
-    bool removeInlineStyleProperty(int propertyID);
+    bool setInlineStyleProperty(CSSPropertyID, int, bool important = false);
+    bool setInlineStyleProperty(CSSPropertyID, double, CSSPrimitiveValue::UnitTypes, bool important = false);
+    bool setInlineStyleProperty(CSSPropertyID, const String&, bool important = false);
+    bool removeInlineStyleProperty(CSSPropertyID);
     
     virtual CSSStyleDeclaration* style() OVERRIDE;
 
@@ -69,9 +69,9 @@ protected:
 
     virtual bool isPresentationAttribute(const QualifiedName&) const { return false; }
 
-    void addPropertyToAttributeStyle(StylePropertySet*, int propertyID, int identifier);
-    void addPropertyToAttributeStyle(StylePropertySet*, int propertyID, double value, CSSPrimitiveValue::UnitTypes);
-    void addPropertyToAttributeStyle(StylePropertySet*, int propertyID, const String& value);
+    void addPropertyToAttributeStyle(StylePropertySet*, CSSPropertyID, int);
+    void addPropertyToAttributeStyle(StylePropertySet*, CSSPropertyID, double, CSSPrimitiveValue::UnitTypes);
+    void addPropertyToAttributeStyle(StylePropertySet*, CSSPropertyID, const String&);
 
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
@@ -113,7 +113,7 @@ inline StylePropertySet* StyledElement::attributeStyle()
     return attributeData() ? attributeData()->attributeStyle() : 0;
 }
 
-inline void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, int propertyID, const String& value)
+inline void StyledElement::addPropertyToAttributeStyle(StylePropertySet* style, CSSPropertyID propertyID, const String& value)
 {
     style->setProperty(propertyID, value, false, document()->elementSheet());
 }
index 09a450d..9dd3ce4 100644 (file)
@@ -134,7 +134,7 @@ protected:
     HTMLElementEquivalent(CSSPropertyID);
     HTMLElementEquivalent(CSSPropertyID, const QualifiedName& tagName);
     HTMLElementEquivalent(CSSPropertyID, int primitiveValue, const QualifiedName& tagName);
-    const int m_propertyID;
+    const CSSPropertyID m_propertyID;
     const RefPtr<CSSPrimitiveValue> m_primitiveValue;
     const QualifiedName* m_tagName; // We can store a pointer because HTML tag names are const global.
 };
@@ -332,7 +332,7 @@ EditingStyle::EditingStyle(const CSSStyleDeclaration* style)
     extractFontSizeDelta();
 }
 
-EditingStyle::EditingStyle(int propertyID, const String& value)
+EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value)
     : m_mutableStyle(0)
     , m_shouldUseFixedDefaultFontSize(false)
     , m_fontSizeDelta(NoFontDelta)
@@ -411,7 +411,7 @@ void EditingStyle::removeTextFillAndStrokeColorsIfNeeded(RenderStyle* renderStyl
         m_mutableStyle->removeProperty(CSSPropertyWebkitTextStrokeColor);
 }
 
-void EditingStyle::setProperty(int propertyID, const String& value, bool important)
+void EditingStyle::setProperty(CSSPropertyID propertyID, const String& value, bool important)
 {
     if (!m_mutableStyle)
         m_mutableStyle = StylePropertySet::create();
index c213036..d6df518 100644 (file)
@@ -91,7 +91,7 @@ public:
         return adoptRef(new EditingStyle(style));
     }
 
-    static PassRefPtr<EditingStyle> create(int propertyID, const String& value)
+    static PassRefPtr<EditingStyle> create(CSSPropertyID propertyID, const String& value)
     {
         return adoptRef(new EditingStyle(propertyID, value));
     }
@@ -152,10 +152,10 @@ private:
     EditingStyle(const Position&, PropertiesToInclude);
     EditingStyle(const StylePropertySet*);
     EditingStyle(const CSSStyleDeclaration*);
-    EditingStyle(int propertyID, const String& value);
+    EditingStyle(CSSPropertyID, const String&);
     void init(Node*, PropertiesToInclude);
     void removeTextFillAndStrokeColorsIfNeeded(RenderStyle*);
-    void setProperty(int propertyID, const String& value, bool important = false);
+    void setProperty(CSSPropertyID, const String&, bool important = false);
     void replaceFontSizeByKeywordIfPossible(RenderStyle*, CSSComputedStyleDeclaration*);
     void extractFontSizeDelta();
     TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties) const;
index 1cc18b7..be71092 100644 (file)
@@ -731,13 +731,13 @@ void Editor::applyParagraphStyleToSelection(StylePropertySet* style, EditAction
         applyParagraphStyle(style, editingAction);
 }
 
-bool Editor::selectionStartHasStyle(int propertyID, const String& value) const
+bool Editor::selectionStartHasStyle(CSSPropertyID propertyID, const String& value) const
 {
     return EditingStyle::create(propertyID, value)->triStateOfStyle(
         EditingStyle::styleAtSelectionStart(m_frame->selection()->selection(), propertyID == CSSPropertyBackgroundColor).get());
 }
 
-TriState Editor::selectionHasStyle(int propertyID, const String& value) const
+TriState Editor::selectionHasStyle(CSSPropertyID propertyID, const String& value) const
 {
     return EditingStyle::create(propertyID, value)->triStateOfStyle(m_frame->selection()->selection());
 }
index 2c43e26..abf2641 100644 (file)
@@ -136,8 +136,8 @@ public:
     void respondToChangedSelection(const VisibleSelection& oldSelection);
     void respondToChangedContents(const VisibleSelection& endingSelection);
 
-    bool selectionStartHasStyle(int propertyID, const String& value) const;
-    TriState selectionHasStyle(int propertyID, const String& value) const;
+    bool selectionStartHasStyle(CSSPropertyID, const String&) const;
+    TriState selectionHasStyle(CSSPropertyID, const String&) const;
     String selectionStartCSSPropertyValue(CSSPropertyID);
     
     TriState selectionUnorderedListState() const;
index 1987729..a2f147e 100644 (file)
@@ -114,14 +114,14 @@ static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAc
     return false;
 }
 
-static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
+static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, const String& propertyValue)
 {
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
     return applyCommandToFrame(frame, source, action, style.get());
 }
 
-static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue)
+static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, int propertyValue)
 {
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
@@ -131,7 +131,7 @@ static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditActi
 // FIXME: executeToggleStyleInList does not handle complicated cases such as <b><u>hello</u>world</b> properly.
 //        This function must use Editor::selectionHasStyle to determine the current style but we cannot fix this
 //        until https://bugs.webkit.org/show_bug.cgi?id=27818 is resolved.
-static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, CSSValue* value)
+static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, CSSValue* value)
 {
     ExceptionCode ec = 0;
     RefPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(frame->selection()->selection());
@@ -156,7 +156,7 @@ static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E
     return applyCommandToFrame(frame, source, action, newMutableStyle.get());
 }
 
-static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const char* offValue, const char* onValue)
+static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, const char* offValue, const char* onValue)
 {
     // Style is considered present when
     // Mac: present at the beginning of selection
@@ -172,7 +172,7 @@ static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAct
     return applyCommandToFrame(frame, source, action, style->style());
 }
 
-static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue)
+static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, CSSPropertyID propertyID, const String& propertyValue)
 {
     RefPtr<StylePropertySet> style = StylePropertySet::create();
     style->setProperty(propertyID, propertyValue);
@@ -224,7 +224,7 @@ static bool expandSelectionToGranularity(Frame* frame, TextGranularity granulari
     return true;
 }
 
-static TriState stateStyle(Frame* frame, int propertyID, const char* desiredValue)
+static TriState stateStyle(Frame* frame, CSSPropertyID propertyID, const char* desiredValue)
 {
     if (frame->editor()->behavior().shouldToggleStyleBasedOnStartOfSelection())
         return frame->editor()->selectionStartHasStyle(propertyID, desiredValue) ? TrueTriState : FalseTriState;
index 05cde4a..364a17c 100644 (file)
@@ -70,7 +70,7 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-static bool propertyMissingOrEqualToNone(StylePropertySet*, int propertyID);
+static bool propertyMissingOrEqualToNone(StylePropertySet*, CSSPropertyID);
 
 class AttributeChange {
 public:
@@ -466,7 +466,7 @@ static inline Node* ancestorToRetainStructureAndAppearanceWithNoRenderer(Node* c
     return ancestorToRetainStructureAndAppearanceForBlock(commonAncestorBlock);
 }
 
-static bool propertyMissingOrEqualToNone(StylePropertySet* style, int propertyID)
+static bool propertyMissingOrEqualToNone(StylePropertySet* style, CSSPropertyID propertyID)
 {
     if (!style)
         return false;
index 9d79551..39897d0 100644 (file)
@@ -999,7 +999,7 @@ void HTMLElement::setItemValueText(const String& value, ExceptionCode& ec)
 }
 #endif
 
-void HTMLElement::addHTMLLengthToStyle(StylePropertySet* style, int propertyID, const String& value)
+void HTMLElement::addHTMLLengthToStyle(StylePropertySet* style, CSSPropertyID propertyID, const String& value)
 {
     // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
     // length unit and make the appropriate parsed value.
@@ -1090,7 +1090,7 @@ static RGBA32 parseColorStringWithCrazyLegacyRules(const String& colorString)
 }
 
 // Color parsing that matches HTML's "rules for parsing a legacy color value"
-void HTMLElement::addHTMLColorToStyle(StylePropertySet* style, int propertyID, const String& attributeValue)
+void HTMLElement::addHTMLColorToStyle(StylePropertySet* style, CSSPropertyID propertyID, const String& attributeValue)
 {
     // An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.)
     if (attributeValue.isEmpty())
index 2b35861..da42acb 100644 (file)
@@ -108,8 +108,8 @@ public:
 protected:
     HTMLElement(const QualifiedName& tagName, Document*);
 
-    void addHTMLLengthToStyle(StylePropertySet*, int propertyID, const String& value);
-    void addHTMLColorToStyle(StylePropertySet*, int propertyID, const String& color);
+    void addHTMLLengthToStyle(StylePropertySet*, CSSPropertyID, const String&);
+    void addHTMLColorToStyle(StylePropertySet*, CSSPropertyID, const String&);
 
     void applyAlignmentAttributeToStyle(Attribute*, StylePropertySet*);
     void applyBorderAttributeToStyle(Attribute*, StylePropertySet*);
index 052be28..1c3080b 100644 (file)
@@ -501,7 +501,7 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con
                 // Parsed property overrides any property with the same name. Non-parsed property overrides
                 // previous non-parsed property with the same name (if any).
                 bool shouldInactivate = false;
-                CSSPropertyID propertyId = static_cast<CSSPropertyID>(cssPropertyID(name));
+                CSSPropertyID propertyId = cssPropertyID(name);
                 // Canonicalize property names to treat non-prefixed and vendor-prefixed property names the same (opacity vs. -webkit-opacity).
                 String canonicalPropertyName = propertyId ? String(getPropertyName(propertyId)) : name;
                 HashMap<String, RefPtr<TypeBuilder::CSS::CSSProperty> >::iterator activeIt = propertyNameToPreviousActiveProperty.find(canonicalPropertyName);
index 63cdcf7..204aa2f 100644 (file)
@@ -1144,7 +1144,7 @@ static void addPropertyWrapper(int propertyID, PropertyWrapperBase* wrapper)
 
 static void addShorthandProperties()
 {
-    static const int animatableShorthandProperties[] = {
+    static const CSSPropertyID animatableShorthandProperties[] = {
         CSSPropertyBackground, // for background-color, background-position, background-image
         CSSPropertyBackgroundPosition,
         CSSPropertyFont, // for font-size, font-weight
@@ -1168,7 +1168,7 @@ static void addShorthandProperties()
     };
 
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
-        int propertyID = animatableShorthandProperties[i];
+        CSSPropertyID propertyID = animatableShorthandProperties[i];
         StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
         if (shorthand.length() > 0)
             addPropertyWrapper(propertyID, new ShorthandPropertyWrapper(propertyID, shorthand));
index 92750af..5e43070 100644 (file)
@@ -61,14 +61,14 @@ PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& t
     return adoptRef(new SVGFontFaceElement(tagName, document));
 }
 
-static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
+static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
 {
     if (!attrName.namespaceURI().isNull())
-        return 0;
+        return CSSPropertyInvalid;
     
-    static HashMap<AtomicStringImpl*, int>* propertyNameToIdMap = 0;
+    static HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
     if (!propertyNameToIdMap) {
-        propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>;
+        propertyNameToIdMap = new HashMap<AtomicStringImpl*, CSSPropertyID>;
         // This is a list of all @font-face CSS properties which are exposed as SVG XML attributes
         // Those commented out are not yet supported by WebCore's style system
         // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr);
@@ -111,7 +111,7 @@ static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
 
 void SVGFontFaceElement::parseAttribute(Attribute* attr)
 {    
-    int propId = cssPropertyIdForSVGAttributeName(attr->name());
+    CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attr->name());
     if (propId > 0) {
         m_fontFaceRule->properties()->setProperty(propId, attr->value(), false);
         rebuildFontFace();
index 2fadf63..75a00ff 100644 (file)
@@ -57,10 +57,10 @@ END_REGISTER_ANIMATED_PROPERTIES
 
 using namespace SVGNames;
 
-void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName)
+void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName)
 {
     // FIXME: when CSS supports "transform-origin" the special case for transform_originAttr can be removed.
-    int propertyId = cssPropertyID(attrName.localName());
+    CSSPropertyID propertyId = cssPropertyID(attrName.localName());
     if (!propertyId && attrName == transform_originAttr)
         propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit-transform-origin")
     ASSERT(propertyId > 0);
@@ -134,14 +134,14 @@ bool SVGStyledElement::rendererIsNeeded(const NodeRenderingContext& context)
     return false;
 }
 
-int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
+CSSPropertyID SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
 {
     if (!attrName.namespaceURI().isNull())
-        return 0;
+        return CSSPropertyInvalid;
     
-    static HashMap<AtomicStringImpl*, int>* propertyNameToIdMap = 0;
+    static HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
     if (!propertyNameToIdMap) {
-        propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>;
+        propertyNameToIdMap = new HashMap<AtomicStringImpl*, CSSPropertyID>;
         // This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes
         mapAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr);
         mapAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr);
@@ -298,7 +298,7 @@ bool SVGStyledElement::isPresentationAttribute(const QualifiedName& name) const
 
 void SVGStyledElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
 {
-    int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
+    CSSPropertyID propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
     if (propertyID > 0)
         addPropertyToAttributeStyle(style, propertyID, attr->value());
 }
@@ -325,7 +325,7 @@ bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName)
 
 void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
 {
-    int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
+    CSSPropertyID propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
     if (propId > 0) {
         SVGElementInstance::invalidateAllInstancesOfElement(this);
         return;
@@ -421,7 +421,7 @@ PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& na
         return 0;
 
     RefPtr<StylePropertySet> style = StylePropertySet::create(SVGAttributeMode);
-    int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
+    CSSPropertyID propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
     style->setProperty(propertyID, attr->value());
     return style->getPropertyCSSValue(propertyID);
 }
index 64830e8..fe3a8e7 100644 (file)
@@ -22,6 +22,7 @@
 #define SVGStyledElement_h
 
 #if ENABLE(SVG)
+#include "CSSPropertyNames.h"
 #include "SVGAnimatedString.h"
 #include "SVGLocatable.h"
 #include "SVGStylable.h"
@@ -29,7 +30,7 @@
 
 namespace WebCore {
 
-void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName);
+void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
 
 class SVGStyledElement : public SVGElement,
                          public SVGStylable {
@@ -75,7 +76,7 @@ protected:
     virtual void removedFromDocument();
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-    static int cssPropertyIdForSVGAttributeName(const QualifiedName&);
+    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
     void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
     void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
 
index fc72ca6..b053298 100644 (file)
@@ -906,7 +906,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value)
     if (!m_element || !m_element->isStyledElement())
         return;
 
-    int propID = cssPropertyID(name);
+    CSSPropertyID propID = cssPropertyID(name);
     static_cast<StyledElement*>(m_element)->setInlineStyleProperty(propID, value);
 }
 
index 9f0ee2c..7a310dd 100644 (file)
@@ -1,3 +1,15 @@
+2012-04-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        [Part 2] We should use CSSPropertyID rather than integers when manipulating CSS property ids.
+        https://bugs.webkit.org/show_bug.cgi?id=82977
+
+        Reviewed by Andreas Kling.
+
+        Update the code to use CSSPropertyID rather than an integer.
+
+        * Api/qwebelement.cpp:
+        (QWebElement::setStyleProperty):
+
 2012-04-02  Alexis Menard  <alexis.menard@openbossa.org>
 
         We should use CSSPropertyID rather than integers when manipulating CSS property ids.