| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 v8::Handle<v8::Value> chain = m_prototype; | 244 v8::Handle<v8::Value> chain = m_prototype; |
| 245 while (!chain.IsEmpty() && chain->IsObject()) { | 245 while (!chain.IsEmpty() && chain->IsObject()) { |
| 246 if (chain == elementPrototype) | 246 if (chain == elementPrototype) |
| 247 return true; | 247 return true; |
| 248 chain = chain.As<v8::Object>()->GetPrototype(); | 248 chain = chain.As<v8::Object>()->GetPrototype(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 return false; | 251 return false; |
| 252 } | 252 } |
| 253 | 253 |
| 254 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>& ar
gs) | 254 static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>& in
fo) |
| 255 { | 255 { |
| 256 v8::Isolate* isolate = args.GetIsolate(); | 256 v8::Isolate* isolate = info.GetIsolate(); |
| 257 | 257 |
| 258 if (!args.IsConstructCall()) { | 258 if (!info.IsConstructCall()) { |
| 259 throwTypeError("DOM object constructor cannot be called as a function.",
isolate); | 259 throwTypeError("DOM object constructor cannot be called as a function.",
isolate); |
| 260 return; | 260 return; |
| 261 } | 261 } |
| 262 | 262 |
| 263 if (args.Length() > 0) { | 263 if (info.Length() > 0) { |
| 264 throwUninformativeAndGenericTypeError(isolate); | 264 throwUninformativeAndGenericTypeError(isolate); |
| 265 return; | 265 return; |
| 266 } | 266 } |
| 267 | 267 |
| 268 Document* document = V8Document::toNative(args.Callee()->GetHiddenValue(V8Hi
ddenPropertyName::customElementDocument(isolate)).As<v8::Object>()); | 268 Document* document = V8Document::toNative(info.Callee()->GetHiddenValue(V8Hi
ddenPropertyName::customElementDocument(isolate)).As<v8::Object>()); |
| 269 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, args.
Callee()->GetHiddenValue(V8HiddenPropertyName::customElementNamespaceURI(isolate
))); | 269 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, namespaceURI, info.
Callee()->GetHiddenValue(V8HiddenPropertyName::customElementNamespaceURI(isolate
))); |
| 270 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, tagName, args.Calle
e()->GetHiddenValue(V8HiddenPropertyName::customElementTagName(isolate))); | 270 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, tagName, info.Calle
e()->GetHiddenValue(V8HiddenPropertyName::customElementTagName(isolate))); |
| 271 v8::Handle<v8::Value> maybeType = args.Callee()->GetHiddenValue(V8HiddenProp
ertyName::customElementType(isolate)); | 271 v8::Handle<v8::Value> maybeType = info.Callee()->GetHiddenValue(V8HiddenProp
ertyName::customElementType(isolate)); |
| 272 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, maybeType); | 272 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, maybeType); |
| 273 | 273 |
| 274 ExceptionState es(args.GetIsolate()); | 274 ExceptionState es(info.GetIsolate()); |
| 275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 276 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, es); | 276 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, es); |
| 277 if (es.throwIfNeeded()) | 277 if (es.throwIfNeeded()) |
| 278 return; | 278 return; |
| 279 v8SetReturnValueFast(args, element.release(), document); | 279 v8SetReturnValueFast(info, element.release(), document); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace WebCore | 282 } // namespace WebCore |
| OLD | NEW |