<https://webkit.org/b/125056>
Make the CSSFilterImageValue::create() helper take both the image and
filter CSSValues by PassRef since they should never be null.
Tweaked ComputedStyleExtractor::valueForFilter() to return a PassRef
for this to work.
Reviewed by Anders Carlsson.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160541
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-12-13 Andreas Kling <akling@apple.com>
+
+ CSSFilterImageValue constructor should require both image and filter.
+ <https://webkit.org/b/125056>
+
+ Make the CSSFilterImageValue::create() helper take both the image and
+ filter CSSValues by PassRef since they should never be null.
+
+ Tweaked ComputedStyleExtractor::valueForFilter() to return a PassRef
+ for this to work.
+
+ Reviewed by Anders Carlsson.
+
2013-12-12 Andreas Kling <akling@apple.com>
StyleResolver::adjustRenderStyle() should take RenderStyle references.
}
#if ENABLE(CSS_FILTERS)
-PassRefPtr<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* renderer, const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
+PassRef<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* renderer, const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
{
#if !ENABLE(CSS_SHADERS)
UNUSED_PARAM(renderer);
if (filterOperations.operations().isEmpty())
return cssValuePool().createIdentifierValue(CSSValueNone);
- RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+ auto list = CSSValueList::createSpaceSeparated();
RefPtr<WebKitCSSFilterValue> filterValue;
filterValue = WebKitCSSFilterValue::create(WebKitCSSFilterValue::UnknownFilterOperation);
break;
}
- list->append(filterValue.release());
+ list.get().append(filterValue.release());
}
- return list.release();
+ return std::move(list);
}
#endif
bool propertyMatches(CSSPropertyID, const CSSValue*) const;
#if ENABLE(CSS_FILTERS)
- static PassRefPtr<CSSValue> valueForFilter(const RenderObject*, const RenderStyle*, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
+ static PassRef<CSSValue> valueForFilter(const RenderObject*, const RenderStyle*, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
#endif
private:
class CSSFilterImageValue : public CSSImageGeneratorValue {
friend class FilterSubimageObserverProxy;
public:
- static PassRef<CSSFilterImageValue> create(PassRefPtr<CSSValue> imageValue, PassRefPtr<CSSValue> filterValue)
+ static PassRef<CSSFilterImageValue> create(PassRef<CSSValue> imageValue, PassRef<CSSValue> filterValue)
{
- return adoptRef(*new CSSFilterImageValue(imageValue, filterValue));
+ return adoptRef(*new CSSFilterImageValue(std::move(imageValue), std::move(filterValue)));
}
~CSSFilterImageValue();
return false;
value = args->next();
- result = CSSFilterImageValue::create(imageValue, filterValue);
+ result = CSSFilterImageValue::create(imageValue.releaseNonNull(), filterValue.releaseNonNull());
filter = result;
RefPtr<StyleCachedImage> styledImage = StyleCachedImage::create(image);
auto imageValue = CSSImageValue::create(image->url(), styledImage.get());
- RefPtr<CSSValue> filterValue = ComputedStyleExtractor::valueForFilter(anim->renderer(), &anim->renderer()->style(), filterResult, DoNotAdjustPixelValues);
- RefPtr<CSSFilterImageValue> result = CSSFilterImageValue::create(std::move(imageValue), filterValue);
- result->setFilterOperations(filterResult);
+ auto filterValue = ComputedStyleExtractor::valueForFilter(anim->renderer(), &anim->renderer()->style(), filterResult, DoNotAdjustPixelValues);
- return StyleGeneratedImage::create(*result);
+ auto result = CSSFilterImageValue::create(std::move(imageValue), std::move(filterValue));
+ result.get().setFilterOperations(filterResult);
+ return StyleGeneratedImage::create(std::move(result));
}
#endif // ENABLE(CSS_FILTERS)
auto fromImageValue = CSSImageValue::create(fromStyleImage->cachedImage()->url(), fromStyleImage);
auto toImageValue = CSSImageValue::create(toStyleImage->cachedImage()->url(), toStyleImage);
- RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(std::move(fromImageValue), std::move(toImageValue));
- crossfadeValue->setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
-
- return StyleGeneratedImage::create(*crossfadeValue);
+ auto crossfadeValue = CSSCrossfadeValue::create(std::move(fromImageValue), std::move(toImageValue));
+ crossfadeValue.get().setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
+ return StyleGeneratedImage::create(std::move(crossfadeValue));
}
static inline PassRefPtr<StyleImage> blendFunc(const AnimationBase* anim, StyleImage* from, StyleImage* to, double progress)