| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 void processEndOfFile(); | 120 void processEndOfFile(); |
| 121 void finishedParsing(); | 121 void finishedParsing(); |
| 122 | 122 |
| 123 void insertHTMLElement(AtomicHTMLToken*); | 123 void insertHTMLElement(AtomicHTMLToken*); |
| 124 void insertSelfClosingHTMLElement(AtomicHTMLToken*); | 124 void insertSelfClosingHTMLElement(AtomicHTMLToken*); |
| 125 void insertScriptElement(AtomicHTMLToken*); | 125 void insertScriptElement(AtomicHTMLToken*); |
| 126 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); | 126 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); |
| 127 | 127 |
| 128 bool isEmpty() const { return !m_openElements.stackDepth(); } | 128 bool isEmpty() const { return !m_openElements.stackDepth(); } |
| 129 HTMLElementStack::ElementRecord* currentElementRecord() const { return m_ope
nElements.topRecord(); } | |
| 130 Element* currentElement() const { return m_openElements.top(); } | 129 Element* currentElement() const { return m_openElements.top(); } |
| 131 ContainerNode* currentNode() const { return m_openElements.topNode(); } | 130 ContainerNode* currentNode() const { return m_openElements.topNode(); } |
| 132 HTMLStackItem* currentStackItem() const { return m_openElements.topStackItem
(); } | |
| 133 HTMLStackItem* oneBelowTop() const { return m_openElements.oneBelowTop(); } | |
| 134 Document& ownerDocumentForCurrentNode(); | 131 Document& ownerDocumentForCurrentNode(); |
| 135 HTMLElementStack* openElements() const { return &m_openElements; } | 132 HTMLElementStack* openElements() const { return &m_openElements; } |
| 136 bool currentIsRootNode() { return m_openElements.topNode() == m_openElements
.rootNode(); } | |
| 137 | |
| 138 Element* head() const { return m_head->element(); } | |
| 139 HTMLStackItem* headStackItem() const { return m_head.get(); } | |
| 140 | 133 |
| 141 ParserContentPolicy parserContentPolicy() { return m_parserContentPolicy; } | 134 ParserContentPolicy parserContentPolicy() { return m_parserContentPolicy; } |
| 142 | 135 |
| 143 private: | 136 private: |
| 144 // In the common case, this queue will have only one task because most | 137 // In the common case, this queue will have only one task because most |
| 145 // tokens produce only one DOM mutation. | 138 // tokens produce only one DOM mutation. |
| 146 typedef WillBeHeapVector<HTMLConstructionSiteTask, 1> TaskQueue; | 139 typedef WillBeHeapVector<HTMLConstructionSiteTask, 1> TaskQueue; |
| 147 | 140 |
| 148 void attachLater(ContainerNode* parent, PassRefPtrWillBeRawPtr<Node> child,
bool selfClosing = false); | 141 void attachLater(ContainerNode* parent, PassRefPtrWillBeRawPtr<Node> child,
bool selfClosing = false); |
| 149 | 142 |
| 150 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(AtomicHTMLToken*); | 143 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(AtomicHTMLToken*); |
| 151 PassRefPtrWillBeRawPtr<Element> createElement(AtomicHTMLToken*, const Atomic
String& namespaceURI); | 144 PassRefPtrWillBeRawPtr<Element> createElement(AtomicHTMLToken*, const Atomic
String& namespaceURI); |
| 152 | 145 |
| 153 void queueTask(const HTMLConstructionSiteTask&); | 146 void queueTask(const HTMLConstructionSiteTask&); |
| 154 | 147 |
| 155 RawPtrWillBeMember<Document> m_document; | 148 RawPtrWillBeMember<Document> m_document; |
| 156 | 149 |
| 157 // This is the root ContainerNode to which the parser attaches all newly | 150 // This is the root ContainerNode to which the parser attaches all newly |
| 158 // constructed nodes. It points to a DocumentFragment when parsing fragments | 151 // constructed nodes. It points to a DocumentFragment when parsing fragments |
| 159 // and a Document in all other cases. | 152 // and a Document in all other cases. |
| 160 RawPtrWillBeMember<ContainerNode> m_attachmentRoot; | 153 RawPtrWillBeMember<ContainerNode> m_attachmentRoot; |
| 161 | 154 |
| 162 RefPtrWillBeMember<HTMLStackItem> m_head; | |
| 163 mutable HTMLElementStack m_openElements; | 155 mutable HTMLElementStack m_openElements; |
| 164 | 156 |
| 165 TaskQueue m_taskQueue; | 157 TaskQueue m_taskQueue; |
| 166 | 158 |
| 167 class PendingText { | 159 class PendingText { |
| 168 DISALLOW_ALLOCATION(); | 160 DISALLOW_ALLOCATION(); |
| 169 public: | 161 public: |
| 170 PendingText() | 162 PendingText() |
| 171 : whitespaceMode(WhitespaceUnknown) | 163 : whitespaceMode(WhitespaceUnknown) |
| 172 { | 164 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 }; | 206 }; |
| 215 | 207 |
| 216 PendingText m_pendingText; | 208 PendingText m_pendingText; |
| 217 | 209 |
| 218 ParserContentPolicy m_parserContentPolicy; | 210 ParserContentPolicy m_parserContentPolicy; |
| 219 }; | 211 }; |
| 220 | 212 |
| 221 } // namespace blink | 213 } // namespace blink |
| 222 | 214 |
| 223 #endif | 215 #endif |
| OLD | NEW |