| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 String scriptCharset() const { return m_characterEncoding; } | 55 String scriptCharset() const { return m_characterEncoding; } |
| 56 String scriptContent() const; | 56 String scriptContent() const; |
| 57 // Returns false if and only if execution was blocked. | 57 // Returns false if and only if execution was blocked. |
| 58 bool executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); | 58 bool executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); |
| 59 virtual void execute(); | 59 virtual void execute(); |
| 60 | 60 |
| 61 // XML parser calls these | 61 // XML parser calls these |
| 62 void dispatchLoadEvent(); | 62 void dispatchLoadEvent(); |
| 63 void dispatchErrorEvent(); | 63 void dispatchErrorEvent(); |
| 64 bool isScriptTypeSupported(LegacyTypeSupport) const; | 64 enum ScriptType { ScriptNone = 0, ScriptJavaScript, ScriptDart }; |
| 65 ScriptType isScriptTypeSupported(LegacyTypeSupport) const; |
| 65 | 66 |
| 66 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } | 67 bool haveFiredLoadEvent() const { return m_haveFiredLoad; } |
| 67 bool willBeParserExecuted() const { return m_willBeParserExecuted; } | 68 bool willBeParserExecuted() const { return m_willBeParserExecuted; } |
| 68 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; } | 69 bool readyToBeParserExecuted() const { return m_readyToBeParserExecuted; } |
| 69 bool willExecuteWhenDocumentFinishedParsing() const { return m_willExecuteWh
enDocumentFinishedParsing; } | 70 bool willExecuteWhenDocumentFinishedParsing() const { return m_willExecuteWh
enDocumentFinishedParsing; } |
| 70 ResourcePtr<ScriptResource> resource() { return m_resource; } | 71 ResourcePtr<ScriptResource> resource() { return m_resource; } |
| 71 | 72 |
| 72 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } | 73 void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFired
Load; } |
| 73 bool isParserInserted() const { return m_parserInserted; } | 74 bool isParserInserted() const { return m_parserInserted; } |
| 74 bool alreadyStarted() const { return m_alreadyStarted; } | 75 bool alreadyStarted() const { return m_alreadyStarted; } |
| 75 bool forceAsync() const { return m_forceAsync; } | 76 bool forceAsync() const { return m_forceAsync; } |
| 76 | 77 |
| 77 // Helper functions used by our parent classes. | 78 // Helper functions used by our parent classes. |
| 78 void didNotifySubtreeInsertionsToDocument(); | 79 void didNotifySubtreeInsertionsToDocument(); |
| 79 void childrenChanged(); | 80 void childrenChanged(); |
| 80 void handleSourceAttribute(const String& sourceUrl); | 81 void handleSourceAttribute(const String& sourceUrl); |
| 81 void handleAsyncAttribute(); | 82 void handleAsyncAttribute(); |
| 82 | 83 |
| 84 WTF::OrdinalNumber startLineNumber() { return m_startLineNumber; } |
| 83 virtual bool isReady() const { return m_pendingScript.isReady(); } | 85 virtual bool isReady() const { return m_pendingScript.isReady(); } |
| 84 | 86 |
| 85 // Clears the connection to the PendingScript (and Element and Resource). | 87 // Clears the connection to the PendingScript (and Element and Resource). |
| 86 void detach(); | 88 void detach(); |
| 87 | 89 |
| 88 protected: | 90 protected: |
| 89 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); | 91 ScriptLoader(Element*, bool createdByParser, bool isEvaluated); |
| 90 | 92 |
| 91 private: | 93 private: |
| 92 bool ignoresLoadRequest() const; | 94 bool ignoresLoadRequest() const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 109 | 111 |
| 110 bool m_parserInserted : 1; | 112 bool m_parserInserted : 1; |
| 111 bool m_isExternalScript : 1; | 113 bool m_isExternalScript : 1; |
| 112 bool m_alreadyStarted : 1; | 114 bool m_alreadyStarted : 1; |
| 113 bool m_haveFiredLoad : 1; | 115 bool m_haveFiredLoad : 1; |
| 114 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 116 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
| 115 bool m_readyToBeParserExecuted : 1; | 117 bool m_readyToBeParserExecuted : 1; |
| 116 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 118 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 117 bool m_forceAsync : 1; | 119 bool m_forceAsync : 1; |
| 118 bool m_willExecuteInOrder : 1; | 120 bool m_willExecuteInOrder : 1; |
| 121 ScriptType m_scriptType; |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 ScriptLoader* toScriptLoaderIfPossible(Element*); | 124 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 122 | 125 |
| 123 } // namespace blink | 126 } // namespace blink |
| 124 | 127 |
| 125 #endif // ScriptLoader_h | 128 #endif // ScriptLoader_h |
| OLD | NEW |