Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: Source/core/dom/CustomElementRegistrationContext.cpp

Issue 21498002: Introduce a SVGUnknownElement class for unknown SVG elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment for SVGUnknownElement Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/scripts/make_names.pl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 21 matching lines...) Expand all
32 #include "core/dom/CustomElementRegistrationContext.h" 32 #include "core/dom/CustomElementRegistrationContext.h"
33 33
34 #include "HTMLNames.h" 34 #include "HTMLNames.h"
35 #include "MathMLNames.h" 35 #include "MathMLNames.h"
36 #include "SVGNames.h" 36 #include "SVGNames.h"
37 #include "core/dom/CustomElement.h" 37 #include "core/dom/CustomElement.h"
38 #include "core/dom/CustomElementDefinition.h" 38 #include "core/dom/CustomElementDefinition.h"
39 #include "core/dom/Element.h" 39 #include "core/dom/Element.h"
40 #include "core/html/HTMLElement.h" 40 #include "core/html/HTMLElement.h"
41 #include "core/html/HTMLUnknownElement.h" 41 #include "core/html/HTMLUnknownElement.h"
42 #include "core/svg/SVGElement.h" 42 #include "core/svg/SVGUnknownElement.h"
43 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 void CustomElementRegistrationContext::registerElement(Document* document, Custo mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Except ionCode& ec) 47 void CustomElementRegistrationContext::registerElement(Document* document, Custo mElementConstructorBuilder* constructorBuilder, const AtomicString& type, Except ionCode& ec)
48 { 48 {
49 CustomElementDefinition* definition = m_registry.registerElement(document, c onstructorBuilder, type, ec); 49 CustomElementDefinition* definition = m_registry.registerElement(document, c onstructorBuilder, type, ec);
50 50
51 if (!definition) 51 if (!definition)
52 return; 52 return;
53 53
54 // Upgrade elements that were waiting for this definition. 54 // Upgrade elements that were waiting for this definition.
55 const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_ca ndidates.takeUpgradeCandidatesFor(definition->descriptor()); 55 const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_ca ndidates.takeUpgradeCandidatesFor(definition->descriptor());
56 for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgra deCandidates.begin(); it != upgradeCandidates.end(); ++it) 56 for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgra deCandidates.begin(); it != upgradeCandidates.end(); ++it)
57 didResolveElement(definition, *it); 57 didResolveElement(definition, *it);
58 } 58 }
59 59
60 PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Doc ument* document, const QualifiedName& tagName) 60 PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Doc ument* document, const QualifiedName& tagName)
61 { 61 {
62 ASSERT(isCustomTagName(tagName.localName())); 62 ASSERT(isCustomTagName(tagName.localName()));
63 63
64 if (!document) 64 if (!document)
65 return 0; 65 return 0;
66 66
67 RefPtr<Element> element; 67 RefPtr<Element> element;
68 68
69 if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) { 69 if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) {
70 element = HTMLElement::create(tagName, document); 70 element = HTMLElement::create(tagName, document);
71 } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) { 71 } else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) {
72 element = SVGElement::create(tagName, document); 72 element = SVGUnknownElement::create(tagName, document);
73 } else { 73 } else {
74 // XML elements are not custom elements, so return early. 74 // XML elements are not custom elements, so return early.
75 return Element::create(tagName, document); 75 return Element::create(tagName, document);
76 } 76 }
77 77
78 resolve(element.get(), nullAtom); 78 resolve(element.get(), nullAtom);
79 return element.release(); 79 return element.release();
80 } 80 }
81 81
82 void CustomElementRegistrationContext::didGiveTypeExtension(Element* element, co nst AtomicString& type) 82 void CustomElementRegistrationContext::didGiveTypeExtension(Element* element, co nst AtomicString& type)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return; 163 return;
164 164
165 if (isCustomTagName(element->localName())) 165 if (isCustomTagName(element->localName()))
166 return; // custom tags take precedence over type extensions 166 return; // custom tags take precedence over type extensions
167 167
168 if (CustomElementRegistrationContext* context = element->document()->registr ationContext()) 168 if (CustomElementRegistrationContext* context = element->document()->registr ationContext())
169 context->didGiveTypeExtension(element, type); 169 context->didGiveTypeExtension(element, type);
170 } 170 }
171 171
172 } // namespace WebCore 172 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/scripts/make_names.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698