summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSImageSetValue.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/CSSImageSetValue.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/css/CSSImageSetValue.h')
-rw-r--r--Source/WebCore/css/CSSImageSetValue.h45
1 files changed, 14 insertions, 31 deletions
diff --git a/Source/WebCore/css/CSSImageSetValue.h b/Source/WebCore/css/CSSImageSetValue.h
index c1899f3ab..d6f09b171 100644
--- a/Source/WebCore/css/CSSImageSetValue.h
+++ b/Source/WebCore/css/CSSImageSetValue.h
@@ -23,74 +23,57 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CSSImageSetValue_h
-#define CSSImageSetValue_h
-
-#if ENABLE(CSS_IMAGE_SET)
+#pragma once
#include "CSSValueList.h"
+#include "CachedImageClient.h"
+#include "CachedResourceHandle.h"
namespace WebCore {
class CachedResourceLoader;
class Document;
-class StyleCachedImageSet;
-class StyleImage;
struct ResourceLoaderOptions;
-class CSSImageSetValue : public CSSValueList {
+class CSSImageSetValue final : public CSSValueList {
public:
-
- static PassRef<CSSImageSetValue> create()
+ static Ref<CSSImageSetValue> create()
{
return adoptRef(*new CSSImageSetValue());
}
~CSSImageSetValue();
- StyleCachedImageSet* cachedImageSet(CachedResourceLoader*, const ResourceLoaderOptions&);
- StyleCachedImageSet* cachedImageSet(CachedResourceLoader*);
-
- // Returns a StyleCachedImageSet if the best fit image has been cached already, otherwise a StylePendingImage.
- StyleImage* cachedOrPendingImageSet(Document&);
+ std::pair<CachedImage*, float> loadBestFitImage(CachedResourceLoader&, const ResourceLoaderOptions&);
+ CachedImage* cachedImage() const { return m_cachedImage.get(); }
String customCSSText() const;
- bool isPending() const { return !m_accessedBestFitImage; }
-
struct ImageWithScale {
String imageURL;
float scaleFactor;
};
- bool hasFailedOrCanceledSubresources() const;
+ bool traverseSubresources(const std::function<bool (const CachedResource&)>& handler) const;
- PassRefPtr<CSSImageSetValue> cloneForCSSOM() const;
+ void updateDeviceScaleFactor(const Document&);
protected:
ImageWithScale bestImageForScaleFactor();
private:
CSSImageSetValue();
- CSSImageSetValue(const CSSImageSetValue& cloneFrom);
- void detachPendingImage();
void fillImageSet();
static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale second) { return first.scaleFactor < second.scaleFactor; }
- RefPtr<StyleImage> m_imageSet;
- bool m_accessedBestFitImage;
-
- // This represents the scale factor that we used to find the best fit image. It does not necessarily
- // correspond to the scale factor of the best fit image.
- float m_scaleFactor;
+ CachedResourceHandle<CachedImage> m_cachedImage;
+ bool m_accessedBestFitImage { false };
+ float m_bestFitImageScaleFactor { 1 };
+ float m_deviceScaleFactor { 1 };
Vector<ImageWithScale> m_imagesInSet;
};
-CSS_VALUE_TYPE_CASTS(CSSImageSetValue, isImageSetValue())
-
} // namespace WebCore
-#endif // ENABLE(CSS_IMAGE_SET)
-
-#endif // CSSImageSetValue_h
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSImageSetValue, isImageSetValue())