Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 } | 66 } |
| 67 | 67 |
| 68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) | 68 void HTMLScriptElement::childrenChanged(const ChildrenChange& change) |
| 69 { | 69 { |
| 70 HTMLElement::childrenChanged(change); | 70 HTMLElement::childrenChanged(change); |
| 71 m_loader->childrenChanged(); | 71 m_loader->childrenChanged(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) | 74 void HTMLScriptElement::didMoveToNewDocument(Document& oldDocument) |
| 75 { | 75 { |
| 76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument(). get(); | 76 RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument(). get(); |
|
sof
2015/02/10 09:47:49
Could you add
ScriptRunner::moveScriptToNewDoc
| |
| 77 if (!contextDocument) { | 77 if (!contextDocument) { |
| 78 // Document's contextDocument() method will return no Document if the | 78 // Document's contextDocument() method will return no Document if the |
| 79 // following conditions both hold: | 79 // following conditions both hold: |
| 80 // | 80 // |
| 81 // - The Document wasn't created with an explicit context document | 81 // - The Document wasn't created with an explicit context document |
| 82 // and that document is otherwise kept alive. | 82 // and that document is otherwise kept alive. |
| 83 // - The Document itself is detached from its frame. | 83 // - The Document itself is detached from its frame. |
| 84 // | 84 // |
| 85 // The script element's loader is in that case moved to document() and | 85 // The script element's loader is in that case moved to document() and |
| 86 // its script runner, which is the non-null Document that contextDocumen t() | 86 // its script runner, which is the non-null Document that contextDocumen t() |
| 87 // would return if not detached. | 87 // would return if not detached. |
| 88 ASSERT(!document().frame()); | 88 ASSERT(!document().frame()); |
| 89 contextDocument = &document(); | 89 contextDocument = &document(); |
| 90 } | 90 } |
| 91 oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRu nner(), m_loader.get()); | 91 RefPtrWillBeRawPtr<Document> oldContextDocument = oldDocument.contextDocumen t().get(); |
| 92 if (!oldContextDocument) | |
| 93 oldContextDocument = &oldDocument; | |
| 94 if (oldContextDocument != contextDocument) | |
| 95 oldContextDocument->scriptRunner()->movePendingAsyncScript(contextDocume nt->scriptRunner(), m_loader.get()); | |
| 92 HTMLElement::didMoveToNewDocument(oldDocument); | 96 HTMLElement::didMoveToNewDocument(oldDocument); |
| 93 } | 97 } |
| 94 | 98 |
| 95 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | 99 void HTMLScriptElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) |
| 96 { | 100 { |
| 97 if (name == srcAttr) | 101 if (name == srcAttr) |
| 98 m_loader->handleSourceAttribute(value); | 102 m_loader->handleSourceAttribute(value); |
| 99 else if (name == asyncAttr) | 103 else if (name == asyncAttr) |
| 100 m_loader->handleAsyncAttribute(); | 104 m_loader->handleAsyncAttribute(); |
| 101 else | 105 else |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader- >alreadyStarted())); | 230 return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader- >alreadyStarted())); |
| 227 } | 231 } |
| 228 | 232 |
| 229 void HTMLScriptElement::trace(Visitor* visitor) | 233 void HTMLScriptElement::trace(Visitor* visitor) |
| 230 { | 234 { |
| 231 visitor->trace(m_loader); | 235 visitor->trace(m_loader); |
| 232 HTMLElement::trace(visitor); | 236 HTMLElement::trace(visitor); |
| 233 } | 237 } |
| 234 | 238 |
| 235 } | 239 } |
| OLD | NEW |