From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/css/CSSImageSetValue.h | 45 +++++++++++------------------------ 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'Source/WebCore/css/CSSImageSetValue.h') 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 create() + static Ref 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 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& handler) const; - PassRefPtr 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 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 m_cachedImage; + bool m_accessedBestFitImage { false }; + float m_bestFitImageScaleFactor { 1 }; + float m_deviceScaleFactor { 1 }; Vector 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()) -- cgit v1.2.1