| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // V8LazyEventListener is a wrapper for a JavaScript code string that is compile
d and evaluated when an event is fired. | 44 // V8LazyEventListener is a wrapper for a JavaScript code string that is compile
d and evaluated when an event is fired. |
| 45 // A V8LazyEventListener is either a HTML or SVG event handler. | 45 // A V8LazyEventListener is either a HTML or SVG event handler. |
| 46 class V8LazyEventListener final : public V8AbstractEventListener { | 46 class V8LazyEventListener final : public V8AbstractEventListener { |
| 47 public: | 47 public: |
| 48 static PassRefPtr<V8LazyEventListener> create(const AtomicString& functionNa
me, const AtomicString& eventParameterName, const String& code, const String& so
urceURL, const TextPosition& position, Node* node, v8::Isolate* isolate) | 48 static PassRefPtr<V8LazyEventListener> create(const AtomicString& functionNa
me, const AtomicString& eventParameterName, const String& code, const String& so
urceURL, const TextPosition& position, Node* node, v8::Isolate* isolate) |
| 49 { | 49 { |
| 50 return adoptRef(new V8LazyEventListener(isolate, functionName, eventPara
meterName, code, sourceURL, position, node)); | 50 return adoptRef(new V8LazyEventListener(isolate, functionName, eventPara
meterName, code, sourceURL, position, node)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 virtual void prepareListenerObject(ExecutionContext*) override; | 54 void prepareListenerObject(ExecutionContext*) override; |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 V8LazyEventListener(v8::Isolate*, const AtomicString& functionName, const At
omicString& eventParameterName, const String& code, const String sourceURL, cons
t TextPosition&, Node*); | 57 V8LazyEventListener(v8::Isolate*, const AtomicString& functionName, const At
omicString& eventParameterName, const String& code, const String sourceURL, cons
t TextPosition&, Node*); |
| 58 | 58 |
| 59 virtual v8::Local<v8::Value> callListenerFunction(ScriptState*, v8::Local<v8
::Value>, Event*) override; | 59 v8::Local<v8::Value> callListenerFunction(ScriptState*, v8::Local<v8::Value>
, Event*) override; |
| 60 | 60 |
| 61 // Needs to return true for all event handlers implemented in JavaScript so
that | 61 // Needs to return true for all event handlers implemented in JavaScript so
that |
| 62 // the SVG code does not add the event handler in both | 62 // the SVG code does not add the event handler in both |
| 63 // SVGUseElement::buildShadowTree and again in | 63 // SVGUseElement::buildShadowTree and again in |
| 64 // SVGUseElement::transferEventListenersToShadowTree | 64 // SVGUseElement::transferEventListenersToShadowTree |
| 65 virtual bool wasCreatedFromMarkup() const override { return true; } | 65 bool wasCreatedFromMarkup() const override { return true; } |
| 66 | 66 |
| 67 AtomicString m_functionName; | 67 AtomicString m_functionName; |
| 68 AtomicString m_eventParameterName; | 68 AtomicString m_eventParameterName; |
| 69 String m_code; | 69 String m_code; |
| 70 String m_sourceURL; | 70 String m_sourceURL; |
| 71 Node* m_node; | 71 Node* m_node; |
| 72 TextPosition m_position; | 72 TextPosition m_position; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| 76 | 76 |
| 77 #endif // V8LazyEventListener_h | 77 #endif // V8LazyEventListener_h |
| OLD | NEW |