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, 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2014 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 String takeLeadingWhitespace() | 181 String takeLeadingWhitespace() |
182 { | 182 { |
183 return takeLeading<isHTMLSpace<UChar>>(); | 183 return takeLeading<isHTMLSpace<UChar>>(); |
184 } | 184 } |
185 | 185 |
186 void skipLeadingNonWhitespace() | 186 void skipLeadingNonWhitespace() |
187 { | 187 { |
188 skipLeading<isNotHTMLSpace<UChar>>(); | 188 skipLeading<isNotHTMLSpace<UChar>>(); |
189 } | 189 } |
190 | 190 |
| 191 void skipRemaining() |
| 192 { |
| 193 m_current = m_end; |
| 194 } |
| 195 |
191 String takeRemaining() | 196 String takeRemaining() |
192 { | 197 { |
193 ASSERT(!isEmpty()); | 198 ASSERT(!isEmpty()); |
194 unsigned start = m_current; | 199 unsigned start = m_current; |
195 m_current = m_end; | 200 m_current = m_end; |
196 // Notice that substring is smart enough to return *this when start == 0
. | 201 // Notice that substring is smart enough to return *this when start == 0
. |
197 return String(m_characters->substring(start, m_end - start)); | 202 return String(m_characters->substring(start, m_end - start)); |
198 } | 203 } |
199 | 204 |
200 void giveRemainingTo(StringBuilder& recipient) | 205 void giveRemainingTo(StringBuilder& recipient) |
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 return; | 2286 return; |
2282 defaultForInitial(); | 2287 defaultForInitial(); |
2283 // Fall through. | 2288 // Fall through. |
2284 } | 2289 } |
2285 case BeforeHTMLMode: { | 2290 case BeforeHTMLMode: { |
2286 ASSERT(getInsertionMode() == BeforeHTMLMode); | 2291 ASSERT(getInsertionMode() == BeforeHTMLMode); |
2287 buffer.skipLeadingWhitespace(); | 2292 buffer.skipLeadingWhitespace(); |
2288 if (buffer.isEmpty()) | 2293 if (buffer.isEmpty()) |
2289 return; | 2294 return; |
2290 defaultForBeforeHTML(); | 2295 defaultForBeforeHTML(); |
| 2296 if (m_parser->isStopped()) { |
| 2297 buffer.skipRemaining(); |
| 2298 return; |
| 2299 } |
2291 // Fall through. | 2300 // Fall through. |
2292 } | 2301 } |
2293 case BeforeHeadMode: { | 2302 case BeforeHeadMode: { |
2294 ASSERT(getInsertionMode() == BeforeHeadMode); | 2303 ASSERT(getInsertionMode() == BeforeHeadMode); |
2295 buffer.skipLeadingWhitespace(); | 2304 buffer.skipLeadingWhitespace(); |
2296 if (buffer.isEmpty()) | 2305 if (buffer.isEmpty()) |
2297 return; | 2306 return; |
2298 defaultForBeforeHead(); | 2307 defaultForBeforeHead(); |
2299 // Fall through. | 2308 // Fall through. |
2300 } | 2309 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 ASSERT(m_isAttached); | 2821 ASSERT(m_isAttached); |
2813 // Warning, this may detach the parser. Do not do anything else after this. | 2822 // Warning, this may detach the parser. Do not do anything else after this. |
2814 m_tree.finishedParsing(); | 2823 m_tree.finishedParsing(); |
2815 } | 2824 } |
2816 | 2825 |
2817 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2826 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
2818 { | 2827 { |
2819 } | 2828 } |
2820 | 2829 |
2821 } // namespace blink | 2830 } // namespace blink |
OLD | NEW |