| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 if (!isValidName(name)) { | 438 if (!isValidName(name)) { |
| 439 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 439 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
| 440 return nullptr; | 440 return nullptr; |
| 441 } | 441 } |
| 442 if (isHTMLDocument()) | 442 if (isHTMLDocument()) |
| 443 return HTMLElementFactory::createHTMLElement(name, *this, false); | 443 return HTMLElementFactory::createHTMLElement(name, *this, false); |
| 444 | 444 |
| 445 return Element::create(QualifiedName(name), this); | 445 return Element::create(QualifiedName(name), this); |
| 446 } | 446 } |
| 447 | 447 |
| 448 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
AtomicString& typeExtension, ExceptionState& exceptionState) | |
| 449 { | |
| 450 if (!isValidName(localName)) { | |
| 451 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + localName + "') is not a valid name."); | |
| 452 return nullptr; | |
| 453 } | |
| 454 | |
| 455 RefPtr<Element> element; | |
| 456 | |
| 457 if (CustomElement::isValidName(localName) && registrationContext()) { | |
| 458 element = registrationContext()->createCustomTagElement(*this, Qualified
Name(localName)); | |
| 459 } else { | |
| 460 element = createElement(localName, exceptionState); | |
| 461 if (exceptionState.hadException()) | |
| 462 return nullptr; | |
| 463 } | |
| 464 | |
| 465 if (!typeExtension.isEmpty()) | |
| 466 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element
.get(), typeExtension); | |
| 467 | |
| 468 return element.release(); | |
| 469 } | |
| 470 | |
| 471 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, ExceptionState& exceptionState) | 448 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, ExceptionState& exceptionState) |
| 472 { | 449 { |
| 473 return registerElement(scriptState, name, Dictionary(), exceptionState); | 450 return registerElement(scriptState, name, Dictionary(), exceptionState); |
| 474 } | 451 } |
| 475 | 452 |
| 476 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const Dictionary& options, ExceptionState& exceptionState, CustomEleme
nt::NameSet validNames) | 453 ScriptValue Document::registerElement(ScriptState* scriptState, const AtomicStri
ng& name, const Dictionary& options, ExceptionState& exceptionState, CustomEleme
nt::NameSet validNames) |
| 477 { | 454 { |
| 478 if (!registrationContext()) { | 455 if (!registrationContext()) { |
| 479 exceptionState.throwDOMException(NotSupportedError, "No element registra
tion context is available."); | 456 exceptionState.throwDOMException(NotSupportedError, "No element registra
tion context is available."); |
| 480 return ScriptValue(); | 457 return ScriptValue(); |
| (...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2758 using namespace blink; | 2735 using namespace blink; |
| 2759 void showLiveDocumentInstances() | 2736 void showLiveDocumentInstances() |
| 2760 { | 2737 { |
| 2761 WeakDocumentSet& set = liveDocumentSet(); | 2738 WeakDocumentSet& set = liveDocumentSet(); |
| 2762 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2739 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 2763 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2740 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 2764 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2741 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 2765 } | 2742 } |
| 2766 } | 2743 } |
| 2767 #endif | 2744 #endif |
| OLD | NEW |