diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/css/CSSCrossfadeValue.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/css/CSSCrossfadeValue.h')
-rw-r--r-- | Source/WebCore/css/CSSCrossfadeValue.h | 81 |
1 files changed, 27 insertions, 54 deletions
diff --git a/Source/WebCore/css/CSSCrossfadeValue.h b/Source/WebCore/css/CSSCrossfadeValue.h index 53bd05983..a3500b44e 100644 --- a/Source/WebCore/css/CSSCrossfadeValue.h +++ b/Source/WebCore/css/CSSCrossfadeValue.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,95 +23,68 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CSSCrossfadeValue_h -#define CSSCrossfadeValue_h +#pragma once #include "CachedImageClient.h" #include "CachedResourceHandle.h" #include "CSSImageGeneratorValue.h" -#include "CSSPrimitiveValue.h" -#include "Image.h" -#include "ImageObserver.h" namespace WebCore { -class CachedImage; -class CrossfadeSubimageObserverProxy; -class RenderElement; -class Document; +class CSSPrimitiveValue; -class CSSCrossfadeValue : public CSSImageGeneratorValue { - friend class CrossfadeSubimageObserverProxy; +class CSSCrossfadeValue final : public CSSImageGeneratorValue { public: - static PassRef<CSSCrossfadeValue> create(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue) - { - return adoptRef(*new CSSCrossfadeValue(fromValue, toValue)); - } + static Ref<CSSCrossfadeValue> create(Ref<CSSValue>&& fromValue, Ref<CSSValue>&& toValue, Ref<CSSPrimitiveValue>&& percentageValue, bool prefixed = false); ~CSSCrossfadeValue(); String customCSSText() const; - PassRefPtr<Image> image(RenderElement*, const IntSize&); + Image* image(RenderElement&, const FloatSize&); bool isFixedSize() const { return true; } - IntSize fixedSize(const RenderElement*); + FloatSize fixedSize(const RenderElement&); + bool isPrefixed() const { return m_isPrefixed; } bool isPending() const; - bool knownToBeOpaque(const RenderElement*) const; + bool knownToBeOpaque(const RenderElement&) const; - void loadSubimages(CachedResourceLoader*); + void loadSubimages(CachedResourceLoader&, const ResourceLoaderOptions&); - void setPercentage(PassRefPtr<CSSPrimitiveValue> percentageValue) { m_percentageValue = percentageValue; } + bool traverseSubresources(const std::function<bool (const CachedResource&)>& handler) const; - bool hasFailedOrCanceledSubresources() const; - - PassRefPtr<CSSCrossfadeValue> blend(const CSSCrossfadeValue&, double) const; + RefPtr<CSSCrossfadeValue> blend(const CSSCrossfadeValue&, double) const; bool equals(const CSSCrossfadeValue&) const; - bool equalInputImages(const CSSCrossfadeValue&) const; private: - CSSCrossfadeValue(PassRefPtr<CSSValue> fromValue, PassRefPtr<CSSValue> toValue) - : CSSImageGeneratorValue(CrossfadeClass) - , m_fromValue(fromValue) - , m_toValue(toValue) - , m_crossfadeSubimageObserver(this) - { - } - - class CrossfadeSubimageObserverProxy : public CachedImageClient { + CSSCrossfadeValue(Ref<CSSValue>&& fromValue, Ref<CSSValue>&& toValue, Ref<CSSPrimitiveValue>&& percentageValue, bool prefixed); + + class SubimageObserver final : public CachedImageClient { public: - CrossfadeSubimageObserverProxy(CSSCrossfadeValue* ownerValue) - : m_ownerValue(ownerValue) - , m_ready(false) - { - } - - virtual ~CrossfadeSubimageObserverProxy() { } - virtual void imageChanged(CachedImage*, const IntRect* = 0) override; - void setReady(bool ready) { m_ready = ready; } + SubimageObserver(CSSCrossfadeValue&); private: - CSSCrossfadeValue* m_ownerValue; - bool m_ready; + void imageChanged(CachedImage*, const IntRect*) final; + CSSCrossfadeValue& m_owner; }; - void crossfadeChanged(const IntRect&); + void crossfadeChanged(); - RefPtr<CSSValue> m_fromValue; - RefPtr<CSSValue> m_toValue; - RefPtr<CSSPrimitiveValue> m_percentageValue; + Ref<CSSValue> m_fromValue; + Ref<CSSValue> m_toValue; + Ref<CSSPrimitiveValue> m_percentageValue; CachedResourceHandle<CachedImage> m_cachedFromImage; CachedResourceHandle<CachedImage> m_cachedToImage; RefPtr<Image> m_generatedImage; - CrossfadeSubimageObserverProxy m_crossfadeSubimageObserver; + SubimageObserver m_subimageObserver; + bool m_isPrefixed { false }; + bool m_subimagesAreReady { false }; }; -CSS_VALUE_TYPE_CASTS(CSSCrossfadeValue, isCrossfadeValue()) - } // namespace WebCore -#endif // CSSCrossfadeValue_h +SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSCrossfadeValue, isCrossfadeValue()) |