| 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 22 matching lines...) Expand all Loading... |
| 33 #include "core/html/parser/AtomicHTMLToken.h" | 33 #include "core/html/parser/AtomicHTMLToken.h" |
| 34 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
| 35 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
| 36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 37 #include "wtf/text/AtomicString.h" | 37 #include "wtf/text/AtomicString.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class ContainerNode; | 41 class ContainerNode; |
| 42 | 42 |
| 43 class HTMLStackItem : public RefCountedWillBeGarbageCollectedFinalized<HTMLStack
Item> { | 43 class HTMLStackItem : public GarbageCollectedFinalized<HTMLStackItem> { |
| 44 public: | 44 public: |
| 45 enum ItemType { | 45 enum ItemType { |
| 46 ItemForContextElement, | 46 ItemForContextElement, |
| 47 ItemForDocumentFragmentNode | 47 ItemForDocumentFragmentNode |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Used by document fragment node and context element. | 50 // Used by document fragment node and context element. |
| 51 static PassRefPtrWillBeRawPtr<HTMLStackItem> create(PassRefPtrWillBeRawPtr<C
ontainerNode> node, ItemType type) | 51 static RawPtr<HTMLStackItem> create(RawPtr<ContainerNode> node, ItemType typ
e) |
| 52 { | 52 { |
| 53 return adoptRefWillBeNoop(new HTMLStackItem(node, type)); | 53 return new HTMLStackItem(node, type); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Used by HTMLElementStack and HTMLFormattingElementList. | 56 // Used by HTMLElementStack and HTMLFormattingElementList. |
| 57 static PassRefPtrWillBeRawPtr<HTMLStackItem> create(PassRefPtrWillBeRawPtr<C
ontainerNode> node, AtomicHTMLToken* token, const AtomicString& namespaceURI = H
TMLNames::xhtmlNamespaceURI) | 57 static RawPtr<HTMLStackItem> create(RawPtr<ContainerNode> node, AtomicHTMLTo
ken* token, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespaceURI) |
| 58 { | 58 { |
| 59 return adoptRefWillBeNoop(new HTMLStackItem(node, token, namespaceURI)); | 59 return new HTMLStackItem(node, token, namespaceURI); |
| 60 } | 60 } |
| 61 | 61 |
| 62 Element* element() const { return toElement(m_node.get()); } | 62 Element* element() const { return toElement(m_node.get()); } |
| 63 ContainerNode* node() const { return m_node.get(); } | 63 ContainerNode* node() const { return m_node.get(); } |
| 64 | 64 |
| 65 bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; } | 65 bool isDocumentFragmentNode() const { return m_isDocumentFragmentNode; } |
| 66 bool isElementNode() const { return !m_isDocumentFragmentNode; } | 66 bool isElementNode() const { return !m_isDocumentFragmentNode; } |
| 67 | 67 |
| 68 const AtomicString& namespaceURI() const { return m_namespaceURI; } | 68 const AtomicString& namespaceURI() const { return m_namespaceURI; } |
| 69 const AtomicString& localName() const { return m_tokenLocalName; } | 69 const AtomicString& localName() const { return m_tokenLocalName; } |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 || tagName == HTMLNames::titleTag | 205 || tagName == HTMLNames::titleTag |
| 206 || tagName == HTMLNames::trTag | 206 || tagName == HTMLNames::trTag |
| 207 || tagName == HTMLNames::ulTag | 207 || tagName == HTMLNames::ulTag |
| 208 || tagName == HTMLNames::wbrTag | 208 || tagName == HTMLNames::wbrTag |
| 209 || tagName == HTMLNames::xmpTag; | 209 || tagName == HTMLNames::xmpTag; |
| 210 } | 210 } |
| 211 | 211 |
| 212 DEFINE_INLINE_TRACE() { visitor->trace(m_node); } | 212 DEFINE_INLINE_TRACE() { visitor->trace(m_node); } |
| 213 | 213 |
| 214 private: | 214 private: |
| 215 HTMLStackItem(PassRefPtrWillBeRawPtr<ContainerNode> node, ItemType type) | 215 HTMLStackItem(RawPtr<ContainerNode> node, ItemType type) |
| 216 : m_node(node) | 216 : m_node(node) |
| 217 { | 217 { |
| 218 switch (type) { | 218 switch (type) { |
| 219 case ItemForDocumentFragmentNode: | 219 case ItemForDocumentFragmentNode: |
| 220 m_isDocumentFragmentNode = true; | 220 m_isDocumentFragmentNode = true; |
| 221 break; | 221 break; |
| 222 case ItemForContextElement: | 222 case ItemForContextElement: |
| 223 m_tokenLocalName = element()->localName(); | 223 m_tokenLocalName = element()->localName(); |
| 224 m_namespaceURI = element()->namespaceURI(); | 224 m_namespaceURI = element()->namespaceURI(); |
| 225 m_isDocumentFragmentNode = false; | 225 m_isDocumentFragmentNode = false; |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 HTMLStackItem(PassRefPtrWillBeRawPtr<ContainerNode> node, AtomicHTMLToken* t
oken, const AtomicString& namespaceURI = HTMLNames::xhtmlNamespaceURI) | 230 HTMLStackItem(RawPtr<ContainerNode> node, AtomicHTMLToken* token, const Atom
icString& namespaceURI = HTMLNames::xhtmlNamespaceURI) |
| 231 : m_node(node) | 231 : m_node(node) |
| 232 , m_tokenLocalName(token->name()) | 232 , m_tokenLocalName(token->name()) |
| 233 , m_tokenAttributes(token->attributes()) | 233 , m_tokenAttributes(token->attributes()) |
| 234 , m_namespaceURI(namespaceURI) | 234 , m_namespaceURI(namespaceURI) |
| 235 , m_isDocumentFragmentNode(false) | 235 , m_isDocumentFragmentNode(false) |
| 236 { | 236 { |
| 237 } | 237 } |
| 238 | 238 |
| 239 RefPtrWillBeMember<ContainerNode> m_node; | 239 Member<ContainerNode> m_node; |
| 240 | 240 |
| 241 AtomicString m_tokenLocalName; | 241 AtomicString m_tokenLocalName; |
| 242 Vector<Attribute> m_tokenAttributes; | 242 Vector<Attribute> m_tokenAttributes; |
| 243 AtomicString m_namespaceURI; | 243 AtomicString m_namespaceURI; |
| 244 bool m_isDocumentFragmentNode; | 244 bool m_isDocumentFragmentNode; |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 } // namespace blink | 247 } // namespace blink |
| 248 | 248 |
| 249 #endif // HTMLStackItem_h | 249 #endif // HTMLStackItem_h |
| OLD | NEW |