CachedImage* CSSImageGeneratorValue::cachedImageForCSSValue(CSSValue* value, CachedResourceLoader& cachedResourceLoader, const ResourceLoaderOptions& options)
{
    if (!value)
        return nullptr;

    if (is<CSSImageValue>(*value)) {
        StyleCachedImage* styleCachedImage = downcast<CSSImageValue>(*value).cachedImage(cachedResourceLoader, options);
        if (!styleCachedImage)
            return nullptr;

        return styleCachedImage->cachedImage();
    }
    
    if (is<CSSImageGeneratorValue>(*value)) {
        downcast<CSSImageGeneratorValue>(*value).loadSubimages(cachedResourceLoader, options);
        // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients and canvas).
        return nullptr;
    }

    if (is<CSSPrimitiveValue>(*value) && downcast<CSSPrimitiveValue>(*value).getValueID() == CSSValueNone)
        return nullptr;

    ASSERT_NOT_REACHED();
    
    return nullptr;
}
CachedImage* CSSImageGeneratorValue::cachedImageForCSSValue(CSSValue* value, CachedResourceLoader* cachedResourceLoader)
{
    if (!value)
        return nullptr;

    if (value->isImageValue()) {
        StyleCachedImage* styleCachedImage = toCSSImageValue(value)->cachedImage(cachedResourceLoader);
        if (!styleCachedImage)
            return nullptr;

        return styleCachedImage->cachedImage();
    }
    
    if (value->isImageGeneratorValue()) {
        toCSSImageGeneratorValue(value)->loadSubimages(cachedResourceLoader);
        // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients and canvas).
        return nullptr;
    }

    if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone)
        return nullptr;

    ASSERT_NOT_REACHED();
    
    return nullptr;
}
示例#3
0
static CachedImage* cachedImageForCSSValue(CSSValue* value, CachedResourceLoader* cachedResourceLoader)
{
    if (!value)
        return 0;

    if (value->isImageValue()) {
        StyleCachedImage* styleCachedImage = toCSSImageValue(value)->cachedImage(cachedResourceLoader);
        if (!styleCachedImage)
            return 0;

        return styleCachedImage->cachedImage();
    }
    
    if (value->isImageGeneratorValue()) {
        static_cast<CSSImageGeneratorValue*>(value)->loadSubimages(cachedResourceLoader);
        // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients and canvas).
        return 0;
    }
    
    ASSERT_NOT_REACHED();
    
    return 0;
}