diff options
Diffstat (limited to 'Source/WebCore/css/CSSFontFaceLoadEvent.h')
-rw-r--r-- | Source/WebCore/css/CSSFontFaceLoadEvent.h | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/Source/WebCore/css/CSSFontFaceLoadEvent.h b/Source/WebCore/css/CSSFontFaceLoadEvent.h index c0f29c01f..93a613bc6 100644 --- a/Source/WebCore/css/CSSFontFaceLoadEvent.h +++ b/Source/WebCore/css/CSSFontFaceLoadEvent.h @@ -28,46 +28,45 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if ENABLE(FONT_LOAD_EVENTS) +#pragma once -#ifndef CSSFontFaceLoadEvent_h -#define CSSFontFaceLoadEvent_h +#if ENABLE(FONT_LOAD_EVENTS) #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 DOMError; -class CSSFontFaceLoadEvent : public Event { +class CSSFontFaceLoadEvent final : public Event { public: - static PassRefPtr<CSSFontFaceLoadEvent> create() + static Ref<CSSFontFaceLoadEvent> create() { - return adoptRef<CSSFontFaceLoadEvent>(new CSSFontFaceLoadEvent()); + return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent); } - static PassRefPtr<CSSFontFaceLoadEvent> create(const AtomicString& type, const CSSFontFaceLoadEventInit& initializer) + struct Init : EventInit { + RefPtr<CSSFontFaceRule> fontface; + RefPtr<DOMError> error; + }; + + static Ref<CSSFontFaceLoadEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) { - return adoptRef<CSSFontFaceLoadEvent>(new CSSFontFaceLoadEvent(type, initializer)); + return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, initializer, isTrusted)); } - static PassRefPtr<CSSFontFaceLoadEvent> createForFontFaceRule(const AtomicString& type, PassRefPtr<CSSFontFaceRule> rule) + static Ref<CSSFontFaceLoadEvent> createForFontFaceRule(const AtomicString& type, RefPtr<CSSFontFaceRule>&& rule) { - return adoptRef<CSSFontFaceLoadEvent>(new CSSFontFaceLoadEvent(type, rule, 0)); + return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(type, WTFMove(rule), nullptr)); } - static PassRefPtr<CSSFontFaceLoadEvent> createForError(PassRefPtr<CSSFontFaceRule> rule, PassRefPtr<DOMError> error) + static Ref<CSSFontFaceLoadEvent> createForError(RefPtr<CSSFontFaceRule>&& rule, RefPtr<DOMError>&& error) { - return adoptRef<CSSFontFaceLoadEvent>(new CSSFontFaceLoadEvent(eventNames().errorEvent, rule, error)); + return adoptRef<CSSFontFaceLoadEvent>(*new CSSFontFaceLoadEvent(eventNames().errorEvent, WTFMove(rule), WTFMove(error))); } virtual ~CSSFontFaceLoadEvent(); @@ -75,12 +74,12 @@ public: CSSFontFaceRule* fontface() const { return m_fontface.get(); } DOMError* error() const { return m_error.get(); } - virtual EventInterface eventInterface() const; + EventInterface eventInterface() const final; private: CSSFontFaceLoadEvent(); - CSSFontFaceLoadEvent(const AtomicString&, PassRefPtr<CSSFontFaceRule>, PassRefPtr<DOMError>); - CSSFontFaceLoadEvent(const AtomicString&, const CSSFontFaceLoadEventInit&); + CSSFontFaceLoadEvent(const AtomicString&, RefPtr<CSSFontFaceRule>&&, RefPtr<DOMError>&&); + CSSFontFaceLoadEvent(const AtomicString&, const Init&, IsTrusted); RefPtr<CSSFontFaceRule> m_fontface; RefPtr<DOMError> m_error; @@ -88,5 +87,4 @@ private: } // namespace WebCore -#endif // CSSFontFaceLoadEvent_h #endif // ENABLE(FONT_LOAD_EVENTS) |