Diff
Modified: trunk/Source/WebCore/ChangeLog (175486 => 175487)
--- trunk/Source/WebCore/ChangeLog 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/ChangeLog 2014-11-03 20:48:23 UTC (rev 175487)
@@ -1,3 +1,17 @@
+2014-11-03 Chris Dumez <cdu...@apple.com>
+
+ Support modern range loops over CSSValueList
+ https://bugs.webkit.org/show_bug.cgi?id=138285
+
+ Reviewed by Andreas Kling.
+
+ Add support for modern range loops over CSSValueList objects.
+ Port the code base to using range loops for CSSValueList objects and
+ drop the CSSValueListInspector / CSSValueListIterator classes as they
+ are no longer needed.
+
+ No new tests, no behavior change.
+
2014-11-03 Andreas Kling <akl...@apple.com>
RenderCounter shouldn't need a pre-destructor hook.
Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (175486 => 175487)
--- trunk/Source/WebCore/css/CSSToStyleMap.cpp 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp 2014-11-03 20:48:23 UTC (rev 175487)
@@ -30,6 +30,9 @@
#include "Animation.h"
#include "CSSBorderImageSliceValue.h"
+#include "CSSImageGeneratorValue.h"
+#include "CSSImageSetValue.h"
+#include "CSSImageValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPrimitiveValueMappings.h"
#include "CSSTimingFunctionValue.h"
@@ -62,7 +65,7 @@
return m_resolver->useSVGZoomRules();
}
-PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue* value)
+PassRefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue& value)
{
return m_resolver->styleImage(propertyId, value);
}
@@ -156,7 +159,7 @@
return;
}
- layer->setImage(styleImage(property, value));
+ layer->setImage(styleImage(property, *value));
}
void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value)
@@ -322,32 +325,30 @@
layer->setMaskSourceType(type);
}
-void CSSToStyleMap::mapAnimationDelay(Animation* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationDelay(Animation* animation, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
animation->setDelay(Animation::initialAnimationDelay());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- animation->setDelay(primitiveValue.computeTime<double, CSSPrimitiveValue::Seconds>());
+ animation->setDelay(downcast<CSSPrimitiveValue>(value).computeTime<double, CSSPrimitiveValue::Seconds>());
}
-void CSSToStyleMap::mapAnimationDirection(Animation* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationDirection(Animation* layer, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
layer->setDirection(Animation::initialAnimationDirection());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- switch (primitiveValue.getValueID()) {
+ switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
case CSSValueNormal:
layer->setDirection(Animation::AnimationDirectionNormal);
break;
@@ -365,32 +366,30 @@
}
}
-void CSSToStyleMap::mapAnimationDuration(Animation* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationDuration(Animation* animation, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
animation->setDuration(Animation::initialAnimationDuration());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- animation->setDuration(primitiveValue.computeTime<double, CSSPrimitiveValue::Seconds>());
+ animation->setDuration(downcast<CSSPrimitiveValue>(value).computeTime<double, CSSPrimitiveValue::Seconds>());
}
-void CSSToStyleMap::mapAnimationFillMode(Animation* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationFillMode(Animation* layer, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
layer->setFillMode(Animation::initialAnimationFillMode());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- switch (primitiveValue.getValueID()) {
+ switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
case CSSValueNone:
layer->setFillMode(AnimationFillModeNone);
break;
@@ -408,67 +407,66 @@
}
}
-void CSSToStyleMap::mapAnimationIterationCount(Animation* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationIterationCount(Animation* animation, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
animation->setIterationCount(Animation::initialAnimationIterationCount());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
if (primitiveValue.getValueID() == CSSValueInfinite)
animation->setIterationCount(Animation::IterationCountInfinite);
else
animation->setIterationCount(primitiveValue.getFloatValue());
}
-void CSSToStyleMap::mapAnimationName(Animation* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationName(Animation* layer, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
layer->setName(Animation::initialAnimationName());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
if (primitiveValue.getValueID() == CSSValueNone)
layer->setIsNoneAnimation(true);
else
layer->setName(primitiveValue.getStringValue());
}
-void CSSToStyleMap::mapAnimationPlayState(Animation* layer, CSSValue* value)
+void CSSToStyleMap::mapAnimationPlayState(Animation* layer, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
layer->setPlayState(Animation::initialAnimationPlayState());
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- EAnimPlayState playState = (primitiveValue.getValueID() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying;
+ EAnimPlayState playState = (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValuePaused) ? AnimPlayStatePaused : AnimPlayStatePlaying;
layer->setPlayState(playState);
}
-void CSSToStyleMap::mapAnimationProperty(Animation* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationProperty(Animation* animation, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
animation->setAnimationMode(Animation::AnimateAll);
animation->setProperty(CSSPropertyInvalid);
return;
}
- if (!is<CSSPrimitiveValue>(*value))
+ if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
if (primitiveValue.getValueID() == CSSValueAll) {
animation->setAnimationMode(Animation::AnimateAll);
animation->setProperty(CSSPropertyInvalid);
@@ -481,16 +479,15 @@
}
}
-void CSSToStyleMap::mapAnimationTimingFunction(Animation* animation, CSSValue* value)
+void CSSToStyleMap::mapAnimationTimingFunction(Animation* animation, CSSValue& value)
{
- if (value->isInitialValue()) {
+ if (value.isInitialValue()) {
animation->setTimingFunction(Animation::initialAnimationTimingFunction());
return;
}
- if (is<CSSPrimitiveValue>(*value)) {
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- switch (primitiveValue.getValueID()) {
+ if (is<CSSPrimitiveValue>(value)) {
+ switch (downcast<CSSPrimitiveValue>(value).getValueID()) {
case CSSValueLinear:
animation->setTimingFunction(LinearTimingFunction::create());
break;
@@ -518,11 +515,11 @@
return;
}
- if (is<CSSCubicBezierTimingFunctionValue>(*value)) {
- CSSCubicBezierTimingFunctionValue& cubicTimingFunction = downcast<CSSCubicBezierTimingFunctionValue>(*value);
+ if (is<CSSCubicBezierTimingFunctionValue>(value)) {
+ auto& cubicTimingFunction = downcast<CSSCubicBezierTimingFunctionValue>(value);
animation->setTimingFunction(CubicBezierTimingFunction::create(cubicTimingFunction.x1(), cubicTimingFunction.y1(), cubicTimingFunction.x2(), cubicTimingFunction.y2()));
- } else if (is<CSSStepsTimingFunctionValue>(*value)) {
- CSSStepsTimingFunctionValue& stepsTimingFunction = downcast<CSSStepsTimingFunctionValue>(*value);
+ } else if (is<CSSStepsTimingFunctionValue>(value)) {
+ auto& stepsTimingFunction = downcast<CSSStepsTimingFunctionValue>(value);
animation->setTimingFunction(StepsTimingFunction::create(stepsTimingFunction.numberOfSteps(), stepsTimingFunction.stepAtStart()));
}
}
@@ -545,33 +542,31 @@
else
imageProperty = property;
- for (unsigned i = 0 ; i < borderImage.length(); ++i) {
- CSSValue* current = borderImage.item(i);
-
- if (current->isImageValue() || current->isImageGeneratorValue()
+ for (auto& current : borderImage) {
+ if (is<CSSImageValue>(current.get()) || is<CSSImageGeneratorValue>(current.get())
#if ENABLE(CSS_IMAGE_SET)
- || current->isImageSetValue()
+ || is<CSSImageSetValue>(current.get())
#endif
)
- image.setImage(styleImage(imageProperty, current));
- else if (current->isBorderImageSliceValue())
- mapNinePieceImageSlice(current, image);
- else if (is<CSSValueList>(*current)) {
- CSSValueList& slashList = downcast<CSSValueList>(*current);
+ image.setImage(styleImage(imageProperty, current.get()));
+ else if (is<CSSBorderImageSliceValue>(current.get()))
+ mapNinePieceImageSlice(current.get(), image);
+ else if (is<CSSValueList>(current.get())) {
+ CSSValueList& slashList = downcast<CSSValueList>(current.get());
// Map in the image slices.
- if (slashList.item(0) && slashList.item(0)->isBorderImageSliceValue())
- mapNinePieceImageSlice(slashList.item(0), image);
+ if (is<CSSBorderImageSliceValue>(slashList.item(0)))
+ mapNinePieceImageSlice(*slashList.item(0), image);
// Map in the border slices.
if (slashList.item(1))
- image.setBorderSlices(mapNinePieceImageQuad(slashList.item(1)));
+ image.setBorderSlices(mapNinePieceImageQuad(*slashList.item(1)));
// Map in the outset.
if (slashList.item(2))
- image.setOutset(mapNinePieceImageQuad(slashList.item(2)));
- } else if (current->isPrimitiveValue()) {
+ image.setOutset(mapNinePieceImageQuad(*slashList.item(2)));
+ } else if (is<CSSPrimitiveValue>(current.get())) {
// Set the appropriate rules for stretch/round/repeat of the slices.
- mapNinePieceImageRepeat(current, image);
+ mapNinePieceImageRepeat(current.get(), image);
}
}
@@ -590,13 +585,13 @@
}
}
-void CSSToStyleMap::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image)
+void CSSToStyleMap::mapNinePieceImageSlice(CSSValue& value, NinePieceImage& image)
{
if (!is<CSSBorderImageSliceValue>(value))
return;
// Retrieve the border image value.
- CSSBorderImageSliceValue& borderImageSlice = downcast<CSSBorderImageSliceValue>(*value);
+ auto& borderImageSlice = downcast<CSSBorderImageSliceValue>(value);
// Set up a length box to represent our image slices.
LengthBox box;
@@ -623,7 +618,7 @@
image.setFill(borderImageSlice.m_fill);
}
-LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value)
+LengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue& value)
{
if (!is<CSSPrimitiveValue>(value))
return LengthBox();
@@ -632,7 +627,7 @@
CSSToLengthConversionData conversionData = useSVGZoomRules() ? m_resolver->state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f) : m_resolver->state().cssToLengthConversionData();
// Retrieve the primitive value.
- CSSPrimitiveValue& borderWidths = downcast<CSSPrimitiveValue>(*value);
+ auto& borderWidths = downcast<CSSPrimitiveValue>(value);
// Set up a length box to represent our image slices.
LengthBox box; // Defaults to 'auto' so we don't have to handle that explicitly below.
@@ -668,12 +663,12 @@
return box;
}
-void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue* value, NinePieceImage& image)
+void CSSToStyleMap::mapNinePieceImageRepeat(CSSValue& value, NinePieceImage& image)
{
if (!is<CSSPrimitiveValue>(value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(value);
Pair* pair = primitiveValue.getPairValue();
if (!pair || !pair->first() || !pair->second())
return;
Modified: trunk/Source/WebCore/css/CSSToStyleMap.h (175486 => 175487)
--- trunk/Source/WebCore/css/CSSToStyleMap.h 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/CSSToStyleMap.h 2014-11-03 20:48:23 UTC (rev 175487)
@@ -58,20 +58,20 @@
void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*);
void mapFillMaskSourceType(CSSPropertyID, FillLayer*, CSSValue*);
- void mapAnimationDelay(Animation*, CSSValue*);
- void mapAnimationDirection(Animation*, CSSValue*);
- void mapAnimationDuration(Animation*, CSSValue*);
- void mapAnimationFillMode(Animation*, CSSValue*);
- void mapAnimationIterationCount(Animation*, CSSValue*);
- void mapAnimationName(Animation*, CSSValue*);
- void mapAnimationPlayState(Animation*, CSSValue*);
- void mapAnimationProperty(Animation*, CSSValue*);
- void mapAnimationTimingFunction(Animation*, CSSValue*);
+ void mapAnimationDelay(Animation*, CSSValue&);
+ void mapAnimationDirection(Animation*, CSSValue&);
+ void mapAnimationDuration(Animation*, CSSValue&);
+ void mapAnimationFillMode(Animation*, CSSValue&);
+ void mapAnimationIterationCount(Animation*, CSSValue&);
+ void mapAnimationName(Animation*, CSSValue&);
+ void mapAnimationPlayState(Animation*, CSSValue&);
+ void mapAnimationProperty(Animation*, CSSValue&);
+ void mapAnimationTimingFunction(Animation*, CSSValue&);
void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
- void mapNinePieceImageSlice(CSSValue*, NinePieceImage&);
- LengthBox mapNinePieceImageQuad(CSSValue*);
- void mapNinePieceImageRepeat(CSSValue*, NinePieceImage&);
+ void mapNinePieceImageSlice(CSSValue&, NinePieceImage&);
+ LengthBox mapNinePieceImageQuad(CSSValue&);
+ void mapNinePieceImageRepeat(CSSValue&, NinePieceImage&);
private:
// FIXME: These accessors should be replaced by a ResolveState object
@@ -84,7 +84,7 @@
// FIXME: This should be part of some sort of StyleImageCache object which
// is held by the StyleResolver, and likely provided to this object
// during the resolve.
- PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
+ PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
StyleResolver* m_resolver;
};
Modified: trunk/Source/WebCore/css/CSSValueList.h (175486 => 175487)
--- trunk/Source/WebCore/css/CSSValueList.h 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/CSSValueList.h 2014-11-03 20:48:23 UTC (rev 175487)
@@ -31,6 +31,9 @@
class CSSValueList : public CSSValue {
public:
+ typedef Vector<Ref<CSSValue>, 4>::iterator iterator;
+ typedef Vector<Ref<CSSValue>, 4>::const_iterator const_iterator;
+
static PassRef<CSSValueList> createCommaSeparated()
{
return adoptRef(*new CSSValueList(CommaSeparator));
@@ -54,6 +57,11 @@
CSSValue* itemWithoutBoundsCheck(size_t index) { return &m_values[index].get(); }
const CSSValue* itemWithoutBoundsCheck(size_t index) const { ASSERT(index < m_values.size()); return &m_values[index].get(); }
+ const_iterator begin() const { return m_values.begin(); }
+ const_iterator end() const { return m_values.end(); }
+ iterator begin() { return m_values.begin(); }
+ iterator end() { return m_values.end(); }
+
void append(PassRef<CSSValue>);
void prepend(PassRef<CSSValue>);
bool removeAll(CSSValue*);
@@ -91,38 +99,6 @@
m_values.insert(0, WTF::move(value));
}
-// 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(is<CSSValueList>(value) ? downcast<CSSValueList>(value) : nullptr)
- {
- }
-
- 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); }
- size_t length() const { return m_list ? m_list->length() : 0; }
-private:
- CSSValueList* m_list;
-};
-
-// Wrapper that can be used to iterate over any CSSValue. Non-list values and 0 behave as zero-length lists.
-// 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 CSSValueListIterator {
-public:
- CSSValueListIterator(CSSValue* value) : m_inspector(value), m_position(0) { }
- bool hasMore() const { return m_position < m_inspector.length(); }
- CSSValue* value() const { return m_inspector.item(m_position); }
- bool isPrimitiveValue() const { return value()->isPrimitiveValue(); }
- void advance() { m_position++; ASSERT(m_position <= m_inspector.length());}
- size_t index() const { return m_position; }
-private:
- CSSValueListInspector m_inspector;
- size_t m_position;
-};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSValueList, isValueList())
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (175486 => 175487)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2014-11-03 20:48:23 UTC (rev 175487)
@@ -32,6 +32,7 @@
#include "CSSAspectRatioValue.h"
#include "CSSCalculationValue.h"
#include "CSSCursorImageValue.h"
+#include "CSSImageGeneratorValue.h"
#include "CSSImageSetValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPrimitiveValueMappings.h"
@@ -163,7 +164,7 @@
template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle::*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSSPropertyID property>
class ApplyPropertyStyleImage {
public:
- static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, value)); }
+ static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(property, *value)); }
static PropertyHandler createHandler()
{
PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFunction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::createHandler();
@@ -850,16 +851,16 @@
NinePieceImage image(getValue(styleResolver->style()));
switch (modifier) {
case Outset:
- image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(value));
+ image.setOutset(styleResolver->styleMap()->mapNinePieceImageQuad(*value));
break;
case Repeat:
- styleResolver->styleMap()->mapNinePieceImageRepeat(value, image);
+ styleResolver->styleMap()->mapNinePieceImageRepeat(*value, image);
break;
case Slice:
- styleResolver->styleMap()->mapNinePieceImageSlice(value, image);
+ styleResolver->styleMap()->mapNinePieceImageSlice(*value, image);
break;
case Width:
- image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(value));
+ image.setBorderSlices(styleResolver->styleMap()->mapNinePieceImageQuad(*value));
break;
}
setValue(styleResolver->style(), image);
@@ -961,7 +962,7 @@
CSSCursorImageValue& image = downcast<CSSCursorImageValue>(*item);
if (image.updateIfSVGCursorIsUsed(styleResolver->element())) // Elements with SVG cursors are not allowed to share style.
styleResolver->style()->setUnique();
- styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, &image), image.hotSpot());
+ styleResolver->style()->addCursor(styleResolver->styleImage(CSSPropertyCursor, image), image.hotSpot());
} else if (is<CSSPrimitiveValue>(*item)) {
CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*item);
if (primitiveValue.isValueID())
@@ -1043,8 +1044,10 @@
}
TextDecorationSkip skip = RenderStyle::initialTextDecorationSkip();
- for (CSSValueListIterator i(value); i.hasMore(); i.advance())
- skip |= valueToDecorationSkip(downcast<CSSPrimitiveValue>(*i.value()));
+ if (is<CSSValueList>(*value)) {
+ for (auto& currentValue : downcast<CSSValueList>(*value))
+ skip |= valueToDecorationSkip(downcast<CSSPrimitiveValue>(currentValue.get()));
+ }
styleResolver->style()->setTextDecorationSkip(skip);
}
static PropertyHandler createHandler()
@@ -1120,10 +1123,11 @@
}
unsigned t = 0;
- for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
- CSSValue* item = i.value();
- TextUnderlinePosition t2 = downcast<CSSPrimitiveValue>(*item);
- t |= t2;
+ if (is<CSSValueList>(*value)) {
+ for (auto& currentValue : downcast<CSSValueList>(*value)) {
+ TextUnderlinePosition t2 = downcast<CSSPrimitiveValue>(currentValue.get());
+ t |= t2;
+ }
}
styleResolver->style()->setTextUnderlinePosition(static_cast<TextUnderlinePosition>(t));
}
@@ -1340,35 +1344,41 @@
Length width;
Length height;
PageSizeType pageSizeType = PAGE_SIZE_AUTO;
- CSSValueListInspector inspector(value);
- switch (inspector.length()) {
+ if (!is<CSSValueList>(value))
+ return;
+
+ auto& valueList = downcast<CSSValueList>(*value);
+ switch (valueList.length()) {
case 2: {
+ CSSValue* firstValue = valueList.itemWithoutBoundsCheck(0);
+ CSSValue* secondValue = valueList.itemWithoutBoundsCheck(1);
// <length>{2} | <page-size> <orientation>
- if (!is<CSSPrimitiveValue>(*inspector.first()) || !is<CSSPrimitiveValue>(*inspector.second()))
+ if (!is<CSSPrimitiveValue>(*firstValue) || !is<CSSPrimitiveValue>(*secondValue))
return;
- CSSPrimitiveValue& first = downcast<CSSPrimitiveValue>(*inspector.first());
- CSSPrimitiveValue& second = downcast<CSSPrimitiveValue>(*inspector.second());
- if (first.isLength()) {
+ auto& firstPrimitiveValue = downcast<CSSPrimitiveValue>(*firstValue);
+ auto& secondPrimitiveValue = downcast<CSSPrimitiveValue>(*secondValue);
+ if (firstPrimitiveValue.isLength()) {
// <length>{2}
- if (!second.isLength())
+ if (!secondPrimitiveValue.isLength())
return;
CSSToLengthConversionData conversionData = styleResolver->state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f);
- width = first.computeLength<Length>(conversionData);
- height = second.computeLength<Length>(conversionData);
+ width = firstPrimitiveValue.computeLength<Length>(conversionData);
+ height = secondPrimitiveValue.computeLength<Length>(conversionData);
} else {
// <page-size> <orientation>
// The value order is guaranteed. See CSSParser::parseSizeParameter.
- if (!getPageSizeFromName(&first, &second, width, height))
+ if (!getPageSizeFromName(&firstPrimitiveValue, &secondPrimitiveValue, width, height))
return;
}
pageSizeType = PAGE_SIZE_RESOLVED;
break;
}
case 1: {
+ CSSValue* value = valueList.itemWithoutBoundsCheck(0);
// <length> | auto | <page-size> | [ portrait | landscape]
- if (!is<CSSPrimitiveValue>(*inspector.first()))
+ if (!is<CSSPrimitiveValue>(*value))
return;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*inspector.first());
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(*value);
if (primitiveValue.isLength()) {
// <length>
pageSizeType = PAGE_SIZE_RESOLVED;
@@ -1498,8 +1508,10 @@
}
TextEmphasisPosition position = 0;
- for (CSSValueListIterator i(value); i.hasMore(); i.advance())
- position |= valueToEmphasisPosition(downcast<CSSPrimitiveValue>(*i.value()));
+ if (is<CSSValueList>(*value)) {
+ for (auto& currentValue : downcast<CSSValueList>(*value))
+ position |= valueToEmphasisPosition(downcast<CSSPrimitiveValue>(currentValue.get()));
+ }
styleResolver->style()->setTextEmphasisPosition(position);
}
static PropertyHandler createHandler()
@@ -1515,7 +1527,7 @@
bool (Animation::*testFunction)() const,
void (Animation::*clearFunction)(),
T (*initialFunction)(),
- void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue*),
+ void (CSSToStyleMap::*mapFunction)(Animation*, CSSValue&),
AnimationList* (RenderStyle::*animationGetterFunction)(),
const AnimationList* (RenderStyle::*immutableAnimationGetterFunction)() const>
class ApplyPropertyAnimation {
@@ -1525,7 +1537,7 @@
static bool test(const Animation& animation) { return (animation.*testFunction)(); }
static void clear(Animation& animation) { (animation.*clearFunction)(); }
static T initial() { return (*initialFunction)(); }
- static void map(StyleResolver* styleResolver, Animation& animation, CSSValue* value) { (styleResolver->styleMap()->*mapFunction)(&animation, value); }
+ static void map(StyleResolver* styleResolver, Animation& animation, CSSValue& value) { (styleResolver->styleMap()->*mapFunction)(&animation, value); }
static AnimationList* accessAnimations(RenderStyle* style) { return (style->*animationGetterFunction)(); }
static const AnimationList* animations(RenderStyle* style) { return (style->*immutableAnimationGetterFunction)(); }
@@ -1562,18 +1574,18 @@
{
AnimationList* list = accessAnimations(styleResolver->style());
size_t childIndex = 0;
- if (value->isValueList()) {
+ if (is<CSSValueList>(*value)) {
/* Walk each value and put it into an animation, creating new animations as needed. */
- for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
+ for (auto& currentValue : downcast<CSSValueList>(*value)) {
if (childIndex <= list->size())
list->append(Animation::create());
- map(styleResolver, list->animation(childIndex), i.value());
+ map(styleResolver, list->animation(childIndex), currentValue.get());
++childIndex;
}
} else {
if (list->isEmpty())
list->append(Animation::create());
- map(styleResolver, list->animation(childIndex), value);
+ map(styleResolver, list->animation(childIndex), *value);
childIndex = 1;
}
for ( ; childIndex < list->size(); ++childIndex) {
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (175486 => 175487)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2014-11-03 20:48:23 UTC (rev 175487)
@@ -201,8 +201,10 @@
inline TextDecoration StyleBuilderConverter::convertTextDecoration(StyleResolver&, CSSValue& value)
{
TextDecoration result = RenderStyle::initialTextDecoration();
- for (CSSValueListIterator it(&value); it.hasMore(); it.advance())
- result |= downcast<CSSPrimitiveValue>(*it.value());
+ if (is<CSSValueList>(value)) {
+ for (auto& currentValue : downcast<CSSValueList>(value))
+ result |= downcast<CSSPrimitiveValue>(currentValue.get());
+ }
return result;
}
@@ -242,7 +244,7 @@
template <CSSPropertyID property>
inline PassRefPtr<StyleImage> StyleBuilderConverter::convertBorderImageSource(StyleResolver& styleResolver, CSSValue& value)
{
- return styleResolver.styleImage(property, &value);
+ return styleResolver.styleImage(property, value);
}
inline TransformOperations StyleBuilderConverter::convertTransform(StyleResolver& styleResolver, CSSValue& value)
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (175486 => 175487)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-11-03 20:48:23 UTC (rev 175487)
@@ -122,14 +122,13 @@
if (downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueAuto)
styleResolver.style()->setShapeOutside(nullptr);
} if (is<CSSImageValue>(value) || is<CSSImageGeneratorValue>(value) || is<CSSImageSetValue>(value)) {
- RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, &value));
+ RefPtr<ShapeValue> shape = ShapeValue::createImageValue(styleResolver.styleImage(CSSPropertyWebkitShapeOutside, value));
styleResolver.style()->setShapeOutside(shape.release());
} else if (is<CSSValueList>(value)) {
RefPtr<BasicShape> shape;
CSSBoxType referenceBox = BoxMissing;
- auto& valueList = downcast<CSSValueList>(value);
- for (unsigned i = 0; i < valueList.length(); ++i) {
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*valueList.itemWithoutBoundsCheck(i));
+ for (auto& currentValue : downcast<CSSValueList>(value)) {
+ CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(currentValue.get());
if (primitiveValue.isShape())
shape = basicShapeForValue(styleResolver.state().cssToLengthConversionData(), primitiveValue.getShapeValue());
else if (primitiveValue.getValueID() == CSSValueContentBox
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (175486 => 175487)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2014-11-03 20:48:23 UTC (rev 175487)
@@ -1929,10 +1929,10 @@
return true;
}
-static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const StyleResolver::State& state)
+static bool createGridTrackSize(CSSValue& value, GridTrackSize& trackSize, const StyleResolver::State& state)
{
- if (is<CSSPrimitiveValue>(*value)) {
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
+ if (is<CSSPrimitiveValue>(value)) {
+ CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(value);
GridLength workingLength;
if (!createGridTrackBreadth(&primitiveValue, state, workingLength))
return false;
@@ -1941,7 +1941,7 @@
return true;
}
- CSSFunctionValue& minmaxFunction = downcast<CSSFunctionValue>(*value);
+ CSSFunctionValue& minmaxFunction = downcast<CSSFunctionValue>(value);
CSSValueList* arguments = minmaxFunction.arguments();
ASSERT_WITH_SECURITY_IMPLICATION(arguments->length() == 2);
GridLength minTrackBreadth;
@@ -1961,16 +1961,14 @@
return primitiveValue.getValueID() == CSSValueNone;
}
- if (!value->isValueList())
+ if (!is<CSSValueList>(*value))
return false;
size_t currentNamedGridLine = 0;
- for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
- CSSValue* currValue = i.value();
- if (is<CSSGridLineNamesValue>(*currValue)) {
- CSSGridLineNamesValue& lineNamesValue = downcast<CSSGridLineNamesValue>(*currValue);
- for (CSSValueListIterator j = &lineNamesValue; j.hasMore(); j.advance()) {
- String namedGridLine = downcast<CSSPrimitiveValue>(j.value())->getStringValue();
+ for (auto& currentValue : downcast<CSSValueList>(*value)) {
+ if (is<CSSGridLineNamesValue>(currentValue.get())) {
+ for (auto& currentGridLineName : downcast<CSSGridLineNamesValue>(currentValue.get())) {
+ String namedGridLine = downcast<CSSPrimitiveValue>(currentGridLineName.get()).getStringValue();
NamedGridLinesMap::AddResult result = namedGridLines.add(namedGridLine, Vector<size_t>());
result.iterator->value.append(currentNamedGridLine);
OrderedNamedGridLinesMap::AddResult orderedResult = orderedNamedGridLines.add(currentNamedGridLine, Vector<String>());
@@ -1981,7 +1979,7 @@
++currentNamedGridLine;
GridTrackSize trackSize;
- if (!createGridTrackSize(currValue, trackSize, state))
+ if (!createGridTrackSize(currentValue.get(), trackSize, state))
return false;
trackSizes.append(trackSize);
@@ -2010,33 +2008,33 @@
return true;
}
- CSSValueList& values = downcast<CSSValueList>(*value);
+ auto& values = downcast<CSSValueList>(*value);
ASSERT(values.length());
bool isSpanPosition = false;
int gridLineNumber = 0;
String gridLineName;
- CSSValueListIterator it = &values;
- CSSPrimitiveValue* currentValue = downcast<CSSPrimitiveValue>(it.value());
+ auto it = values.begin();
+ CSSPrimitiveValue* currentValue = &downcast<CSSPrimitiveValue>(it->get());
if (currentValue->getValueID() == CSSValueSpan) {
isSpanPosition = true;
- it.advance();
- currentValue = it.hasMore() ? downcast<CSSPrimitiveValue>(it.value()) : nullptr;
+ ++it;
+ currentValue = it != values.end() ? &downcast<CSSPrimitiveValue>(it->get()) : nullptr;
}
if (currentValue && currentValue->isNumber()) {
gridLineNumber = currentValue->getIntValue();
- it.advance();
- currentValue = it.hasMore() ? downcast<CSSPrimitiveValue>(it.value()) : nullptr;
+ ++it;
+ currentValue = it != values.end() ? &downcast<CSSPrimitiveValue>(it->get()) : nullptr;
}
if (currentValue && currentValue->isString()) {
gridLineName = currentValue->getStringValue();
- it.advance();
+ ++it;
}
- ASSERT(!it.hasMore());
+ ASSERT(it != values.end());
if (isSpanPosition)
position.setSpanPosition(gridLineNumber ? gridLineNumber : 1, gridLineName);
else
@@ -2073,16 +2071,18 @@
}
points.hasRepeat = false;
- for (CSSValueListIterator it(&value); it.hasMore(); it.advance()) {
- auto& itemValue = downcast<CSSPrimitiveValue>(*it.value());
- if (auto* lengthRepeat = itemValue.getLengthRepeatValue()) {
- if (auto* interval = lengthRepeat->interval()) {
- points.repeatOffset = parseSnapCoordinate(*interval);
- points.hasRepeat = true;
- break;
+ if (is<CSSValueList>(value)) {
+ for (auto& currentValue : downcast<CSSValueList>(value)) {
+ auto& itemValue = downcast<CSSPrimitiveValue>(currentValue.get());
+ if (auto* lengthRepeat = itemValue.getLengthRepeatValue()) {
+ if (auto* interval = lengthRepeat->interval()) {
+ points.repeatOffset = parseSnapCoordinate(*interval);
+ points.hasRepeat = true;
+ break;
+ }
}
+ points.offsets.append(parseSnapCoordinate(itemValue));
}
- points.offsets.append(parseSnapCoordinate(itemValue));
}
return points;
@@ -2148,35 +2148,34 @@
return;
}
- if (!value->isValueList())
+ if (!is<CSSValueList>(*value))
return;
bool didSet = false;
- for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
- CSSValue* item = i.value();
- if (is<CSSImageGeneratorValue>(*item)) {
- if (is<CSSGradientValue>(*item))
- state.style()->setContent(StyleGeneratedImage::create(*downcast<CSSGradientValue>(*item).gradientWithStylesResolved(this)), didSet);
+ for (auto& item : downcast<CSSValueList>(*value)) {
+ if (is<CSSImageGeneratorValue>(item.get())) {
+ if (is<CSSGradientValue>(item.get()))
+ state.style()->setContent(StyleGeneratedImage::create(*downcast<CSSGradientValue>(item.get()).gradientWithStylesResolved(this)), didSet);
else
- state.style()->setContent(StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(*item)), didSet);
+ state.style()->setContent(StyleGeneratedImage::create(downcast<CSSImageGeneratorValue>(item.get())), didSet);
didSet = true;
#if ENABLE(CSS_IMAGE_SET)
- } else if (is<CSSImageSetValue>(*item)) {
- state.style()->setContent(setOrPendingFromValue(CSSPropertyContent, downcast<CSSImageSetValue>(item)), didSet);
+ } else if (is<CSSImageSetValue>(item.get())) {
+ state.style()->setContent(setOrPendingFromValue(CSSPropertyContent, downcast<CSSImageSetValue>(item.get())), didSet);
didSet = true;
#endif
}
- if (is<CSSImageValue>(*item)) {
- state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, downcast<CSSImageValue>(item)), didSet);
+ if (is<CSSImageValue>(item.get())) {
+ state.style()->setContent(cachedOrPendingFromValue(CSSPropertyContent, downcast<CSSImageValue>(item.get())), didSet);
didSet = true;
continue;
}
- if (!is<CSSPrimitiveValue>(*item))
+ if (!is<CSSPrimitiveValue>(item.get()))
continue;
- CSSPrimitiveValue& contentValue = downcast<CSSPrimitiveValue>(*item);
+ auto& contentValue = downcast<CSSPrimitiveValue>(item.get());
if (contentValue.isString()) {
state.style()->setContent(contentValue.getStringValue().impl(), didSet);
@@ -2402,14 +2401,14 @@
if (isInitial || primitiveValue) // initial | none
return id == CSSPropertyTextShadow ? state.style()->setTextShadow(nullptr) : state.style()->setBoxShadow(nullptr);
- if (!value->isValueList())
+ if (!is<CSSValueList>(*value))
return;
- for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
- CSSValue* currValue = i.value();
- if (!is<CSSShadowValue>(*currValue))
+ bool isFirstEntry = true;
+ for (auto& currentValue : downcast<CSSValueList>(*value)) {
+ if (!is<CSSShadowValue>(currentValue.get()))
continue;
- CSSShadowValue& item = downcast<CSSShadowValue>(*currValue);
+ auto& item = downcast<CSSShadowValue>(currentValue.get());
int x = item.x->computeLength<int>(state.cssToLengthConversionData());
int y = item.y->computeLength<int>(state.cssToLengthConversionData());
int blur = item.blur ? item.blur->computeLength<int>(state.cssToLengthConversionData()) : 0;
@@ -2423,9 +2422,11 @@
auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
if (id == CSSPropertyTextShadow)
- state.style()->setTextShadow(WTF::move(shadowData), i.index()); // add to the list if this is not the first entry
+ state.style()->setTextShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
else
- state.style()->setBoxShadow(WTF::move(shadowData), i.index()); // add to the list if this is not the first entry
+ state.style()->setBoxShadow(WTF::move(shadowData), !isFirstEntry); // add to the list if this is not the first entry
+
+ isFirstEntry = false;
}
return;
}
@@ -2705,7 +2706,7 @@
case CSSPropertyWebkitGridAutoColumns: {
HANDLE_INHERIT_AND_INITIAL(gridAutoColumns, GridAutoColumns);
GridTrackSize trackSize;
- if (!createGridTrackSize(value, trackSize, state))
+ if (!createGridTrackSize(*value, trackSize, state))
return;
state.style()->setGridAutoColumns(trackSize);
return;
@@ -2713,7 +2714,7 @@
case CSSPropertyWebkitGridAutoRows: {
HANDLE_INHERIT_AND_INITIAL(gridAutoRows, GridAutoRows);
GridTrackSize trackSize;
- if (!createGridTrackSize(value, trackSize, state))
+ if (!createGridTrackSize(*value, trackSize, state))
return;
state.style()->setGridAutoRows(trackSize);
return;
@@ -3213,33 +3214,33 @@
}
}
-PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue* value)
+PassRefPtr<StyleImage> StyleResolver::styleImage(CSSPropertyID property, CSSValue& value)
{
- if (is<CSSImageValue>(*value))
+ if (is<CSSImageValue>(value))
return cachedOrPendingFromValue(property, downcast<CSSImageValue>(value));
- if (is<CSSImageGeneratorValue>(*value)) {
- if (is<CSSGradientValue>(*value))
- return generatedOrPendingFromValue(property, *downcast<CSSGradientValue>(*value).gradientWithStylesResolved(this));
- return generatedOrPendingFromValue(property, downcast<CSSImageGeneratorValue>(*value));
+ if (is<CSSImageGeneratorValue>(value)) {
+ if (is<CSSGradientValue>(value))
+ return generatedOrPendingFromValue(property, *downcast<CSSGradientValue>(value).gradientWithStylesResolved(this));
+ return generatedOrPendingFromValue(property, downcast<CSSImageGeneratorValue>(value));
}
#if ENABLE(CSS_IMAGE_SET)
- if (is<CSSImageSetValue>(*value))
+ if (is<CSSImageSetValue>(value))
return setOrPendingFromValue(property, downcast<CSSImageSetValue>(value));
#endif
- if (is<CSSCursorImageValue>(*value))
+ if (is<CSSCursorImageValue>(value))
return cursorOrPendingFromValue(property, downcast<CSSCursorImageValue>(value));
return nullptr;
}
-PassRefPtr<StyleImage> StyleResolver::cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value)
+PassRefPtr<StyleImage> StyleResolver::cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue& value)
{
- RefPtr<StyleImage> image = value->cachedOrPendingImage();
+ RefPtr<StyleImage> image = value.cachedOrPendingImage();
if (image && image->isPendingImage())
- m_state.pendingImageProperties().set(property, value);
+ m_state.pendingImageProperties().set(property, &value);
return image.release();
}
@@ -3258,20 +3259,20 @@
}
#if ENABLE(CSS_IMAGE_SET)
-PassRefPtr<StyleImage> StyleResolver::setOrPendingFromValue(CSSPropertyID property, CSSImageSetValue* value)
+PassRefPtr<StyleImage> StyleResolver::setOrPendingFromValue(CSSPropertyID property, CSSImageSetValue& value)
{
- RefPtr<StyleImage> image = value->cachedOrPendingImageSet(document());
+ RefPtr<StyleImage> image = value.cachedOrPendingImageSet(document());
if (image && image->isPendingImage())
- m_state.pendingImageProperties().set(property, value);
+ m_state.pendingImageProperties().set(property, &value);
return image.release();
}
#endif
-PassRefPtr<StyleImage> StyleResolver::cursorOrPendingFromValue(CSSPropertyID property, CSSCursorImageValue* value)
+PassRefPtr<StyleImage> StyleResolver::cursorOrPendingFromValue(CSSPropertyID property, CSSCursorImageValue& value)
{
- RefPtr<StyleImage> image = value->cachedOrPendingImage(document());
+ RefPtr<StyleImage> image = value.cachedOrPendingImage(document());
if (image && image->isPendingImage())
- m_state.pendingImageProperties().set(property, value);
+ m_state.pendingImageProperties().set(property, &value);
return image.release();
}
@@ -3518,16 +3519,15 @@
return true;
}
- if (!inValue->isValueList())
+ if (!is<CSSValueList>(*inValue))
return false;
FilterOperations operations;
- for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
- CSSValue* currValue = i.value();
- if (!is<WebKitCSSFilterValue>(*currValue))
+ for (auto& currentValue : downcast<CSSValueList>(*inValue)) {
+ if (!is<WebKitCSSFilterValue>(currentValue.get()))
continue;
- WebKitCSSFilterValue& filterValue = downcast<WebKitCSSFilterValue>(*i.value());
+ auto& filterValue = downcast<WebKitCSSFilterValue>(currentValue.get());
FilterOperation::OperationType operationType = filterOperationForType(filterValue.operationType());
if (operationType == FilterOperation::REFERENCE) {
Modified: trunk/Source/WebCore/css/StyleResolver.h (175486 => 175487)
--- trunk/Source/WebCore/css/StyleResolver.h 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/StyleResolver.h 2014-11-03 20:48:23 UTC (rev 175487)
@@ -447,13 +447,13 @@
static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; }
- PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue*);
- PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
+ PassRefPtr<StyleImage> styleImage(CSSPropertyID, CSSValue&);
+ PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue&);
PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue&);
#if ENABLE(CSS_IMAGE_SET)
- PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*);
+ PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue&);
#endif
- PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*);
+ PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue&);
bool applyPropertyToRegularStyle() const { return m_state.applyPropertyToRegularStyle(); }
bool applyPropertyToVisitedLinkStyle() const { return m_state.applyPropertyToVisitedLinkStyle(); }
Modified: trunk/Source/WebCore/css/TransformFunctions.cpp (175486 => 175487)
--- trunk/Source/WebCore/css/TransformFunctions.cpp 2014-11-03 20:41:08 UTC (rev 175486)
+++ trunk/Source/WebCore/css/TransformFunctions.cpp 2014-11-03 20:48:23 UTC (rev 175487)
@@ -83,19 +83,17 @@
bool transformsForValue(CSSValue& value, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
{
- if (!value.isValueList()) {
+ if (!is<CSSValueList>(value)) {
outOperations.clear();
return false;
}
TransformOperations operations;
- for (CSSValueListIterator i = &value; i.hasMore(); i.advance()) {
- CSSValue& currValue = *i.value();
-
- if (!is<WebKitCSSTransformValue>(currValue))
+ for (auto& currentValue : downcast<CSSValueList>(value)) {
+ if (!is<WebKitCSSTransformValue>(currentValue.get()))
continue;
- WebKitCSSTransformValue& transformValue = downcast<WebKitCSSTransformValue>(currValue);
+ auto& transformValue = downcast<WebKitCSSTransformValue>(currentValue.get());
if (!transformValue.length())
continue;