summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSImageGeneratorValue.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/css/CSSImageGeneratorValue.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/css/CSSImageGeneratorValue.h')
-rw-r--r--Source/WebCore/css/CSSImageGeneratorValue.h56
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())