| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 { | 48 { |
| 49 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event")); | 49 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event")); |
| 50 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 50 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
| 51 return isSVGEvent ? evtString : eventString; | 51 return isSVGEvent ? evtString : eventString; |
| 52 } | 52 } |
| 53 | 53 |
| 54 PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const Q
ualifiedName& name, const AtomicString& value) | 54 PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const Q
ualifiedName& name, const AtomicString& value) |
| 55 { | 55 { |
| 56 ASSERT(node); | 56 ASSERT(node); |
| 57 if (value.isNull()) | 57 if (value.isNull()) |
| 58 return 0; | 58 return nullptr; |
| 59 | 59 |
| 60 // FIXME: Very strange: we initialize zero-based number with '1'. | 60 // FIXME: Very strange: we initialize zero-based number with '1'. |
| 61 TextPosition position(OrdinalNumber::fromZeroBasedInt(1), OrdinalNumber::fir
st()); | 61 TextPosition position(OrdinalNumber::fromZeroBasedInt(1), OrdinalNumber::fir
st()); |
| 62 String sourceURL; | 62 String sourceURL; |
| 63 | 63 |
| 64 v8::Isolate* isolate; | 64 v8::Isolate* isolate; |
| 65 if (Frame* frame = node->document().frame()) { | 65 if (Frame* frame = node->document().frame()) { |
| 66 isolate = toIsolate(frame); | 66 isolate = toIsolate(frame); |
| 67 ScriptController& scriptController = frame->script(); | 67 ScriptController& scriptController = frame->script(); |
| 68 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) | 68 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) |
| 69 return 0; | 69 return nullptr; |
| 70 position = scriptController.eventHandlerPosition(); | 70 position = scriptController.eventHandlerPosition(); |
| 71 sourceURL = node->document().url().string(); | 71 sourceURL = node->document().url().string(); |
| 72 } else { | 72 } else { |
| 73 isolate = v8::Isolate::GetCurrent(); | 73 isolate = v8::Isolate::GetCurrent(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 return V8LazyEventListener::create(name.localName(), eventParameterName(node
->isSVGElement()), value, sourceURL, position, node, isolate); | 76 return V8LazyEventListener::create(name.localName(), eventParameterName(node
->isSVGElement()), value, sourceURL, position, node, isolate); |
| 77 } | 77 } |
| 78 | 78 |
| 79 PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, const
QualifiedName& name, const AtomicString& value) | 79 PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, const
QualifiedName& name, const AtomicString& value) |
| 80 { | 80 { |
| 81 if (!frame) | 81 if (!frame) |
| 82 return 0; | 82 return nullptr; |
| 83 | 83 |
| 84 if (value.isNull()) | 84 if (value.isNull()) |
| 85 return 0; | 85 return nullptr; |
| 86 | 86 |
| 87 ScriptController& scriptController = frame->script(); | 87 ScriptController& scriptController = frame->script(); |
| 88 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) | 88 if (!scriptController.canExecuteScripts(AboutToExecuteScript)) |
| 89 return 0; | 89 return nullptr; |
| 90 | 90 |
| 91 TextPosition position = scriptController.eventHandlerPosition(); | 91 TextPosition position = scriptController.eventHandlerPosition(); |
| 92 String sourceURL = frame->document()->url().string(); | 92 String sourceURL = frame->document()->url().string(); |
| 93 | 93 |
| 94 return V8LazyEventListener::create(name.localName(), eventParameterName(fram
e->document()->isSVGDocument()), value, sourceURL, position, 0, toIsolate(frame)
); | 94 return V8LazyEventListener::create(name.localName(), eventParameterName(fram
e->document()->isSVGDocument()), value, sourceURL, position, 0, toIsolate(frame)
); |
| 95 } | 95 } |
| 96 | 96 |
| 97 static v8::Handle<v8::Function> eventListenerEffectiveFunction(v8::Isolate* isol
ate, v8::Handle<v8::Object> listenerObject) | 97 static v8::Handle<v8::Function> eventListenerEffectiveFunction(v8::Isolate* isol
ate, v8::Handle<v8::Object> listenerObject) |
| 98 { | 98 { |
| 99 v8::Handle<v8::Function> function; | 99 v8::Handle<v8::Function> function; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin(); | 179 v8::ScriptOrigin origin = originalFunction->GetScriptOrigin(); |
| 180 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString()) | 180 if (!origin.ResourceName().IsEmpty() && origin.ResourceName()->IsString()) |
| 181 sourceName = toCoreString(origin.ResourceName().As<v8::String>()); | 181 sourceName = toCoreString(origin.ResourceName().As<v8::String>()); |
| 182 else | 182 else |
| 183 sourceName = ""; | 183 sourceName = ""; |
| 184 lineNumber = originalFunction->GetScriptLineNumber(); | 184 lineNumber = originalFunction->GetScriptLineNumber(); |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace WebCore | 188 } // namespace WebCore |
| OLD | NEW |