Chromium Code Reviews| Index: Source/bindings/v8/custom/V8DocumentCustom.cpp |
| diff --git a/Source/bindings/v8/custom/V8DocumentCustom.cpp b/Source/bindings/v8/custom/V8DocumentCustom.cpp |
| index 425d5902913ae2ee48524b690fa8526a39038b60..a05b1270b1fdf4bdc8dcd0715a824a9182c89580 100644 |
| --- a/Source/bindings/v8/custom/V8DocumentCustom.cpp |
| +++ b/Source/bindings/v8/custom/V8DocumentCustom.cpp |
| @@ -33,6 +33,7 @@ |
| #include "V8CanvasRenderingContext2D.h" |
| #include "V8DOMImplementation.h" |
| +#include "V8Event.h" |
| #include "V8Node.h" |
| #include "V8Touch.h" |
| #include "V8TouchList.h" |
| @@ -54,6 +55,7 @@ |
| #include "core/xml/DocumentXPathEvaluator.h" |
| #include "core/xml/XPathNSResolver.h" |
| #include "core/xml/XPathResult.h" |
| +#include "modules/InitModules.h" |
| #include "wtf/RefPtr.h" |
| namespace WebCore { |
| @@ -83,4 +85,22 @@ void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& |
| v8SetReturnValueFast(info, result.release(), document.get()); |
| } |
| +void V8Document::createEventMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
|
Nils Barth (inactive)
2014/05/27 06:01:27
Please add a comment explaining why there is custo
c.shu
2014/05/27 15:34:07
Done.
|
| +{ |
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "createEvent", "Document", info.Holder(), info.GetIsolate()); |
| + if (UNLIKELY(info.Length() < 1)) { |
| + throwMinimumArityTypeError(exceptionState, 1, info.Length()); |
| + return; |
| + } |
| + Document* impl = V8Document::toNative(info.Holder()); |
| + V8StringResource<> eventType; |
| + { |
| + TOSTRING_VOID_INTERNAL(eventType, info[0]); |
| + } |
| + RefPtrWillBeRawPtr<Event> result = createEventModules(eventType, exceptionState); |
| + if (exceptionState.throwIfNeeded()) |
| + return; |
| + v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); |
| +} |
| + |
| } // namespace WebCore |