Changeset 160541 in webkit


Ignore:
Timestamp:
Dec 13, 2013 2:32:05 AM (10 years ago)
Author:
akling@apple.com
Message:

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.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r160539 r160541  
     12013-12-13  Andreas Kling  <akling@apple.com>
     2
     3        CSSFilterImageValue constructor should require both image and filter.
     4        <https://webkit.org/b/125056>
     5
     6        Make the CSSFilterImageValue::create() helper take both the image and
     7        filter CSSValues by PassRef since they should never be null.
     8
     9        Tweaked ComputedStyleExtractor::valueForFilter() to return a PassRef
     10        for this to work.
     11
     12        Reviewed by Anders Carlsson.
     13
    1142013-12-12  Andreas Kling  <akling@apple.com>
    215
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r160299 r160541  
    941941
    942942#if ENABLE(CSS_FILTERS)
    943 PassRefPtr<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* renderer, const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
     943PassRef<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderObject* renderer, const RenderStyle* style, const FilterOperations& filterOperations, AdjustPixelValuesForComputedStyle adjust)
    944944{
    945945#if !ENABLE(CSS_SHADERS)
     
    949949        return cssValuePool().createIdentifierValue(CSSValueNone);
    950950
    951     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     951    auto list = CSSValueList::createSpaceSeparated();
    952952
    953953    RefPtr<WebKitCSSFilterValue> filterValue;
     
    10931093            break;
    10941094        }
    1095         list->append(filterValue.release());
    1096     }
    1097 
    1098     return list.release();
     1095        list.get().append(filterValue.release());
     1096    }
     1097
     1098    return std::move(list);
    10991099}
    11001100#endif
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h

    r159856 r160541  
    6565
    6666#if ENABLE(CSS_FILTERS)
    67     static PassRefPtr<CSSValue> valueForFilter(const RenderObject*, const RenderStyle*, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
     67    static PassRef<CSSValue> valueForFilter(const RenderObject*, const RenderStyle*, const FilterOperations&, AdjustPixelValuesForComputedStyle = AdjustPixelValues);
    6868#endif
    6969
  • trunk/Source/WebCore/css/CSSFilterImageValue.h

    r160224 r160541  
    4949    friend class FilterSubimageObserverProxy;
    5050public:
    51     static PassRef<CSSFilterImageValue> create(PassRefPtr<CSSValue> imageValue, PassRefPtr<CSSValue> filterValue)
     51    static PassRef<CSSFilterImageValue> create(PassRef<CSSValue> imageValue, PassRef<CSSValue> filterValue)
    5252    {
    53         return adoptRef(*new CSSFilterImageValue(imageValue, filterValue));
     53        return adoptRef(*new CSSFilterImageValue(std::move(imageValue), std::move(filterValue)));
    5454    }
    5555
  • trunk/Source/WebCore/css/CSSParser.cpp

    r160535 r160541  
    85308530    value = args->next();
    85318531
    8532     result = CSSFilterImageValue::create(imageValue, filterValue);
     8532    result = CSSFilterImageValue::create(imageValue.releaseNonNull(), filterValue.releaseNonNull());
    85338533
    85348534    filter = result;
  • trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp

    r160528 r160541  
    218218    RefPtr<StyleCachedImage> styledImage = StyleCachedImage::create(image);
    219219    auto imageValue = CSSImageValue::create(image->url(), styledImage.get());
    220     RefPtr<CSSValue> filterValue = ComputedStyleExtractor::valueForFilter(anim->renderer(), &anim->renderer()->style(), filterResult, DoNotAdjustPixelValues);
    221     RefPtr<CSSFilterImageValue> result = CSSFilterImageValue::create(std::move(imageValue), filterValue);
    222     result->setFilterOperations(filterResult);
    223 
    224     return StyleGeneratedImage::create(*result);
     220    auto filterValue = ComputedStyleExtractor::valueForFilter(anim->renderer(), &anim->renderer()->style(), filterResult, DoNotAdjustPixelValues);
     221
     222    auto result = CSSFilterImageValue::create(std::move(imageValue), std::move(filterValue));
     223    result.get().setFilterOperations(filterResult);
     224    return StyleGeneratedImage::create(std::move(result));
    225225}
    226226#endif // ENABLE(CSS_FILTERS)
     
    285285    auto fromImageValue = CSSImageValue::create(fromStyleImage->cachedImage()->url(), fromStyleImage);
    286286    auto toImageValue = CSSImageValue::create(toStyleImage->cachedImage()->url(), toStyleImage);
    287     RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(std::move(fromImageValue), std::move(toImageValue));
    288 
    289     crossfadeValue->setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
    290 
    291     return StyleGeneratedImage::create(*crossfadeValue);
     287
     288    auto crossfadeValue = CSSCrossfadeValue::create(std::move(fromImageValue), std::move(toImageValue));
     289    crossfadeValue.get().setPercentage(CSSPrimitiveValue::create(progress, CSSPrimitiveValue::CSS_NUMBER));
     290    return StyleGeneratedImage::create(std::move(crossfadeValue));
    292291}
    293292
Note: See TracChangeset for help on using the changeset viewer.