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