| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 // after executing all other queued tasks. | 314 // after executing all other queued tasks. |
| 315 const size_t size = m_taskQueue.size(); | 315 const size_t size = m_taskQueue.size(); |
| 316 if (!size) | 316 if (!size) |
| 317 return; | 317 return; |
| 318 | 318 |
| 319 // Copy the task queue into a local variable in case executeTask re-enters the | 319 // Copy the task queue into a local variable in case executeTask re-enters the |
| 320 // parser. | 320 // parser. |
| 321 TaskQueue queue; | 321 TaskQueue queue; |
| 322 queue.swap(m_taskQueue); | 322 queue.swap(m_taskQueue); |
| 323 | 323 |
| 324 for (size_t i = 0; i < size; ++i) | 324 for (auto& task : queue) |
| 325 executeTask(queue[i]); | 325 executeTask(task); |
| 326 | 326 |
| 327 // We might be detached now. | 327 // We might be detached now. |
| 328 } | 328 } |
| 329 | 329 |
| 330 HTMLConstructionSite::HTMLConstructionSite( | 330 HTMLConstructionSite::HTMLConstructionSite( |
| 331 HTMLParserReentryPermit* reentryPermit, | 331 HTMLParserReentryPermit* reentryPermit, |
| 332 Document& document, | 332 Document& document, |
| 333 ParserContentPolicy parserContentPolicy) | 333 ParserContentPolicy parserContentPolicy) |
| 334 : m_reentryPermit(reentryPermit), | 334 : m_reentryPermit(reentryPermit), |
| 335 m_document(&document), | 335 m_document(&document), |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 executeQueuedTasks(); | 400 executeQueuedTasks(); |
| 401 element->insertedByParser(); | 401 element->insertedByParser(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement( | 404 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement( |
| 405 AtomicHTMLToken* token, | 405 AtomicHTMLToken* token, |
| 406 Element* element) { | 406 Element* element) { |
| 407 if (token->attributes().isEmpty()) | 407 if (token->attributes().isEmpty()) |
| 408 return; | 408 return; |
| 409 | 409 |
| 410 for (unsigned i = 0; i < token->attributes().size(); ++i) { | 410 for (const auto& tokenAttribute : token->attributes()) { |
| 411 const Attribute& tokenAttribute = token->attributes().at(i); | |
| 412 if (element->attributesWithoutUpdate().findIndex(tokenAttribute.name()) == | 411 if (element->attributesWithoutUpdate().findIndex(tokenAttribute.name()) == |
| 413 kNotFound) | 412 kNotFound) |
| 414 element->setAttribute(tokenAttribute.name(), tokenAttribute.value()); | 413 element->setAttribute(tokenAttribute.name(), tokenAttribute.value()); |
| 415 } | 414 } |
| 416 } | 415 } |
| 417 | 416 |
| 418 void HTMLConstructionSite::insertHTMLHtmlStartTagInBody( | 417 void HTMLConstructionSite::insertHTMLHtmlStartTagInBody( |
| 419 AtomicHTMLToken* token) { | 418 AtomicHTMLToken* token) { |
| 420 // Fragments do not have a root HTML element, so any additional HTML elements | 419 // Fragments do not have a root HTML element, so any additional HTML elements |
| 421 // encountered during fragment parsing should be ignored. | 420 // encountered during fragment parsing should be ignored. |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 ASSERT(task.parent); | 1071 ASSERT(task.parent); |
| 1073 queueTask(task); | 1072 queueTask(task); |
| 1074 } | 1073 } |
| 1075 | 1074 |
| 1076 DEFINE_TRACE(HTMLConstructionSite::PendingText) { | 1075 DEFINE_TRACE(HTMLConstructionSite::PendingText) { |
| 1077 visitor->trace(parent); | 1076 visitor->trace(parent); |
| 1078 visitor->trace(nextChild); | 1077 visitor->trace(nextChild); |
| 1079 } | 1078 } |
| 1080 | 1079 |
| 1081 } // namespace blink | 1080 } // namespace blink |
| OLD | NEW |