OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Company 100, Inc. All rights reserved. | 2 * Copyright (C) 2012 Company 100, 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 21 matching lines...) Expand all Loading... | |
32 #include "core/dom/Element.h" | 32 #include "core/dom/Element.h" |
33 #include "core/html/parser/AtomicHTMLToken.h" | 33 #include "core/html/parser/AtomicHTMLToken.h" |
34 #include "wtf/RefCounted.h" | 34 #include "wtf/RefCounted.h" |
35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
36 #include "wtf/text/AtomicString.h" | 36 #include "wtf/text/AtomicString.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class ContainerNode; | 40 class ContainerNode; |
41 | 41 |
42 class HTMLStackItem : public RefCounted<HTMLStackItem> { | 42 class HTMLStackItem : public RefCountedWillBeGarbageCollectedFinalized<HTMLStack Item> { |
haraken
2014/05/27 10:48:22
Add FINAL.
wibling-chromium
2014/05/27 11:16:36
Done.
| |
43 public: | 43 public: |
44 enum ItemType { | 44 enum ItemType { |
45 ItemForContextElement, | 45 ItemForContextElement, |
46 ItemForDocumentFragmentNode | 46 ItemForDocumentFragmentNode |
47 }; | 47 }; |
48 | 48 |
49 // Used by document fragment node and context element. | 49 // Used by document fragment node and context element. |
50 static PassRefPtr<HTMLStackItem> create(PassRefPtr<ContainerNode> node, Item Type type) | 50 static PassRefPtrWillBeRawPtr<HTMLStackItem> create(PassRefPtrWillBeRawPtr<C ontainerNode> node, ItemType type) |
51 { | 51 { |
52 return adoptRef(new HTMLStackItem(node, type)); | 52 return adoptRefWillBeNoop(new HTMLStackItem(node, type)); |
53 } | 53 } |
54 | 54 |
55 // Used by HTMLElementStack and HTMLFormattingElementList. | 55 // Used by HTMLElementStack and HTMLFormattingElementList. |
56 static PassRefPtr<HTMLStackItem> create(PassRefPtr<ContainerNode> node, Atom icHTMLToken* token, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespace URI) | 56 static PassRefPtrWillBeRawPtr<HTMLStackItem> create(PassRefPtrWillBeRawPtr<C ontainerNode> node, AtomicHTMLToken* token, const AtomicString& namespaceURI = H TMLNames::xhtmlNamespaceURI) |
57 { | 57 { |
58 return adoptRef(new HTMLStackItem(node, token, namespaceURI)); | 58 return adoptRefWillBeNoop(new HTMLStackItem(node, token, namespaceURI)); |
59 } | 59 } |
60 | 60 |
61 Element* element() const { return toElement(m_node.get()); } | 61 Element* element() const { return toElement(m_node.get()); } |
62 ContainerNode* node() const { return m_node.get(); } | 62 ContainerNode* node() const { return m_node.get(); } |
63 | 63 |
64 bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; } | 64 bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; } |
65 bool isElementNode() const { return !m_isDocumentFragmentNode; } | 65 bool isElementNode() const { return !m_isDocumentFragmentNode; } |
66 | 66 |
67 const AtomicString& namespaceURI() const { return m_namespaceURI; } | 67 const AtomicString& namespaceURI() const { return m_namespaceURI; } |
68 const AtomicString& localName() const { return m_tokenLocalName; } | 68 const AtomicString& localName() const { return m_tokenLocalName; } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 || tagName == HTMLNames::templateTag | 200 || tagName == HTMLNames::templateTag |
201 || tagName == HTMLNames::textareaTag | 201 || tagName == HTMLNames::textareaTag |
202 || tagName == HTMLNames::thTag | 202 || tagName == HTMLNames::thTag |
203 || tagName == HTMLNames::titleTag | 203 || tagName == HTMLNames::titleTag |
204 || tagName == HTMLNames::trTag | 204 || tagName == HTMLNames::trTag |
205 || tagName == HTMLNames::ulTag | 205 || tagName == HTMLNames::ulTag |
206 || tagName == HTMLNames::wbrTag | 206 || tagName == HTMLNames::wbrTag |
207 || tagName == HTMLNames::xmpTag; | 207 || tagName == HTMLNames::xmpTag; |
208 } | 208 } |
209 | 209 |
210 void trace(Visitor* visitor) { visitor->trace(m_node); } | |
211 | |
210 private: | 212 private: |
211 HTMLStackItem(PassRefPtr<ContainerNode> node, ItemType type) | 213 HTMLStackItem(PassRefPtrWillBeRawPtr<ContainerNode> node, ItemType type) |
212 : m_node(node) | 214 : m_node(node) |
213 { | 215 { |
214 switch (type) { | 216 switch (type) { |
215 case ItemForDocumentFragmentNode: | 217 case ItemForDocumentFragmentNode: |
216 m_isDocumentFragmentNode = true; | 218 m_isDocumentFragmentNode = true; |
217 break; | 219 break; |
218 case ItemForContextElement: | 220 case ItemForContextElement: |
219 m_tokenLocalName = m_node->localName(); | 221 m_tokenLocalName = m_node->localName(); |
220 m_namespaceURI = m_node->namespaceURI(); | 222 m_namespaceURI = m_node->namespaceURI(); |
221 m_isDocumentFragmentNode = false; | 223 m_isDocumentFragmentNode = false; |
222 break; | 224 break; |
223 } | 225 } |
224 } | 226 } |
225 | 227 |
226 HTMLStackItem(PassRefPtr<ContainerNode> node, AtomicHTMLToken* token, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespaceURI) | 228 HTMLStackItem(PassRefPtrWillBeRawPtr<ContainerNode> node, AtomicHTMLToken* t oken, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespaceURI) |
227 : m_node(node) | 229 : m_node(node) |
228 , m_tokenLocalName(token->name()) | 230 , m_tokenLocalName(token->name()) |
229 , m_tokenAttributes(token->attributes()) | 231 , m_tokenAttributes(token->attributes()) |
230 , m_namespaceURI(namespaceURI) | 232 , m_namespaceURI(namespaceURI) |
231 , m_isDocumentFragmentNode(false) | 233 , m_isDocumentFragmentNode(false) |
232 { | 234 { |
233 } | 235 } |
234 | 236 |
235 RefPtr<ContainerNode> m_node; | 237 RefPtrWillBeMember<ContainerNode> m_node; |
236 | 238 |
237 AtomicString m_tokenLocalName; | 239 AtomicString m_tokenLocalName; |
238 Vector<Attribute> m_tokenAttributes; | 240 Vector<Attribute> m_tokenAttributes; |
239 AtomicString m_namespaceURI; | 241 AtomicString m_namespaceURI; |
240 bool m_isDocumentFragmentNode; | 242 bool m_isDocumentFragmentNode; |
241 }; | 243 }; |
242 | 244 |
243 } // namespace WebCore | 245 } // namespace WebCore |
244 | 246 |
245 #endif // HTMLStackItem_h | 247 #endif // HTMLStackItem_h |
OLD | NEW |