CSSFontFaceLoadEvent.h [plain text]
#if ENABLE(FONT_LOAD_EVENTS)
#ifndef CSSFontFaceLoadEvent_h
#define CSSFontFaceLoadEvent_h
#include "CSSFontFaceRule.h"
#include "CSSValue.h"
#include "DOMError.h"
#include "Event.h"
#include "EventNames.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
struct CSSFontFaceLoadEventInit : public EventInit {
RefPtr<CSSFontFaceRule> fontface;
RefPtr<DOMError> error;
};
class CSSFontFaceLoadEvent final : public Event {
public:
static Ref<CSSFontFaceLoadEvent> create()
{
return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent);
}
static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer)
{
return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer));
}
static Ref<CSSFontFaceLoadEvent> createForFontFaceRule(const AtomicString& type, PassRefPtr<CSSFontFaceRule> rule)
{
return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, rule, 0));
}
static Ref<CSSFontFaceLoadEvent> createForError(PassRefPtr<CSSFontFaceRule> rule, PassRefPtr<DOMError> error)
{
return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(eventNames().errorEvent, rule, error));
}
virtual ~CSSFontFaceLoadEvent();
CSSFontFaceRule* fontface() const { return m_fontface.get(); }
DOMError* error() const { return m_error.get(); }
virtual EventInterface eventInterface() const override;
private:
CSSFontFaceLoadEvent();
CSSFontFaceLoadEvent(const AtomicString&, PassRefPtr<CSSFontFaceRule>, PassRefPtr<DOMError>);
CSSFontFaceLoadEvent(const AtomicString&, const CSSFontFaceLoadEventInit&);
RefPtr<CSSFontFaceRule> m_fontface;
RefPtr<DOMError> m_error;
};
}
#endif // CSSFontFaceLoadEvent_h
#endif // ENABLE(FONT_LOAD_EVENTS)