Generate toCSSFooValue for CSS child values

https://bugs.webkit.org/show_bug.cgi?id=122157

Reviewed by Darin Adler.

As a step to cleanup static_cast<> for CSSFooValue, this patch adds toCSSFooValue()
for "CSSAspectRatioValue, CSSBorderImageSliceValue, CSSFunctionValue, CSSInheritedValue,
CSSValueList, CSSVariableValue, and CSSFontFaceSrcValue".

To use CSS_VALUE_TYPE_CASTS, isFunctionValue(), isFontFaceSrcValue() are added to
generate toCSSFunctionValue, toCSSFontFaceSrcValue().

No new tests, no behavior changes.

* css/CSSAspectRatioValue.h:
* css/CSSBorderImageSliceValue.h:
* css/CSSFontFaceSrcValue.h:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSFunctionValue.h:
* css/CSSInheritedValue.h:
* css/CSSParser.cpp:
(WebCore::filterProperties):
(WebCore::CSSParser::addFillValue):
(WebCore::CSSParser::addAnimationValue):
(WebCore::CSSParser::createFontFaceRule):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::wrapValueInCommaSeparatedList):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImage):
(WebCore::CSSToStyleMap::mapNinePieceImageSlice):
* css/CSSValue.cpp:
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isFunctionValue):
(WebCore::CSSValue::isFontFaceSrcValue):
* css/CSSValueList.h:
(WebCore::CSSValueListInspector::CSSValueListInspector):
* css/CSSVariableValue.h:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyFillLayer::applyValue):
(WebCore::ApplyPropertyFontVariantLigatures::applyValue):
(WebCore::ApplyPropertyCounter::applyValue):
(WebCore::ApplyPropertyCursor::applyValue):
(WebCore::ApplyPropertyTextEmphasisStyle::applyValue):
(WebCore::ApplyPropertyAspectRatio::applyValue):
(WebCore::ApplyPropertyImageResolution::applyValue):
(WebCore::ApplyPropertyTextIndent::applyValue):
* css/MediaQueryEvaluator.cpp:
(WebCore::compareAspectRatioValue):
* css/SVGCSSStyleSelector.cpp:
(WebCore::StyleResolver::applySVGProperty):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getLayeredShorthandValue):
* css/StyleResolver.cpp:
(WebCore::createGridPosition):
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::parseCustomFilterParameter):
(WebCore::StyleResolver::createCustomFilterOperationWithInlineSyntax):
* editing/EditingStyle.cpp:
(WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle):
(WebCore::EditingStyle::mergeStyle):
(WebCore::StyleChange::extractTextStyles):
(WebCore::diffTextDecorations):
* editing/EditorCommand.cpp:
(WebCore::executeToggleStyleInList):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eb804561
2013-10-01 Gyuyoung Kim <gyuyoung.kim@samsung.com>
Generate toCSSFooValue for CSS child values
https://bugs.webkit.org/show_bug.cgi?id=122157
Reviewed by Darin Adler.
As a step to cleanup static_cast<> for CSSFooValue, this patch adds toCSSFooValue()
for "CSSAspectRatioValue, CSSBorderImageSliceValue, CSSFunctionValue, CSSInheritedValue,
CSSValueList, CSSVariableValue, and CSSFontFaceSrcValue".
To use CSS_VALUE_TYPE_CASTS, isFunctionValue(), isFontFaceSrcValue() are added to
generate toCSSFunctionValue, toCSSFontFaceSrcValue().
No new tests, no behavior changes.
* css/CSSAspectRatioValue.h:
* css/CSSBorderImageSliceValue.h:
* css/CSSFontFaceSrcValue.h:
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::addFontFaceRule):
* css/CSSFunctionValue.h:
* css/CSSInheritedValue.h:
* css/CSSParser.cpp:
(WebCore::filterProperties):
(WebCore::CSSParser::addFillValue):
(WebCore::CSSParser::addAnimationValue):
(WebCore::CSSParser::createFontFaceRule):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::wrapValueInCommaSeparatedList):
* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapNinePieceImage):
(WebCore::CSSToStyleMap::mapNinePieceImageSlice):
* css/CSSValue.cpp:
(WebCore::CSSValue::destroy):
* css/CSSValue.h:
(WebCore::CSSValue::isFunctionValue):
(WebCore::CSSValue::isFontFaceSrcValue):
* css/CSSValueList.h:
(WebCore::CSSValueListInspector::CSSValueListInspector):
* css/CSSVariableValue.h:
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyFillLayer::applyValue):
(WebCore::ApplyPropertyFontVariantLigatures::applyValue):
(WebCore::ApplyPropertyCounter::applyValue):
(WebCore::ApplyPropertyCursor::applyValue):
(WebCore::ApplyPropertyTextEmphasisStyle::applyValue):
(WebCore::ApplyPropertyAspectRatio::applyValue):
(WebCore::ApplyPropertyImageResolution::applyValue):
(WebCore::ApplyPropertyTextIndent::applyValue):
* css/MediaQueryEvaluator.cpp:
(WebCore::compareAspectRatioValue):
* css/SVGCSSStyleSelector.cpp:
(WebCore::StyleResolver::applySVGProperty):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getLayeredShorthandValue):
* css/StyleResolver.cpp:
(WebCore::createGridPosition):
(WebCore::StyleResolver::applyProperty):
(WebCore::StyleResolver::parseCustomFilterParameter):
(WebCore::StyleResolver::createCustomFilterOperationWithInlineSyntax):
* editing/EditingStyle.cpp:
(WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle):
(WebCore::EditingStyle::mergeStyle):
(WebCore::StyleChange::extractTextStyles):
(WebCore::diffTextDecorations):
* editing/EditorCommand.cpp:
(WebCore::executeToggleStyleInList):
* svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::rebuildFontFace):
2013-10-01 Sam Weinig <sam@webkit.org>
Convert PageGroup to using std::unique_ptr
......@@ -60,6 +60,8 @@ private:
float m_denominatorValue;
};
CSS_VALUE_TYPE_CASTS(AspectRatioValue)
}
#endif
......@@ -56,6 +56,8 @@ private:
CSSBorderImageSliceValue(PassRefPtr<CSSPrimitiveValue> slices, bool fill);
};
CSS_VALUE_TYPE_CASTS(BorderImageSliceValue)
} // namespace WebCore
#endif // CSSBorderImageSliceValue_h
......@@ -95,6 +95,8 @@ private:
#endif
};
CSS_VALUE_TYPE_CASTS(FontFaceSrcValue)
}
#endif
......@@ -99,15 +99,15 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
if (!fontFamily || !src || !fontFamily->isValueList() || !src->isValueList() || (unicodeRange && !unicodeRange->isValueList()))
return;
CSSValueList* familyList = static_cast<CSSValueList*>(fontFamily.get());
CSSValueList* familyList = toCSSValueList(fontFamily.get());
if (!familyList->length())
return;
CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
CSSValueList* srcList = toCSSValueList(src.get());
if (!srcList->length())
return;
CSSValueList* rangeList = static_cast<CSSValueList*>(unicodeRange.get());
CSSValueList* rangeList = toCSSValueList(unicodeRange.get());
unsigned traitsMask = 0;
......@@ -178,7 +178,7 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
} else if (!fontVariant->isValueList())
return;
CSSValueList* variantList = static_cast<CSSValueList*>(fontVariant.get());
CSSValueList* variantList = toCSSValueList(fontVariant.get());
unsigned numVariants = variantList->length();
if (!numVariants)
return;
......@@ -207,7 +207,7 @@ void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule)
for (int i = 0; i < srcLength; i++) {
// An item in the list either specifies a string (local font name) or a URL (remote font to download).
CSSFontFaceSrcValue* item = static_cast<CSSFontFaceSrcValue*>(srcList->itemWithoutBoundsCheck(i));
CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->itemWithoutBoundsCheck(i));
OwnPtr<CSSFontFaceSource> source;
#if ENABLE(SVG_FONTS)
......
......@@ -57,6 +57,8 @@ private:
RefPtr<CSSValueList> m_args;
};
CSS_VALUE_TYPE_CASTS(FunctionValue)
}
#endif
......@@ -44,6 +44,8 @@ private:
}
};
CSS_VALUE_TYPE_CASTS(InheritedValue)
} // namespace WebCore
#endif // CSSInheritedValue_h
......@@ -1527,7 +1527,7 @@ static inline void filterProperties(bool important, const CSSParser::ParsedPrope
continue;
#if ENABLE(CSS_VARIABLES)
if (property.id() == CSSPropertyVariable) {
const AtomicString& name = static_cast<CSSVariableValue*>(property.value())->name();
const AtomicString& name = toCSSVariableValue(property.value())->name();
if (seenVariables.contains(name))
continue;
seenVariables.add(name);
......@@ -3193,7 +3193,7 @@ void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval)
{
if (lval) {
if (lval->isBaseValueList())
static_cast<CSSValueList*>(lval.get())->append(rval);
toCSSValueList(lval.get())->append(rval);
else {
PassRefPtr<CSSValue> oldlVal(lval.release());
PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
......@@ -3401,7 +3401,7 @@ void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> r
{
if (lval) {
if (lval->isValueList())
static_cast<CSSValueList*>(lval.get())->append(rval);
toCSSValueList(lval.get())->append(rval);
else {
PassRefPtr<CSSValue> oldVal(lval.release());
PassRefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
......@@ -11663,7 +11663,7 @@ PassRefPtr<StyleRuleBase> CSSParser::createFontFaceRule()
CSSProperty& property = m_parsedProperties[i];
if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue())
property.wrapValueInCommaSeparatedList();
else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) {
else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || toCSSValueList(property.value())->length() != 1)) {
// Unlike font-family property, font-family descriptor in @font-face rule
// has to be a value list with exactly one family name. It cannot have a
// have 'initial' value and cannot 'inherit' from parent.
......
......@@ -54,7 +54,7 @@ void CSSProperty::wrapValueInCommaSeparatedList()
{
RefPtr<CSSValue> value = m_value.release();
m_value = CSSValueList::createCommaSeparated();
static_cast<CSSValueList*>(m_value.get())->append(value.release());
toCSSValueList(m_value.get())->append(value.release());
}
enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
......
......@@ -538,7 +538,7 @@ void CSSToStyleMap::mapNinePieceImage(CSSPropertyID property, CSSValue* value, N
return;
// Retrieve the border image value.
CSSValueList* borderImage = static_cast<CSSValueList*>(value);
CSSValueList* borderImage = toCSSValueList(value);
// Set the image (this kicks off the load).
CSSPropertyID imageProperty;
......@@ -561,7 +561,7 @@ void CSSToStyleMap::mapNinePieceImage(CSSPropertyID property, CSSValue* value, N
else if (current->isBorderImageSliceValue())
mapNinePieceImageSlice(current, image);
else if (current->isValueList()) {
CSSValueList* slashList = static_cast<CSSValueList*>(current);
CSSValueList* slashList = toCSSValueList(current);
// Map in the image slices.
if (slashList->item(0) && slashList->item(0)->isBorderImageSliceValue())
mapNinePieceImageSlice(slashList->item(0), image);
......@@ -600,7 +600,7 @@ void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& imag
return;
// Retrieve the border image value.
CSSBorderImageSliceValue* borderImageSlice = static_cast<CSSBorderImageSliceValue*>(value);
CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(value);
// Set up a length box to represent our image slices.
LengthBox box;
......
......@@ -383,10 +383,10 @@ void CSSValue::destroy()
switch (classType()) {
case AspectRatioClass:
delete static_cast<CSSAspectRatioValue*>(this);
delete toCSSAspectRatioValue(this);
return;
case BorderImageSliceClass:
delete static_cast<CSSBorderImageSliceValue*>(this);
delete toCSSBorderImageSliceValue(this);
return;
case CanvasClass:
delete toCSSCanvasValue(this);
......@@ -398,13 +398,13 @@ void CSSValue::destroy()
delete static_cast<FontValue*>(this);
return;
case FontFaceSrcClass:
delete static_cast<CSSFontFaceSrcValue*>(this);
delete toCSSFontFaceSrcValue(this);
return;
case FontFeatureClass:
delete static_cast<FontFeatureValue*>(this);
return;
case FunctionClass:
delete static_cast<CSSFunctionValue*>(this);
delete toCSSFunctionValue(this);
return;
case LinearGradientClass:
delete toCSSLinearGradientValue(this);
......@@ -419,7 +419,7 @@ void CSSValue::destroy()
delete toCSSImageValue(this);
return;
case InheritedClass:
delete static_cast<CSSInheritedValue*>(this);
delete toCSSInheritedValue(this);
return;
case InitialClass:
delete toCSSInitialValue(this);
......@@ -443,7 +443,7 @@ void CSSValue::destroy()
delete static_cast<CSSUnicodeRangeValue*>(this);
return;
case ValueListClass:
delete static_cast<CSSValueList*>(this);
delete toCSSValueList(this);
return;
case WebKitCSSTransformClass:
delete toWebKitCSSTransformValue(this);
......@@ -483,7 +483,7 @@ void CSSValue::destroy()
#endif
#if ENABLE(CSS_VARIABLES)
case VariableClass:
delete static_cast<CSSVariableValue*>(this);
delete toCSSVariableValue(this);
return;
#endif
#if ENABLE(SVG)
......
......@@ -74,7 +74,9 @@ public:
bool isCanvasValue() const { return m_classType == CanvasClass; }
bool isCrossfadeValue() const { return m_classType == CrossfadeClass; }
bool isCursorImageValue() const { return m_classType == CursorImageClass; }
bool isFunctionValue() const { return m_classType == FunctionClass; }
bool isFontFeatureValue() const { return m_classType == FontFeatureClass; }
bool isFontFaceSrcValue() const { return m_classType == FontFaceSrcClass; }
bool isFontValue() const { return m_classType == FontClass; }
bool isImageGeneratorValue() const { return m_classType >= CanvasClass && m_classType <= RadialGradientClass; }
bool isGradientValue() const { return m_classType >= LinearGradientClass && m_classType <= RadialGradientClass; }
......
......@@ -83,11 +83,13 @@ private:
Vector<RefPtr<CSSValue>, 4> m_values;
};
CSS_VALUE_TYPE_CASTS(ValueList)
// Objects of this class are intended to be stack-allocated and scoped to a single function.
// Please take care not to pass these around as they do hold onto a raw pointer.
class CSSValueListInspector {
public:
CSSValueListInspector(CSSValue* value) : m_list((value && value->isValueList()) ? static_cast<CSSValueList*>(value) : 0) { }
CSSValueListInspector(CSSValue* value) : m_list((value && value->isValueList()) ? toCSSValueList(value) : 0) { }
CSSValue* item(size_t index) const { ASSERT_WITH_SECURITY_IMPLICATION(index < length()); return m_list->itemWithoutBoundsCheck(index); }
CSSValue* first() const { return item(0); }
CSSValue* second() const { return item(1); }
......
......@@ -61,6 +61,8 @@ private:
const String m_value;
};
CSS_VALUE_TYPE_CASTS(VariableValue)
}
#endif /* ENABLE(CSS_VARIABLES) */
......
......@@ -557,7 +557,7 @@ public:
#endif
) {
/* Walk each value and put it into a layer, creating new layers as needed. */
CSSValueList* valueList = static_cast<CSSValueList*>(value);
CSSValueList* valueList = toCSSValueList(value);
for (unsigned int i = 0; i < valueList->length(); i++) {
if (!currChild) {
/* Need to make a new layer to hold this value */
......@@ -955,7 +955,7 @@ public:
FontDescription::LigaturesState historicalLigaturesState = FontDescription::NormalLigaturesState;
if (value->isValueList()) {
CSSValueList* valueList = static_cast<CSSValueList*>(value);
CSSValueList* valueList = toCSSValueList(value);
for (size_t i = 0; i < valueList->length(); ++i) {
CSSValue* item = valueList->itemWithoutBoundsCheck(i);
ASSERT(item->isPrimitiveValue());
......@@ -1155,7 +1155,7 @@ public:
if (setCounterIncrementToNone)
return;
CSSValueList* list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
int length = list ? list->length() : 0;
for (int i = 0; i < length; ++i) {
CSSValue* currValue = list->itemWithoutBoundsCheck(i);
......@@ -1198,7 +1198,7 @@ public:
{
styleResolver->style()->clearCursorList();
if (value->isValueList()) {
CSSValueList* list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
int len = list->length();
styleResolver->style()->setCursor(CURSOR_AUTO);
for (int i = 0; i < len; i++) {
......@@ -1650,7 +1650,7 @@ public:
static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value)
{
if (value->isValueList()) {
CSSValueList* list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
ASSERT(list->length() == 2);
if (list->length() != 2)
return;
......@@ -1869,7 +1869,7 @@ public:
styleResolver->style()->setHasAspectRatio(false);
return;
}
CSSAspectRatioValue* aspectRatioValue = static_cast<CSSAspectRatioValue*>(value);
CSSAspectRatioValue* aspectRatioValue = toCSSAspectRatioValue(value);
styleResolver->style()->setHasAspectRatio(true);
styleResolver->style()->setAspectRatioDenominator(aspectRatioValue->denominatorValue());
styleResolver->style()->setAspectRatioNumerator(aspectRatioValue->numeratorValue());
......@@ -2063,7 +2063,7 @@ public:
{
if (!value->isValueList())
return;
CSSValueList* valueList = static_cast<CSSValueList*>(value);
CSSValueList* valueList = toCSSValueList(value);
ImageResolutionSource source = RenderStyle::initialImageResolutionSource();
ImageResolutionSnap snap = RenderStyle::initialImageResolutionSnap();
double resolution = RenderStyle::initialImageResolution();
......@@ -2121,7 +2121,7 @@ public:
TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
#endif
CSSValueList* valueList = static_cast<CSSValueList*>(value);
CSSValueList* valueList = toCSSValueList(value);
for (size_t i = 0; i < valueList->length(); ++i) {
CSSValue* item = valueList->itemWithoutBoundsCheck(i);
if (!item->isPrimitiveValue())
......
......@@ -182,7 +182,7 @@ bool compareValue(T a, T b, MediaFeaturePrefix op)
static bool compareAspectRatioValue(CSSValue* value, int width, int height, MediaFeaturePrefix op)
{
if (value->isAspectRatioValue()) {
CSSAspectRatioValue* aspectRatio = static_cast<CSSAspectRatioValue*>(value);
CSSAspectRatioValue* aspectRatio = toCSSAspectRatioValue(value);
return compareValue(width * static_cast<int>(aspectRatio->denominatorValue()), height * static_cast<int>(aspectRatio->numeratorValue()), op);
}
......
......@@ -276,7 +276,7 @@ void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
break;
}
CSSValueList* dashes = static_cast<CSSValueList*>(value);
CSSValueList* dashes = toCSSValueList(value);
Vector<SVGLength> array;
size_t length = dashes->length();
......@@ -557,7 +557,7 @@ void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
if (!value->isValueList())
return;
CSSValueList *list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
if (!list->length())
return;
......
......@@ -366,10 +366,9 @@ String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand&
for (unsigned i = 0; i < size; ++i) {
values[i] = getPropertyCSSValue(shorthand.properties()[i]);
if (values[i]) {
if (values[i]->isBaseValueList()) {
CSSValueList* valueList = static_cast<CSSValueList*>(values[i].get());
numLayers = max(valueList->length(), numLayers);
} else
if (values[i]->isBaseValueList())
numLayers = max(toCSSValueList(values[i].get())->length(), numLayers);
else
numLayers = max<size_t>(1U, numLayers);
}
}
......@@ -389,7 +388,7 @@ String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand&
RefPtr<CSSValue> value;
if (values[j]) {
if (values[j]->isBaseValueList())
value = static_cast<CSSValueList*>(values[j].get())->item(i);
value = toCSSValueList(values[j].get())->item(i);
else {
value = values[j];
......@@ -414,7 +413,7 @@ String StylePropertySet::getLayeredShorthandValue(const StylePropertyShorthand&
RefPtr<CSSValue> yValue;
RefPtr<CSSValue> nextValue = values[j + 1];
if (nextValue->isValueList())
yValue = static_cast<CSSValueList*>(nextValue.get())->itemWithoutBoundsCheck(i);
yValue = toCSSValueList(nextValue.get())->itemWithoutBoundsCheck(i);
else
yValue = nextValue;
......
......@@ -1982,8 +1982,7 @@ static bool createGridPosition(CSSValue* value, GridPosition& position)
return true;
}
ASSERT_WITH_SECURITY_IMPLICATION(value->isValueList());
CSSValueList* values = static_cast<CSSValueList*>(value);
CSSValueList* values = toCSSValueList(value);
ASSERT(values->length());
bool isSpanPosition = false;
......@@ -2100,8 +2099,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
#if ENABLE(CSS_VARIABLES)
if (id == CSSPropertyVariable) {
ASSERT_WITH_SECURITY_IMPLICATION(value->isVariableValue());
CSSVariableValue* variable = static_cast<CSSVariableValue*>(value);
CSSVariableValue* variable = toCSSVariableValue(value);
ASSERT(!variable->name().isEmpty());
ASSERT(!variable->value().isEmpty());
state.style()->setVariable(variable->name(), variable->value());
......@@ -2232,7 +2230,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
return;
}
if (value->isValueList()) {
CSSValueList* list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
Vector<std::pair<String, String> > quotes;
for (size_t i = 0; i < list->length(); i += 2) {
CSSValue* first = list->itemWithoutBoundsCheck(i);
......@@ -2701,7 +2699,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
return;
FontDescription fontDescription = state.style()->fontDescription();
CSSValueList* list = static_cast<CSSValueList*>(value);
CSSValueList* list = toCSSValueList(value);
RefPtr<FontFeatureSettings> settings = FontFeatureSettings::create();
int len = list->length();
for (int i = 0; i < len; ++i) {
......@@ -3526,7 +3524,7 @@ PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterParameter(cons
if (!parameterValue->isValueList())
return 0;
CSSValueList* values = static_cast<CSSValueList*>(parameterValue);
CSSValueList* values = toCSSValueList(parameterValue);
if (!values->length())
return 0;
......@@ -3606,7 +3604,7 @@ PassRefPtr<CustomFilterOperation> StyleResolver::createCustomFilterOperationWith
{
CSSValue* shadersValue = filterValue->itemWithoutBoundsCheck(0);
ASSERT_WITH_SECURITY_IMPLICATION(shadersValue->isValueList());
CSSValueList* shadersList = static_cast<CSSValueList*>(shadersValue);
CSSValueList* shadersList = toCSSValueList(shadersValue);
unsigned shadersListLength = shadersList->length();
ASSERT(shadersListLength);
......
......@@ -238,7 +238,7 @@ bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, Style
RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect);
if (!styleValue)
styleValue = style->getPropertyCSSValue(CSSPropertyTextDecoration);
return matches(element) && styleValue && styleValue->isValueList() && static_cast<CSSValueList*>(styleValue.get())->hasValue(m_primitiveValue.get());
return matches(element) && styleValue && styleValue->isValueList() && toCSSValueList(styleValue.get())->hasValue(m_primitiveValue.get());
}
class HTMLAttributeEquivalent : public HTMLElementEquivalent {
......@@ -1092,7 +1092,7 @@ void EditingStyle::mergeStyle(const StylePropertySet* style, CSSPropertyOverride
// text decorations never override values
if ((property.id() == CSSPropertyTextDecoration || property.id() == CSSPropertyWebkitTextDecorationsInEffect) && property.value()->isValueList() && value) {
if (value->isValueList()) {
mergeTextDecorationValues(static_cast<CSSValueList*>(value.get()), static_cast<CSSValueList*>(property.value()));
mergeTextDecorationValues(toCSSValueList(value.get()), toCSSValueList(property.value()));
continue;
}
value = 0; // text-decoration: none is equivalent to not having the property
......@@ -1432,7 +1432,7 @@ void StyleChange::extractTextStyles(Document* document, MutableStylePropertySet*
RefPtr<CSSPrimitiveValue> underline = cssValuePool().createIdentifierValue(CSSValueUnderline);
RefPtr<CSSPrimitiveValue> lineThrough = cssValuePool().createIdentifierValue(CSSValueLineThrough);
RefPtr<CSSValueList> newTextDecoration = static_cast<CSSValueList*>(textDecoration.get())->copy();
RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.get())->copy();
if (newTextDecoration->removeAll(underline.get()))
m_applyUnderline = true;
if (newTextDecoration->removeAll(lineThrough.get()))
......@@ -1481,8 +1481,8 @@ static void diffTextDecorations(MutableStylePropertySet* style, CSSPropertyID pr
if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration || !refTextDecoration->isValueList())
return;
RefPtr<CSSValueList> newTextDecoration = static_cast<CSSValueList*>(textDecoration.get())->copy();
CSSValueList* valuesInRefTextDecoration = static_cast<CSSValueList*>(refTextDecoration);
RefPtr<CSSValueList> newTextDecoration = toCSSValueList(textDecoration.get())->copy();
CSSValueList* valuesInRefTextDecoration = toCSSValueList(refTextDecoration);
for (size_t i = 0; i < valuesInRefTextDecoration->length(); i++)
newTextDecoration->removeAll(valuesInRefTextDecoration->item(i));
......
......@@ -142,7 +142,7 @@ static bool executeToggleStyleInList(Frame& frame, EditorCommandSource source, E
RefPtr<CSSValue> selectedCSSValue = selectionStyle->style()->getPropertyCSSValue(propertyID);
String newStyle = ASCIILiteral("none");
if (selectedCSSValue->isValueList()) {
RefPtr<CSSValueList> selectedCSSValueList = static_cast<CSSValueList*>(selectedCSSValue.get());
RefPtr<CSSValueList> selectedCSSValueList = toCSSValueList(selectedCSSValue.get());
if (!selectedCSSValueList->removeAll(value))
selectedCSSValueList->append(value);
if (selectedCSSValueList->length())
......
......@@ -253,11 +253,11 @@ void SVGFontFaceElement::rebuildFontFace()
if (describesParentFont) {
// Traverse parsed CSS values and associate CSSFontFaceSrcValue elements with ourselves.
RefPtr<CSSValue> src = m_fontFaceRule->properties().getPropertyCSSValue(CSSPropertySrc);
CSSValueList* srcList = static_cast<CSSValueList*>(src.get());
CSSValueList* srcList = toCSSValueList(src.get());
unsigned srcLength = srcList ? srcList->length() : 0;
for (unsigned i = 0; i < srcLength; i++) {
if (CSSFontFaceSrcValue* item = static_cast<CSSFontFaceSrcValue*>(srcList->itemWithoutBoundsCheck(i)))
if (CSSFontFaceSrcValue* item = toCSSFontFaceSrcValue(srcList->itemWithoutBoundsCheck(i)))
item->setSVGFontFaceElement(this);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment