| 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 25 matching lines...) Expand all Loading... |
| 36 #include "wtf/text/TextPosition.h" | 36 #include "wtf/text/TextPosition.h" |
| 37 #include <v8.h> | 37 #include <v8.h> |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class Event; | 41 class Event; |
| 42 class Node; | 42 class Node; |
| 43 | 43 |
| 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(functionName, eventParameterName
, code, sourceURL, position, node, isolate)); | 50 return adoptRef(new V8LazyEventListener(functionName, eventParameterName
, code, sourceURL, position, node, isolate)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual bool isLazy() const OVERRIDE { return true; } | 53 virtual bool isLazy() const override { return true; } |
| 54 // V8LazyEventListener is always for the main world. | 54 // V8LazyEventListener is always for the main world. |
| 55 virtual DOMWrapperWorld& world() const OVERRIDE { return DOMWrapperWorld::ma
inWorld(); } | 55 virtual DOMWrapperWorld& world() const override { return DOMWrapperWorld::ma
inWorld(); } |
| 56 | 56 |
| 57 virtual void handleEvent(ExecutionContext*, Event*) OVERRIDE; | 57 virtual void handleEvent(ExecutionContext*, Event*) override; |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 virtual void prepareListenerObject(ExecutionContext*) OVERRIDE; | 60 virtual void prepareListenerObject(ExecutionContext*) override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 V8LazyEventListener(const AtomicString& functionName, const AtomicString& ev
entParameterName, const String& code, const String sourceURL, const TextPosition
&, Node*, v8::Isolate*); | 63 V8LazyEventListener(const AtomicString& functionName, const AtomicString& ev
entParameterName, const String& code, const String sourceURL, const TextPosition
&, Node*, v8::Isolate*); |
| 64 | 64 |
| 65 virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEv
ent, Event*) OVERRIDE; | 65 virtual v8::Local<v8::Value> callListenerFunction(v8::Handle<v8::Value> jsEv
ent, Event*) override; |
| 66 | 66 |
| 67 // Needs to return true for all event handlers implemented in JavaScript so
that | 67 // Needs to return true for all event handlers implemented in JavaScript so
that |
| 68 // the SVG code does not add the event handler in both | 68 // the SVG code does not add the event handler in both |
| 69 // SVGUseElement::buildShadowTree and again in | 69 // SVGUseElement::buildShadowTree and again in |
| 70 // SVGUseElement::transferEventListenersToShadowTree | 70 // SVGUseElement::transferEventListenersToShadowTree |
| 71 virtual bool wasCreatedFromMarkup() const OVERRIDE { return true; } | 71 virtual bool wasCreatedFromMarkup() const override { return true; } |
| 72 | 72 |
| 73 AtomicString m_functionName; | 73 AtomicString m_functionName; |
| 74 AtomicString m_eventParameterName; | 74 AtomicString m_eventParameterName; |
| 75 String m_code; | 75 String m_code; |
| 76 String m_sourceURL; | 76 String m_sourceURL; |
| 77 Node* m_node; | 77 Node* m_node; |
| 78 TextPosition m_position; | 78 TextPosition m_position; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace blink | 81 } // namespace blink |
| 82 | 82 |
| 83 #endif // V8LazyEventListener_h | 83 #endif // V8LazyEventListener_h |
| OLD | NEW |