1/* 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 3 * Copyright (C) 2003, 2008, 2009, 2013 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20#ifndef JSLazyEventListener_h 21#define JSLazyEventListener_h 22 23#include "JSEventListener.h" 24#include <wtf/text/TextPosition.h> 25#include <wtf/text/WTFString.h> 26 27namespace WebCore { 28 29 class ContainerNode; 30 class Frame; 31 class QualifiedName; 32 33 class JSLazyEventListener final : public JSEventListener { 34 public: 35 static PassRefPtr<JSLazyEventListener> createForNode(ContainerNode&, const QualifiedName& attributeName, const AtomicString& attributeValue); 36 static PassRefPtr<JSLazyEventListener> createForDOMWindow(Frame&, const QualifiedName& attributeName, const AtomicString& attributeValue); 37 38 virtual ~JSLazyEventListener(); 39 40 private: 41 JSLazyEventListener(const String& functionName, const String& eventParameterName, const String& code, ContainerNode*, const String& sourceURL, const TextPosition&, JSC::JSObject* wrapper, DOMWrapperWorld& isolatedWorld); 42 43 virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const override; 44 virtual bool wasCreatedFromMarkup() const override { return true; } 45 46 static void create() = delete; 47 48 mutable String m_functionName; 49 mutable String m_eventParameterName; 50 mutable String m_code; 51 mutable String m_sourceURL; 52 TextPosition m_position; 53 ContainerNode* m_originalNode; 54 }; 55 56} // namespace WebCore 57 58#endif // JSLazyEventListener_h 59