| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "core/fetch/ResourceClient.h" | 24 #include "core/fetch/ResourceClient.h" |
| 25 #include "core/fetch/ResourcePtr.h" | 25 #include "core/fetch/ResourcePtr.h" |
| 26 #include "wtf/text/TextPosition.h" | 26 #include "wtf/text/TextPosition.h" |
| 27 #include "wtf/text/WTFString.h" | 27 #include "wtf/text/WTFString.h" |
| 28 | 28 |
| 29 namespace WebCore { | 29 namespace WebCore { |
| 30 | 30 |
| 31 class ScriptResource; | 31 class ScriptResource; |
| 32 class ContainerNode; | 32 class ContainerNode; |
| 33 class Document; | |
| 34 class Element; | 33 class Element; |
| 35 class ScriptLoaderClient; | 34 class ScriptLoaderClient; |
| 36 class ScriptSourceCode; | 35 class ScriptSourceCode; |
| 37 | 36 |
| 38 | 37 |
| 39 class ScriptLoader FINAL : private ResourceClient { | 38 class ScriptLoader FINAL : private ResourceClient { |
| 40 public: | 39 public: |
| 41 static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool
isEvaluated); | 40 static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool
isEvaluated); |
| 42 virtual ~ScriptLoader(); | 41 virtual ~ScriptLoader(); |
| 43 | 42 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 65 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } | 64 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } |
| 66 bool isParserInserted() const { return m_parserInserted; } | 65 bool isParserInserted() const { return m_parserInserted; } |
| 67 bool alreadyStarted() const { return m_alreadyStarted; } | 66 bool alreadyStarted() const { return m_alreadyStarted; } |
| 68 bool forceAsync() const { return m_forceAsync; } | 67 bool forceAsync() const { return m_forceAsync; } |
| 69 | 68 |
| 70 // Helper functions used by our parent classes. | 69 // Helper functions used by our parent classes. |
| 71 void didNotifySubtreeInsertionsToDocument(); | 70 void didNotifySubtreeInsertionsToDocument(); |
| 72 void childrenChanged(); | 71 void childrenChanged(); |
| 73 void handleSourceAttribute(const String& sourceUrl); | 72 void handleSourceAttribute(const String& sourceUrl); |
| 74 void handleAsyncAttribute(); | 73 void handleAsyncAttribute(); |
| 75 void cancel(Document* contextDocument); | |
| 76 | 74 |
| 77 private: | 75 private: |
| 78 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); | 76 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); |
| 79 | 77 |
| 80 bool ignoresLoadRequest() const; | 78 bool ignoresLoadRequest() const; |
| 81 bool isScriptForEventSupported() const; | 79 bool isScriptForEventSupported() const; |
| 82 | 80 |
| 83 bool fetchScript(const String& sourceUrl); | 81 bool fetchScript(const String& sourceUrl); |
| 84 void stopLoadRequest(); | 82 void stopLoadRequest(); |
| 85 | 83 |
| 86 ScriptLoaderClient* client() const; | 84 ScriptLoaderClient* client() const; |
| 87 | 85 |
| 88 // ResourceClient | 86 // ResourceClient |
| 89 virtual void notifyFinished(Resource*) OVERRIDE; | 87 virtual void notifyFinished(Resource*) OVERRIDE; |
| 90 | 88 |
| 91 enum FinishType { | |
| 92 FinishSuccessfully, | |
| 93 FinishWithCancel, | |
| 94 FinishWithError | |
| 95 }; | |
| 96 | |
| 97 void finishLoading(Document* contextDocument, FinishType); | |
| 98 | |
| 99 Element* m_element; | 89 Element* m_element; |
| 100 ResourcePtr<ScriptResource> m_resource; | 90 ResourcePtr<ScriptResource> m_resource; |
| 101 WTF::OrdinalNumber m_startLineNumber; | 91 WTF::OrdinalNumber m_startLineNumber; |
| 102 bool m_parserInserted : 1; | 92 bool m_parserInserted : 1; |
| 103 bool m_isExternalScript : 1; | 93 bool m_isExternalScript : 1; |
| 104 bool m_alreadyStarted : 1; | 94 bool m_alreadyStarted : 1; |
| 105 bool m_haveFiredLoad : 1; | 95 bool m_haveFiredLoad : 1; |
| 106 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 96 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
| 107 bool m_readyToBeParserExecuted : 1; | 97 bool m_readyToBeParserExecuted : 1; |
| 108 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 98 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 109 bool m_forceAsync : 1; | 99 bool m_forceAsync : 1; |
| 110 bool m_willExecuteInOrder : 1; | 100 bool m_willExecuteInOrder : 1; |
| 111 String m_characterEncoding; | 101 String m_characterEncoding; |
| 112 String m_fallbackCharacterEncoding; | 102 String m_fallbackCharacterEncoding; |
| 113 }; | 103 }; |
| 114 | 104 |
| 115 ScriptLoader* toScriptLoaderIfPossible(Element*); | 105 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 116 | 106 |
| 117 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) | 107 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) |
| 118 { | 108 { |
| 119 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); | 109 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); |
| 120 } | 110 } |
| 121 | 111 |
| 122 } | 112 } |
| 123 | 113 |
| 124 | 114 |
| 125 #endif | 115 #endif |
| OLD | NEW |