Chromium Code Reviews| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 #include "bindings/core/v8/Microtask.h" | 37 #include "bindings/core/v8/Microtask.h" |
| 38 #include "bindings/core/v8/ScriptController.h" | 38 #include "bindings/core/v8/ScriptController.h" |
| 39 #include "bindings/core/v8/SourceLocation.h" | 39 #include "bindings/core/v8/SourceLocation.h" |
| 40 #include "bindings/core/v8/StringOrDictionary.h" | 40 #include "bindings/core/v8/StringOrDictionary.h" |
| 41 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" | 41 #include "bindings/core/v8/V0CustomElementConstructorBuilder.h" |
| 42 #include "bindings/core/v8/V8DOMWrapper.h" | 42 #include "bindings/core/v8/V8DOMWrapper.h" |
| 43 #include "bindings/core/v8/V8ElementCreationOptions.h" | 43 #include "bindings/core/v8/V8ElementCreationOptions.h" |
| 44 #include "bindings/core/v8/V8PerIsolateData.h" | 44 #include "bindings/core/v8/V8PerIsolateData.h" |
| 45 #include "bindings/core/v8/WindowProxy.h" | 45 #include "bindings/core/v8/WindowProxy.h" |
| 46 #include "core/HTMLElementFactory.h" | 46 #include "core/HTMLElementFactory.h" |
| 47 #include "core/HTMLElementTypeHelpers.h" | |
| 47 #include "core/HTMLNames.h" | 48 #include "core/HTMLNames.h" |
| 48 #include "core/SVGElementFactory.h" | 49 #include "core/SVGElementFactory.h" |
| 49 #include "core/SVGNames.h" | 50 #include "core/SVGNames.h" |
| 50 #include "core/XMLNSNames.h" | 51 #include "core/XMLNSNames.h" |
| 51 #include "core/XMLNames.h" | 52 #include "core/XMLNames.h" |
| 52 #include "core/animation/CompositorPendingAnimations.h" | 53 #include "core/animation/CompositorPendingAnimations.h" |
| 53 #include "core/animation/DocumentAnimations.h" | 54 #include "core/animation/DocumentAnimations.h" |
| 54 #include "core/animation/DocumentTimeline.h" | 55 #include "core/animation/DocumentTimeline.h" |
| 55 #include "core/css/CSSFontSelector.h" | 56 #include "core/css/CSSFontSelector.h" |
| 56 #include "core/css/CSSStyleDeclaration.h" | 57 #include "core/css/CSSStyleDeclaration.h" |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 | 706 |
| 706 return toCoreString(dict.v8Value()->ToString()); | 707 return toCoreString(dict.v8Value()->ToString()); |
| 707 } | 708 } |
| 708 | 709 |
| 709 return emptyString(); | 710 return emptyString(); |
| 710 } | 711 } |
| 711 | 712 |
| 712 Element* Document::createElement(const AtomicString& localName, | 713 Element* Document::createElement(const AtomicString& localName, |
| 713 const StringOrDictionary& stringOrOptions, | 714 const StringOrDictionary& stringOrOptions, |
| 714 ExceptionState& exceptionState) { | 715 ExceptionState& exceptionState) { |
| 716 const AtomicString& is = | |
| 717 getTypeExtension(this, stringOrOptions, exceptionState).isEmpty() | |
| 718 ? AtomicString() | |
| 719 : AtomicString( | |
| 720 getTypeExtension(this, stringOrOptions, exceptionState)); | |
| 721 | |
| 715 if (!isValidName(localName)) { | 722 if (!isValidName(localName)) { |
| 716 exceptionState.throwDOMException( | 723 exceptionState.throwDOMException( |
| 717 InvalidCharacterError, | 724 InvalidCharacterError, |
| 718 "The tag name provided ('" + localName + "') is not a valid name."); | 725 "The tag name provided ('" + localName + "') is not a valid name."); |
| 719 return nullptr; | 726 return nullptr; |
| 720 } | 727 } |
| 721 | 728 |
| 722 Element* element; | 729 Element* element; |
| 723 | 730 |
| 724 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { | 731 int builtin = 0; |
|
dominicc (has gone to gerrit)
2016/11/07 01:59:00
Use bool, not int, for true/false values. C++ 'hel
| |
| 725 element = CustomElement::createCustomElementSync( | 732 if (RuntimeEnabledFeatures::customElementsBuiltinEnabled() && |
| 726 *this, convertLocalName(localName)); | 733 stringOrOptions.isDictionary()) { |
| 734 builtin = 1; | |
| 735 } | |
| 736 | |
| 737 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName)) || | |
|
dominicc (has gone to gerrit)
2016/11/07 01:58:59
The createElement spec case-converts names sometim
| |
| 738 builtin) { | |
| 739 return CustomElement::createCustomElementSync( | |
| 740 *this, convertLocalName(localName), is); | |
| 727 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { | 741 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
| 728 element = registrationContext()->createCustomTagElement( | 742 element = registrationContext()->createCustomTagElement( |
| 729 *this, QualifiedName(nullAtom, convertLocalName(localName), | 743 *this, QualifiedName(nullAtom, convertLocalName(localName), |
| 730 xhtmlNamespaceURI)); | 744 xhtmlNamespaceURI)); |
| 731 } else { | 745 } else { |
| 732 element = createElement(localName, exceptionState); | 746 element = createElement(localName, exceptionState); |
| 733 if (exceptionState.hadException()) | 747 if (exceptionState.hadException()) |
| 734 return nullptr; | 748 return nullptr; |
| 735 } | 749 } |
| 736 | 750 |
| 737 String typeExtention = | 751 if (!is.isEmpty()) { |
| 738 getTypeExtension(this, stringOrOptions, exceptionState); | 752 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, |
| 739 if (!typeExtention.isEmpty()) { | 753 is); |
| 740 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( | |
| 741 element, AtomicString(typeExtention)); | |
| 742 } | 754 } |
| 743 | 755 |
| 744 return element; | 756 return element; |
| 745 } | 757 } |
| 746 | 758 |
| 747 static inline QualifiedName createQualifiedName( | 759 static inline QualifiedName createQualifiedName( |
| 748 const AtomicString& namespaceURI, | 760 const AtomicString& namespaceURI, |
| 749 const AtomicString& qualifiedName, | 761 const AtomicString& qualifiedName, |
| 750 ExceptionState& exceptionState) { | 762 ExceptionState& exceptionState) { |
| 751 AtomicString prefix, localName; | 763 AtomicString prefix, localName; |
| (...skipping 5725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6477 } | 6489 } |
| 6478 | 6490 |
| 6479 void showLiveDocumentInstances() { | 6491 void showLiveDocumentInstances() { |
| 6480 WeakDocumentSet& set = liveDocumentSet(); | 6492 WeakDocumentSet& set = liveDocumentSet(); |
| 6481 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6493 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6482 for (Document* document : set) | 6494 for (Document* document : set) |
| 6483 fprintf(stderr, "- Document %p URL: %s\n", document, | 6495 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6484 document->url().getString().utf8().data()); | 6496 document->url().getString().utf8().data()); |
| 6485 } | 6497 } |
| 6486 #endif | 6498 #endif |
| OLD | NEW |