| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 namespace blink { | 85 namespace blink { |
| 86 | 86 |
| 87 // Note: These are intentionally ordered so that when we concatonate | 87 // Note: These are intentionally ordered so that when we concatonate |
| 88 // strings and whitespaces the resulting whitespace is ws = min(ws1, ws2). | 88 // strings and whitespaces the resulting whitespace is ws = min(ws1, ws2). |
| 89 enum WhitespaceMode { | 89 enum WhitespaceMode { |
| 90 WhitespaceUnknown, | 90 WhitespaceUnknown, |
| 91 NotAllWhitespace, | 91 NotAllWhitespace, |
| 92 AllWhitespace, | 92 AllWhitespace, |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 enum FlushMode { | |
| 96 // Flush pending text. Flush queued tasks. | |
| 97 FlushAlways, | |
| 98 | |
| 99 // Flush pending text if node has length limit. Flush queued tasks. | |
| 100 FlushIfAtTextLimit, | |
| 101 }; | |
| 102 | |
| 103 class AtomicHTMLToken; | 95 class AtomicHTMLToken; |
| 104 class Document; | 96 class Document; |
| 105 class Element; | 97 class Element; |
| 106 class HTMLFormElement; | 98 class HTMLFormElement; |
| 107 | 99 |
| 108 class HTMLConstructionSite FINAL { | 100 class HTMLConstructionSite FINAL { |
| 109 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); | 101 WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); |
| 110 DISALLOW_ALLOCATION(); | 102 DISALLOW_ALLOCATION(); |
| 111 public: | 103 public: |
| 112 HTMLConstructionSite(Document*, ParserContentPolicy); | 104 HTMLConstructionSite(Document*, ParserContentPolicy); |
| 113 HTMLConstructionSite(DocumentFragment*, ParserContentPolicy); | 105 HTMLConstructionSite(DocumentFragment*, ParserContentPolicy); |
| 114 ~HTMLConstructionSite(); | 106 ~HTMLConstructionSite(); |
| 115 void trace(Visitor*); | 107 void trace(Visitor*); |
| 116 | 108 |
| 117 void detach(); | 109 void detach(); |
| 118 | 110 |
| 119 // executeQueuedTasks empties the queue but does not flush pending text. | 111 // executeQueuedTasks empties the queue but does not flush pending text. |
| 120 // NOTE: Possible reentrancy via JavaScript execution. | 112 // NOTE: Possible reentrancy via JavaScript execution. |
| 121 void executeQueuedTasks(); | 113 void executeQueuedTasks(); |
| 122 | 114 |
| 123 // flushPendingText turns pending text into queued Text insertions, but does
not execute them. | 115 // flushPendingText turns pending text into queued Text insertions, but does
not execute them. |
| 124 void flushPendingText(FlushMode); | 116 void flushPendingText(); |
| 125 | 117 |
| 126 // Called before every token in HTMLTreeBuilder::processToken, thus inlined: | 118 // Called before every token in HTMLTreeBuilder::processToken, thus inlined: |
| 127 void flush(FlushMode mode) | 119 void flush() |
| 128 { | 120 { |
| 129 if (!hasPendingTasks()) | 121 if (!hasPendingTasks()) |
| 130 return; | 122 return; |
| 131 flushPendingText(mode); | 123 flushPendingText(); |
| 132 executeQueuedTasks(); // NOTE: Possible reentrancy via JavaScript execut
ion. | 124 executeQueuedTasks(); // NOTE: Possible reentrancy via JavaScript execut
ion. |
| 133 ASSERT(mode == FlushIfAtTextLimit || !hasPendingTasks()); | 125 ASSERT(!hasPendingTasks()); |
| 134 } | 126 } |
| 135 | 127 |
| 136 bool hasPendingTasks() | 128 bool hasPendingTasks() |
| 137 { | 129 { |
| 138 return !m_pendingText.isEmpty() || !m_taskQueue.isEmpty(); | 130 return !m_pendingText.isEmpty() || !m_taskQueue.isEmpty(); |
| 139 } | 131 } |
| 140 | 132 |
| 141 void setDefaultCompatibilityMode(); | 133 void setDefaultCompatibilityMode(); |
| 142 void processEndOfFile(); | 134 void processEndOfFile(); |
| 143 void finishedParsing(); | 135 void finishedParsing(); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // "whenever a node would be inserted into the current node, it must instead | 307 // "whenever a node would be inserted into the current node, it must instead |
| 316 // be foster parented." This flag tracks whether we're in that state. | 308 // be foster parented." This flag tracks whether we're in that state. |
| 317 bool m_redirectAttachToFosterParent; | 309 bool m_redirectAttachToFosterParent; |
| 318 | 310 |
| 319 bool m_inQuirksMode; | 311 bool m_inQuirksMode; |
| 320 }; | 312 }; |
| 321 | 313 |
| 322 } // namespace blink | 314 } // namespace blink |
| 323 | 315 |
| 324 #endif | 316 #endif |
| OLD | NEW |