| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 class Event; | 42 class Event; |
| 43 class Frame; | 43 class Frame; |
| 44 class HTMLFormElement; | 44 class HTMLFormElement; |
| 45 class Node; | 45 class Node; |
| 46 | 46 |
| 47 // V8LazyEventListener is a wrapper for a JavaScript code string that is com
piled and evaluated when an event is fired. | 47 // V8LazyEventListener is a wrapper for a JavaScript code string that is com
piled and evaluated when an event is fired. |
| 48 // A V8LazyEventListener is either a HTML or SVG event handler. | 48 // A V8LazyEventListener is either a HTML or SVG event handler. |
| 49 class V8LazyEventListener : public V8AbstractEventListener { | 49 class V8LazyEventListener FINAL : public V8AbstractEventListener { |
| 50 public: | 50 public: |
| 51 static PassRefPtr<V8LazyEventListener> create(const AtomicString& functi
onName, const AtomicString& eventParameterName, const String& code, const String
& sourceURL, const TextPosition& position, Node* node, v8::Isolate* isolate) | 51 static PassRefPtr<V8LazyEventListener> create(const AtomicString& functi
onName, const AtomicString& eventParameterName, const String& code, const String
& sourceURL, const TextPosition& position, Node* node, v8::Isolate* isolate) |
| 52 { | 52 { |
| 53 return adoptRef(new V8LazyEventListener(functionName, eventParameter
Name, code, sourceURL, position, node, isolate)); | 53 return adoptRef(new V8LazyEventListener(functionName, eventParameter
Name, code, sourceURL, position, node, isolate)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual bool isLazy() const { return true; } | 56 virtual bool isLazy() const OVERRIDE { return true; } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 virtual void prepareListenerObject(ExecutionContext*); | 59 virtual void prepareListenerObject(ExecutionContext*) OVERRIDE; |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 V8LazyEventListener(const AtomicString& functionName, const AtomicString
& eventParameterName, const String& code, const String sourceURL, const TextPosi
tion&, Node*, v8::Isolate*); | 62 V8LazyEventListener(const AtomicString& functionName, const AtomicString
& eventParameterName, const String& code, const String sourceURL, const TextPosi
tion&, Node*, v8::Isolate*); |
| 63 | 63 |
| 64 virtual v8::Local<v8::Value> callListenerFunction(ExecutionContext*, v8:
:Handle<v8::Value> jsEvent, Event*); | 64 virtual v8::Local<v8::Value> callListenerFunction(ExecutionContext*, v8:
:Handle<v8::Value> jsEvent, Event*) OVERRIDE; |
| 65 | 65 |
| 66 // Needs to return true for all event handlers implemented in JavaScript
so that | 66 // Needs to return true for all event handlers implemented in JavaScript
so that |
| 67 // the SVG code does not add the event handler in both | 67 // the SVG code does not add the event handler in both |
| 68 // SVGUseElement::buildShadowTree and again in | 68 // SVGUseElement::buildShadowTree and again in |
| 69 // SVGUseElement::transferEventListenersToShadowTree | 69 // SVGUseElement::transferEventListenersToShadowTree |
| 70 virtual bool wasCreatedFromMarkup() const { return true; } | 70 virtual bool wasCreatedFromMarkup() const OVERRIDE { return true; } |
| 71 | 71 |
| 72 AtomicString m_functionName; | 72 AtomicString m_functionName; |
| 73 AtomicString m_eventParameterName; | 73 AtomicString m_eventParameterName; |
| 74 String m_code; | 74 String m_code; |
| 75 String m_sourceURL; | 75 String m_sourceURL; |
| 76 Node* m_node; | 76 Node* m_node; |
| 77 TextPosition m_position; | 77 TextPosition m_position; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace WebCore | 80 } // namespace WebCore |
| 81 | 81 |
| 82 #endif // V8LazyEventListener_h | 82 #endif // V8LazyEventListener_h |
| OLD | NEW |