| 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 10 matching lines...) Expand all Loading... |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef HTMLConstructionSite_h | 27 #ifndef HTMLConstructionSite_h |
| 28 #define HTMLConstructionSite_h | 28 #define HTMLConstructionSite_h |
| 29 | 29 |
| 30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
| 31 #include "core/dom/ParserContentPolicy.h" | |
| 32 #include "core/html/parser/HTMLElementStack.h" | 31 #include "core/html/parser/HTMLElementStack.h" |
| 33 #include "wtf/Noncopyable.h" | 32 #include "wtf/Noncopyable.h" |
| 34 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
| 36 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
| 37 #include "wtf/text/StringBuilder.h" | 36 #include "wtf/text/StringBuilder.h" |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 | 39 |
| 41 struct HTMLConstructionSiteTask { | 40 struct HTMLConstructionSiteTask { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 class AtomicHTMLToken; | 82 class AtomicHTMLToken; |
| 84 class Document; | 83 class Document; |
| 85 class Element; | 84 class Element; |
| 86 | 85 |
| 87 class HTMLConstructionSite FINAL { | 86 class HTMLConstructionSite FINAL { |
| 88 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); | 87 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); |
| 89 DISALLOW_ALLOCATION(); | 88 DISALLOW_ALLOCATION(); |
| 90 public: | 89 public: |
| 91 HTMLConstructionSite(Document*, ParserContentPolicy); | 90 explicit HTMLConstructionSite(Document*); |
| 92 HTMLConstructionSite(DocumentFragment*, ParserContentPolicy); | 91 explicit HTMLConstructionSite(DocumentFragment*); |
| 93 ~HTMLConstructionSite(); | 92 ~HTMLConstructionSite(); |
| 94 void trace(Visitor*); | 93 void trace(Visitor*); |
| 95 | 94 |
| 96 void detach(); | 95 void detach(); |
| 97 | 96 |
| 98 // executeQueuedTasks empties the queue but does not flush pending text. | 97 // executeQueuedTasks empties the queue but does not flush pending text. |
| 99 // NOTE: Possible reentrancy via JavaScript execution. | 98 // NOTE: Possible reentrancy via JavaScript execution. |
| 100 void executeQueuedTasks(); | 99 void executeQueuedTasks(); |
| 101 | 100 |
| 102 // flushPendingText turns pending text into queued Text insertions, but does
not execute them. | 101 // flushPendingText turns pending text into queued Text insertions, but does
not execute them. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 124 void insertSelfClosingHTMLElement(AtomicHTMLToken*); | 123 void insertSelfClosingHTMLElement(AtomicHTMLToken*); |
| 125 void insertScriptElement(AtomicHTMLToken*); | 124 void insertScriptElement(AtomicHTMLToken*); |
| 126 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); | 125 void insertTextNode(const String&, WhitespaceMode = WhitespaceUnknown); |
| 127 | 126 |
| 128 bool isEmpty() const { return !m_openElements.stackDepth(); } | 127 bool isEmpty() const { return !m_openElements.stackDepth(); } |
| 129 Element* currentElement() const { return m_openElements.top(); } | 128 Element* currentElement() const { return m_openElements.top(); } |
| 130 ContainerNode* currentNode() const { return m_openElements.topNode(); } | 129 ContainerNode* currentNode() const { return m_openElements.topNode(); } |
| 131 Document& ownerDocumentForCurrentNode(); | 130 Document& ownerDocumentForCurrentNode(); |
| 132 HTMLElementStack* openElements() const { return &m_openElements; } | 131 HTMLElementStack* openElements() const { return &m_openElements; } |
| 133 | 132 |
| 134 ParserContentPolicy parserContentPolicy() { return m_parserContentPolicy; } | |
| 135 | |
| 136 private: | 133 private: |
| 137 // In the common case, this queue will have only one task because most | 134 // In the common case, this queue will have only one task because most |
| 138 // tokens produce only one DOM mutation. | 135 // tokens produce only one DOM mutation. |
| 139 typedef WillBeHeapVector<HTMLConstructionSiteTask, 1> TaskQueue; | 136 typedef WillBeHeapVector<HTMLConstructionSiteTask, 1> TaskQueue; |
| 140 | 137 |
| 141 void attachLater(ContainerNode* parent, PassRefPtrWillBeRawPtr<Node> child,
bool selfClosing = false); | 138 void attachLater(ContainerNode* parent, PassRefPtrWillBeRawPtr<Node> child,
bool selfClosing = false); |
| 142 | 139 |
| 143 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(AtomicHTMLToken*); | 140 PassRefPtrWillBeRawPtr<HTMLElement> createHTMLElement(AtomicHTMLToken*); |
| 144 PassRefPtrWillBeRawPtr<Element> createElement(AtomicHTMLToken*, const Atomic
String& namespaceURI); | 141 PassRefPtrWillBeRawPtr<Element> createElement(AtomicHTMLToken*, const Atomic
String& namespaceURI); |
| 145 | 142 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 196 |
| 200 void trace(Visitor*); | 197 void trace(Visitor*); |
| 201 | 198 |
| 202 RefPtrWillBeMember<ContainerNode> parent; | 199 RefPtrWillBeMember<ContainerNode> parent; |
| 203 RefPtrWillBeMember<Node> nextChild; | 200 RefPtrWillBeMember<Node> nextChild; |
| 204 StringBuilder stringBuilder; | 201 StringBuilder stringBuilder; |
| 205 WhitespaceMode whitespaceMode; | 202 WhitespaceMode whitespaceMode; |
| 206 }; | 203 }; |
| 207 | 204 |
| 208 PendingText m_pendingText; | 205 PendingText m_pendingText; |
| 209 | |
| 210 ParserContentPolicy m_parserContentPolicy; | |
| 211 }; | 206 }; |
| 212 | 207 |
| 213 } // namespace blink | 208 } // namespace blink |
| 214 | 209 |
| 215 #endif | 210 #endif |
| OLD | NEW |