Chromium Code Reviews| 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 645 | 645 |
| 646 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) | 646 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) |
| 647 { | 647 { |
| 648 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h tml#already-started | 648 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h tml#already-started |
| 649 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen t | 649 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen t |
| 650 // For createContextualFragment, the specifications say to mark it parser-in serted and already-started and later unmark them. | 650 // For createContextualFragment, the specifications say to mark it parser-in serted and already-started and later unmark them. |
| 651 // However, we short circuit that logic to avoid the subtree traversal to fi nd script elements since scripts can never see | 651 // However, we short circuit that logic to avoid the subtree traversal to fi nd script elements since scripts can never see |
| 652 // those flags or effects thereof. | 652 // those flags or effects thereof. |
| 653 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn dDoNotMarkAlreadyStarted; | 653 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn dDoNotMarkAlreadyStarted; |
| 654 const bool alreadyStarted = m_isParsingFragment && parserInserted; | 654 const bool alreadyStarted = m_isParsingFragment && parserInserted; |
| 655 RefPtrWillBeRawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ow nerDocumentForCurrentNode(), parserInserted, alreadyStarted); | 655 // TODO(csharrison): This logic only works if the tokenizer/parser was not |
| 656 // blocked waiting for scripts when the element was inserted. This usually | |
| 657 // fails for instance, on second document.write if a script writes twice in | |
| 658 // a row. To fix this, the parser might have to keep track of raw string | |
| 659 // position. | |
| 660 const bool createdDuringDocumentWrite = ownerDocumentForCurrentNode().isInDo cumentWrite(); | |
| 661 RefPtrWillBeRawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ow nerDocumentForCurrentNode(), parserInserted, alreadyStarted, createdDuringDocume ntWrite); | |
|
kouhei (in TOK)
2016/03/18 02:24:26
I think this is ok in this CL, but I'd appreciate
Charlie Harrison
2016/03/18 14:10:47
I'll do this refactor in this CL, but I'm hitting
kouhei (in TOK)
2016/03/22 04:18:39
See make_element_factory.py
https://code.google.co
| |
| 656 setAttributes(element.get(), token, m_parserContentPolicy); | 662 setAttributes(element.get(), token, m_parserContentPolicy); |
| 657 if (scriptingContentIsAllowed(m_parserContentPolicy)) | 663 if (scriptingContentIsAllowed(m_parserContentPolicy)) |
| 658 attachLater(currentNode(), element); | 664 attachLater(currentNode(), element); |
| 659 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 665 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
| 660 } | 666 } |
| 661 | 667 |
| 662 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At omicString& namespaceURI) | 668 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At omicString& namespaceURI) |
| 663 { | 669 { |
| 664 ASSERT(token->type() == HTMLToken::StartTag); | 670 ASSERT(token->type() == HTMLToken::StartTag); |
| 665 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. | 671 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 871 queueTask(task); | 877 queueTask(task); |
| 872 } | 878 } |
| 873 | 879 |
| 874 DEFINE_TRACE(HTMLConstructionSite::PendingText) | 880 DEFINE_TRACE(HTMLConstructionSite::PendingText) |
| 875 { | 881 { |
| 876 visitor->trace(parent); | 882 visitor->trace(parent); |
| 877 visitor->trace(nextChild); | 883 visitor->trace(nextChild); |
| 878 } | 884 } |
| 879 | 885 |
| 880 } // namespace blink | 886 } // namespace blink |
| OLD | NEW |