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

Side by Side Diff: Source/core/dom/CustomElementDefinition.h

Issue 14626005: Upgrade elements that are created before a custom element definition is registered (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Moar^2 better Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 29 matching lines...) Expand all
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class ScriptState; 42 class ScriptState;
43 43
44 class CustomElementDefinition : public RefCounted<CustomElementDefinition> { 44 class CustomElementDefinition : public RefCounted<CustomElementDefinition> {
45 public: 45 public:
46 static PassRefPtr<CustomElementDefinition> create(ScriptState*, const Atomic String& type, const AtomicString& name, const AtomicString& namespaceURI, const ScriptValue& prototype); 46 static PassRefPtr<CustomElementDefinition> create(ScriptState*, const Atomic String& type, const AtomicString& name, const AtomicString& namespaceURI, const ScriptValue& prototype);
47 47
48 virtual ~CustomElementDefinition() {} 48 virtual ~CustomElementDefinition() {}
49 49
50 enum CustomElementKind {
51 CustomTag,
52 TypeExtension
53 };
54
50 // This specifies whether the custom element is in the HTML or SVG 55 // This specifies whether the custom element is in the HTML or SVG
51 // namespace. 56 // namespace.
52 const AtomicString& namespaceURI() const { return m_tag.namespaceURI(); } 57 const AtomicString& namespaceURI() const { return m_tag.namespaceURI(); }
53 58
54 // This uniquely identifies the Custom Element. For custom tags, this 59 // This uniquely identifies the Custom Element. For custom tags, this
55 // is the tag name and the same as "name". For type extensions, this 60 // is the tag name and the same as "name". For type extensions, this
56 // is the value of the "is" attribute. 61 // is the value of the "is" attribute.
57 const AtomicString& type() const { return m_type; } 62 const AtomicString& type() const { return m_type; }
58 63
59 // This is the tag name of the Custom Element. 64 // This is the tag name of the Custom Element.
60 const AtomicString& name() const { return m_tag.localName(); } 65 const AtomicString& name() const { return m_tag.localName(); }
61 66
62 // This is a convenience property derived from "namespaceURI" and 67 // This is a convenience property derived from "namespaceURI" and
63 // "name". Custom Elements of this kind will have this tag 68 // "name". Custom Elements of this kind will have this tag
64 // name. This does not have a prefix. 69 // name. This does not have a prefix.
65 const QualifiedName& tagQName() const { return m_tag; } 70 const QualifiedName& tagQName() const { return m_tag; }
66 71
72 CustomElementKind kind() const { return isTypeExtension() ? TypeExtension : CustomTag; }
67 bool isTypeExtension() const { return type() != name(); } 73 bool isTypeExtension() const { return type() != name(); }
68 74
69 const ScriptValue& prototype() { return m_prototype; } 75 const ScriptValue& prototype() { return m_prototype; }
70 76
71 private: 77 private:
72 CustomElementDefinition(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, const ScriptValue& prototype); 78 CustomElementDefinition(const AtomicString& type, const AtomicString& name, const AtomicString& namespaceURI, const ScriptValue& prototype);
73 79
74 ScriptValue m_prototype; 80 ScriptValue m_prototype;
75 81
76 AtomicString m_type; 82 AtomicString m_type;
77 QualifiedName m_tag; 83 QualifiedName m_tag;
78 }; 84 };
79 85
80 } 86 }
81 87
82 #endif // CustomElementDefinition_h 88 #endif // CustomElementDefinition_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698