CSSCursorImageValue.h [plain text]
#pragma once
#include "CSSValue.h"
#include "IntPoint.h"
#include "ResourceLoaderOptions.h"
#include <wtf/HashSet.h>
namespace WebCore {
class CachedImage;
class CachedResourceLoader;
class Document;
class Element;
class SVGCursorElement;
class SVGElement;
struct ImageWithScale;
namespace Style {
class BuilderState;
}
class CSSCursorImageValue final : public CSSValue {
public:
static Ref<CSSCursorImageValue> create(Ref<CSSValue>&& imageValue, bool hasHotSpot, const IntPoint& hotSpot, LoadedFromOpaqueSource loadedFromOpaqueSource)
{
return adoptRef(*new CSSCursorImageValue(WTFMove(imageValue), hasHotSpot, hotSpot, loadedFromOpaqueSource));
}
~CSSCursorImageValue();
bool hasHotSpot() const { return m_hasHotSpot; }
IntPoint hotSpot() const
{
if (m_hasHotSpot)
return m_hotSpot;
return IntPoint(-1, -1);
}
const URL& imageURL() const { return m_originalURL; }
String customCSSText() const;
ImageWithScale selectBestFitImage(const Document&);
void removeReferencedElement(SVGElement*);
bool equals(const CSSCursorImageValue&) const;
void cursorElementRemoved(SVGCursorElement&);
void cursorElementChanged(SVGCursorElement&);
private:
CSSCursorImageValue(Ref<CSSValue>&& imageValue, bool hasHotSpot, const IntPoint& hotSpot, LoadedFromOpaqueSource);
SVGCursorElement* updateCursorElement(const Document&);
URL m_originalURL;
Ref<CSSValue> m_imageValue;
bool m_hasHotSpot;
IntPoint m_hotSpot;
HashSet<SVGCursorElement*> m_cursorElements;
LoadedFromOpaqueSource m_loadedFromOpaqueSource { LoadedFromOpaqueSource::No };
};
}
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSCursorImageValue, isCursorImageValue())