+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
__ZNK7WebCore6Editor16compositionRangeEv
__ZNK7WebCore6Editor16fontForSelectionERb
__ZNK7WebCore6Editor17firstRectForRangeEPNS_5RangeE
-__ZNK7WebCore6Editor17selectionHasStyleEiRKN3WTF6StringE
+__ZNK7WebCore6Editor17selectionHasStyleENS_13CSSPropertyIDERKN3WTF6StringE
__ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
__ZNK7WebCore6Editor23getCompositionSelectionERjS1_
__ZNK7WebCore6Editor26selectionStartHasMarkerForENS_14DocumentMarker10MarkerTypeEii
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 += ";";
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);
return list.release();
}
-PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int propertyID) const
+PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propertyID) const
{
return getPropertyCSSValue(propertyID, UpdateLayout);
}
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)
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)
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.
propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->writingMode());
- switch (static_cast<CSSPropertyID>(propertyID)) {
+ switch (propertyID) {
case CSSPropertyInvalid:
break;
}
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())
return 0;
}
-String CSSComputedStyleDeclaration::getPropertyValue(int propertyID) const
+String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
{
RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
if (value)
if (i >= length())
return "";
- return getPropertyName(static_cast<CSSPropertyID>(computedProperties[i]));
+ return getPropertyName(computedProperties[i]);
}
bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName)
{
- int propertyID = cssPropertyID(propertyName);
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return 0;
return getPropertyCSSValue(propertyID);
String CSSComputedStyleDeclaration::getPropertyValue(const String &propertyName)
{
- int propertyID = cssPropertyID(propertyName);
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
return getPropertyValue(propertyID);
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;
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;
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
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)
return m_keyframe.release();
}
-static inline bool isColorPropertyID(int propertyId)
+static inline bool isColorPropertyID(CSSPropertyID propertyId)
{
switch (propertyId) {
case CSSPropertyColor:
}
}
-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())
return true;
}
-static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativeNumbers)
+static inline bool isSimpleLengthPropertyID(CSSPropertyID propertyId, bool& acceptsNegativeNumbers)
{
switch (propertyId) {
case CSSPropertyFontSize:
}
}
-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);
return true;
}
-static inline bool isValidKeywordPropertyAndValue(int propertyId, int valueID)
+static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int valueID)
{
if (!valueID)
return false;
return false;
}
-static inline bool isKeywordPropertyID(int propertyId)
+static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
{
switch (propertyId) {
case CSSPropertyBorderBottomStyle:
}
}
-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;
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);
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));
}
return 0;
}
-bool CSSParser::parseValue(int propId, bool important)
+bool CSSParser::parseValue(CSSPropertyID propId, bool important)
{
if (!m_valueList)
return false;
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
*/
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;
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)
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)
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)
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;
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,
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
}
// auto | <identifier>
-bool CSSParser::parsePage(int propId, bool important)
+bool CSSParser::parsePage(CSSPropertyID propId, bool important)
{
ASSERT(propId == CSSPropertyPage);
}
// <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);
// [ <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()) {
// [ <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();
}
}
-PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
+PassRefPtr<CSSValue> CSSParser::parseFillSize(CSSPropertyID propId, bool& allowComma)
{
allowComma = true;
CSSParserValue* value = m_valueList->current();
parsedValue1 = createPrimitiveNumericValue(value);
}
- CSSPropertyID property = static_cast<CSSPropertyID>(propId);
RefPtr<CSSPrimitiveValue> parsedValue2;
if ((value = m_valueList->next())) {
if (value->unit == CSSParserValue::Operator && value->iValue == ',')
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.
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;
m_valueList->next();
break;
}
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
}
if (!currValue)
return false;
return 0;
}
-bool CSSParser::parseAnimationProperty(int propId, RefPtr<CSSValue>& result)
+bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& result)
{
RefPtr<CSSValueList> values;
CSSParserValue* val;
if (currValue)
m_valueList->next();
break;
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
}
if (!currValue)
}
#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) {
return args->current();
}
-bool CSSParser::parseDashboardRegions(int propId, bool important)
+bool CSSParser::parseDashboardRegions(CSSPropertyID propId, bool important)
{
bool valid = true;
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();
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.
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.
return 0;
}
-bool CSSParser::parseReflect(int propId, bool important)
+bool CSSParser::parseReflect(CSSPropertyID propId, bool important)
{
// box-reflect: <direction> <offset> <mask>
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);
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;
bool m_fill;
};
-bool CSSParser::parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>& result)
+bool CSSParser::parseBorderImageSlice(CSSPropertyID propId, RefPtr<CSSBorderImageSliceValue>& result)
{
BorderImageSliceParseContext context(this);
CSSParserValue* val;
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)
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;
}
// none | <ident>
-bool CSSParser::parseFlowThread(int propId, bool important)
+bool CSSParser::parseFlowThread(CSSPropertyID propId, bool important)
{
ASSERT(propId == CSSPropertyWebkitFlowInto);
ASSERT(cssRegionsEnabled());
}
// -webkit-flow-from: none | <ident>
-bool CSSParser::parseRegionThread(int propId, bool important)
+bool CSSParser::parseRegionThread(CSSPropertyID propId, bool important)
{
ASSERT(propId == CSSPropertyWebkitFlowFrom);
ASSERT(cssRegionsEnabled());
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;
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;
m_valueList->next();
break;
}
+ default:
+ ASSERT_NOT_REACHED();
+ return false;
}
return value;
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);
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);
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);
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);
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);
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);
#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);
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);
CSSParserMode m_cssParserMode;
bool m_important;
- int m_id;
+ CSSPropertyID m_id;
CSSStyleSheet* m_styleSheet;
RefPtr<StyleRuleBase> m_rule;
RefPtr<StyleKeyframe> m_keyframe;
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,
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*);
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;
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) {
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];
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:
}
}
-bool CSSProperty::isInheritedProperty(unsigned propertyID)
+bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID)
{
- switch (static_cast<CSSPropertyID>(propertyID)) {
+ switch (propertyID) {
case CSSPropertyBorderCollapse:
case CSSPropertyBorderSpacing:
case CSSPropertyCaptionSide:
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)
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.
ASSERT(!current.value()->isInheritedValue());
continue;
}
- int property = current.id();
+ CSSPropertyID property = current.id();
if (filterRegionProperties && !CSSStyleSelector::isValidRegionStyleProperty(property))
continue;
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);
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:
// 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:
}
#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());
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);
// 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
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());
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);
}
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();
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);
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*);
#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;
#if ENABLE(MUTATION_OBSERVERS)
StyleAttributeMutationScope mutationScope(this);
#endif
- int propertyID = cssPropertyID(propertyName);
+ CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID)
return String();
ec = 0;
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)
namespace WebCore {
-bool CSSParser::parseSVGValue(int propId, bool important)
+bool CSSParser::parseSVGValue(CSSPropertyID propId, bool important)
{
CSSParserValue* value = m_valueList->current();
if (!value)
return color;
}
-void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
+void CSSStyleSelector::applySVGProperty(CSSPropertyID id, CSSValue* value)
{
ASSERT(value);
CSSPrimitiveValue* primitiveValue = 0;
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())
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.
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.
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()) {
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)
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" : "");
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())
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())
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];
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];
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);
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;
}
// 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:
const StylePropertyShorthand& webkitWrapShorthand();
// Returns an empty list if the property is not a shorthand
-const StylePropertyShorthand& shorthandForProperty(int);
+const StylePropertyShorthand& shorthandForProperty(CSSPropertyID);
} // namespace WebCore
#include "Attribute.h"
#include "CSSImageValue.h"
+#include "CSSPropertyNames.h"
#include "CSSStyleSelector.h"
#include "CSSStyleSheet.h"
#include "CSSValueKeywords.h"
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)
return changes;
}
-bool StyledElement::removeInlineStyleProperty(int propertyID)
+bool StyledElement::removeInlineStyleProperty(CSSPropertyID propertyID)
{
StylePropertySet* inlineStyle = attributeData() ? attributeData()->inlineStyle() : 0;
if (!inlineStyle)
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));
}
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;
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;
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());
}
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.
};
extractFontSizeDelta();
}
-EditingStyle::EditingStyle(int propertyID, const String& value)
+EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value)
: m_mutableStyle(0)
, m_shouldUseFixedDefaultFontSize(false)
, m_fontSizeDelta(NoFontDelta)
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();
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));
}
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;
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());
}
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;
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);
// 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());
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
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);
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;
using namespace HTMLNames;
-static bool propertyMissingOrEqualToNone(StylePropertySet*, int propertyID);
+static bool propertyMissingOrEqualToNone(StylePropertySet*, CSSPropertyID);
class AttributeChange {
public:
return ancestorToRetainStructureAndAppearanceForBlock(commonAncestorBlock);
}
-static bool propertyMissingOrEqualToNone(StylePropertySet* style, int propertyID)
+static bool propertyMissingOrEqualToNone(StylePropertySet* style, CSSPropertyID propertyID)
{
if (!style)
return false;
}
#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.
}
// 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())
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*);
// 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);
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
};
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));
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);
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();
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);
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);
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());
}
void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
{
- int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
+ CSSPropertyID propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
if (propId > 0) {
SVGElementInstance::invalidateAllInstancesOfElement(this);
return;
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);
}
#define SVGStyledElement_h
#if ENABLE(SVG)
+#include "CSSPropertyNames.h"
#include "SVGAnimatedString.h"
#include "SVGLocatable.h"
#include "SVGStylable.h"
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 {
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*);
if (!m_element || !m_element->isStyledElement())
return;
- int propID = cssPropertyID(name);
+ CSSPropertyID propID = cssPropertyID(name);
static_cast<StyledElement*>(m_element)->setInlineStyleProperty(propID, value);
}
+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.