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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
706 | 707 |
707 return toCoreString(dict.v8Value()->ToString()); | 708 return toCoreString(dict.v8Value()->ToString()); |
708 } | 709 } |
709 | 710 |
710 return emptyString(); | 711 return emptyString(); |
711 } | 712 } |
712 | 713 |
713 Element* Document::createElement(const AtomicString& localName, | 714 Element* Document::createElement(const AtomicString& localName, |
714 const StringOrDictionary& stringOrOptions, | 715 const StringOrDictionary& stringOrOptions, |
715 ExceptionState& exceptionState) { | 716 ExceptionState& exceptionState) { |
717 const AtomicString& is = | |
718 getTypeExtension(this, stringOrOptions, exceptionState).isEmpty() | |
dominicc (has gone to gerrit)
2016/11/08 08:36:29
There should be a cheaper way to do this where you
| |
719 ? AtomicString() | |
720 : AtomicString( | |
721 getTypeExtension(this, stringOrOptions, exceptionState)); | |
722 | |
716 if (!isValidName(localName)) { | 723 if (!isValidName(localName)) { |
717 exceptionState.throwDOMException( | 724 exceptionState.throwDOMException( |
718 InvalidCharacterError, | 725 InvalidCharacterError, |
719 "The tag name provided ('" + localName + "') is not a valid name."); | 726 "The tag name provided ('" + localName + "') is not a valid name."); |
720 return nullptr; | 727 return nullptr; |
721 } | 728 } |
722 | 729 |
723 Element* element; | 730 Element* element; |
724 | 731 |
725 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName))) { | 732 bool shouldCreateBuiltin = |
733 stringOrOptions.isDictionary() && | |
734 RuntimeEnabledFeatures::customElementsBuiltinEnabled(); | |
735 | |
736 if (CustomElement::shouldCreateCustomElement(convertLocalName(localName)) || | |
737 shouldCreateBuiltin) { | |
726 element = CustomElement::createCustomElementSync( | 738 element = CustomElement::createCustomElementSync( |
727 *this, convertLocalName(localName)); | 739 *this, convertLocalName(localName), is); |
728 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { | 740 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
729 element = registrationContext()->createCustomTagElement( | 741 element = registrationContext()->createCustomTagElement( |
730 *this, QualifiedName(nullAtom, convertLocalName(localName), | 742 *this, QualifiedName(nullAtom, convertLocalName(localName), |
731 xhtmlNamespaceURI)); | 743 xhtmlNamespaceURI)); |
732 } else { | 744 } else { |
733 element = createElement(localName, exceptionState); | 745 element = createElement(localName, exceptionState); |
734 if (exceptionState.hadException()) | 746 if (exceptionState.hadException()) |
735 return nullptr; | 747 return nullptr; |
736 } | 748 } |
737 | 749 |
738 String typeExtention = | 750 if (!is.isEmpty()) { |
739 getTypeExtension(this, stringOrOptions, exceptionState); | 751 if (element->getCustomElementState() != CustomElementState::Custom) { |
740 if (!typeExtention.isEmpty()) { | 752 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( |
741 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension( | 753 element, is); |
742 element, AtomicString(typeExtention)); | 754 } else if (stringOrOptions.isDictionary()) { |
755 element->setAttribute(HTMLNames::isAttr, is); | |
756 } | |
743 } | 757 } |
744 | 758 |
745 return element; | 759 return element; |
746 } | 760 } |
747 | 761 |
748 static inline QualifiedName createQualifiedName( | 762 static inline QualifiedName createQualifiedName( |
749 const AtomicString& namespaceURI, | 763 const AtomicString& namespaceURI, |
750 const AtomicString& qualifiedName, | 764 const AtomicString& qualifiedName, |
751 ExceptionState& exceptionState) { | 765 ExceptionState& exceptionState) { |
752 AtomicString prefix, localName; | 766 AtomicString prefix, localName; |
(...skipping 5728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6481 } | 6495 } |
6482 | 6496 |
6483 void showLiveDocumentInstances() { | 6497 void showLiveDocumentInstances() { |
6484 WeakDocumentSet& set = liveDocumentSet(); | 6498 WeakDocumentSet& set = liveDocumentSet(); |
6485 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6499 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
6486 for (Document* document : set) | 6500 for (Document* document : set) |
6487 fprintf(stderr, "- Document %p URL: %s\n", document, | 6501 fprintf(stderr, "- Document %p URL: %s\n", document, |
6488 document->url().getString().utf8().data()); | 6502 document->url().getString().utf8().data()); |
6489 } | 6503 } |
6490 #endif | 6504 #endif |
OLD | NEW |