diff options
Diffstat (limited to 'Source/WebCore/css/CSSImageGeneratorValue.h')
-rw-r--r-- | Source/WebCore/css/CSSImageGeneratorValue.h | 56 |
1 files changed, 20 insertions, 36 deletions
diff --git a/Source/WebCore/css/CSSImageGeneratorValue.h b/Source/WebCore/css/CSSImageGeneratorValue.h index 0a6a1b6fd..dc57ea453 100644 --- a/Source/WebCore/css/CSSImageGeneratorValue.h +++ b/Source/WebCore/css/CSSImageGeneratorValue.h @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,11 +23,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CSSImageGeneratorValue_h -#define CSSImageGeneratorValue_h +#pragma once #include "CSSValue.h" -#include "IntSizeHash.h" +#include "FloatSizeHash.h" #include "Timer.h" #include <wtf/HashCountedSet.h> @@ -38,61 +37,46 @@ class CachedResourceLoader; class GeneratedImage; class Image; class RenderElement; -class StyleResolver; + +struct ResourceLoaderOptions; class CSSImageGeneratorValue : public CSSValue { public: ~CSSImageGeneratorValue(); - void addClient(RenderElement*); - void removeClient(RenderElement*); + void addClient(RenderElement&); + void removeClient(RenderElement&); - PassRefPtr<Image> image(RenderElement*, const IntSize&); + RefPtr<Image> image(RenderElement&, const FloatSize&); bool isFixedSize() const; - IntSize fixedSize(const RenderElement*); + FloatSize fixedSize(const RenderElement&); bool isPending() const; - bool knownToBeOpaque(const RenderElement*) const; + bool knownToBeOpaque(const RenderElement&) const; - void loadSubimages(CachedResourceLoader*); + void loadSubimages(CachedResourceLoader&, const ResourceLoaderOptions&); protected: CSSImageGeneratorValue(ClassType); - GeneratedImage* cachedImageForSize(IntSize); - void saveCachedImageForSize(IntSize, PassRefPtr<GeneratedImage>); + GeneratedImage* cachedImageForSize(FloatSize); + void saveCachedImageForSize(FloatSize, GeneratedImage&); const HashCountedSet<RenderElement*>& clients() const { return m_clients; } // Helper functions for Crossfade and Filter. - static CachedImage* cachedImageForCSSValue(CSSValue*, CachedResourceLoader*); - static bool subimageIsPending(CSSValue*); + static CachedImage* cachedImageForCSSValue(CSSValue&, CachedResourceLoader&, const ResourceLoaderOptions&); + static bool subimageIsPending(const CSSValue&); private: - class CachedGeneratedImage { - public: - CachedGeneratedImage(CSSImageGeneratorValue&, IntSize, PassRefPtr<GeneratedImage>); - GeneratedImage* image() { return m_image.get(); } - void puntEvictionTimer() { m_evictionTimer.restart(); } - - private: - void evictionTimerFired(DeferrableOneShotTimer<CachedGeneratedImage>&); + class CachedGeneratedImage; - CSSImageGeneratorValue& m_owner; - IntSize m_size; - RefPtr<GeneratedImage> m_image; - DeferrableOneShotTimer<CachedGeneratedImage> m_evictionTimer; - }; - - friend class CachedGeneratedImage; - void evictCachedGeneratedImage(IntSize); + void evictCachedGeneratedImage(FloatSize); HashCountedSet<RenderElement*> m_clients; - HashMap<IntSize, std::unique_ptr<CachedGeneratedImage>> m_images; + HashMap<FloatSize, std::unique_ptr<CachedGeneratedImage>> m_images; }; -CSS_VALUE_TYPE_CASTS(CSSImageGeneratorValue, isImageGeneratorValue()) - } // namespace WebCore -#endif // CSSImageGeneratorValue_h +SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSImageGeneratorValue, isImageGeneratorValue()) |