| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 static bool isMaster(Document*); | 134 static bool isMaster(Document*); |
| 135 | 135 |
| 136 virtual ~HTMLImport() { } | 136 virtual ~HTMLImport() { } |
| 137 | 137 |
| 138 Frame* frame(); | 138 Frame* frame(); |
| 139 Document* master(); | 139 Document* master(); |
| 140 HTMLImportsController* controller(); | 140 HTMLImportsController* controller(); |
| 141 | 141 |
| 142 bool isCreatedByParser() const { return m_createdByParser; } | 142 bool isCreatedByParser() const { return m_createdByParser; } |
| 143 bool isBlockedFromRunningScript() const { return m_state <= BlockedFromRunni
ngScript; } | 143 bool isBlockedFromRunningScript() const { return m_state <= BlockedFromRunni
ngScript; } |
| 144 bool isBlockedFromCreatingDocument() const { return m_state <= BlockedFromCr
eatingDocument; } | |
| 145 bool isBlocked() const { return m_state < Ready; } | 144 bool isBlocked() const { return m_state < Ready; } |
| 146 | 145 |
| 146 bool isBlockedFromCreatingDocument() const; |
| 147 |
| 147 void appendChild(HTMLImport*); | 148 void appendChild(HTMLImport*); |
| 148 | 149 |
| 149 virtual HTMLImportRoot* root() = 0; | 150 virtual HTMLImportRoot* root() = 0; |
| 150 virtual Document* document() const = 0; | 151 virtual Document* document() const = 0; |
| 151 virtual void wasDetachedFromDocument() = 0; | 152 virtual void wasDetachedFromDocument() = 0; |
| 152 virtual void didFinishParsing() = 0; | 153 virtual void didFinishParsing() = 0; |
| 153 virtual bool isDone() const = 0; // FIXME: Should be renamed to haveFinished
Loading() | 154 virtual bool isDone() const = 0; // FIXME: Should be renamed to haveFinished
Loading() |
| 155 virtual bool hasLoader() const = 0; |
| 154 virtual bool ownsLoader() const { return false; } | 156 virtual bool ownsLoader() const { return false; } |
| 155 virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const
{ return 0; } | 157 virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const
{ return 0; } |
| 156 | 158 |
| 157 protected: | 159 protected: |
| 158 enum State { | 160 enum State { |
| 159 BlockedFromCreatingDocument, | |
| 160 BlockedFromRunningScript, | 161 BlockedFromRunningScript, |
| 161 WaitingLoaderOrChildren, | 162 WaitingLoaderOrChildren, |
| 162 Ready | 163 Ready |
| 163 }; | 164 }; |
| 164 | 165 |
| 165 explicit HTMLImport(State state, bool createdByParser = false) | 166 explicit HTMLImport(State state, bool createdByParser = false) |
| 166 : m_state(state) | 167 : m_state(state) |
| 167 , m_createdByParser(createdByParser) | 168 , m_createdByParser(createdByParser) |
| 168 { } | 169 { } |
| 169 | 170 |
| 170 virtual void didUnblockFromCreatingDocument(); | 171 virtual void didUnblockFromCreatingDocument(); |
| 171 virtual void didUnblockFromRunningScript(); | 172 virtual void didUnblockFromRunningScript(); |
| 172 virtual void didBecomeReady(); | 173 virtual void didBecomeReady(); |
| 173 | 174 |
| 174 void loaderWasResolved(); | 175 void loaderWasResolved(); |
| 175 void loaderDidFinish(); | 176 void loaderDidFinish(); |
| 176 | 177 |
| 177 private: | 178 private: |
| 178 static void block(HTMLImport*); | 179 static void block(HTMLImport*); |
| 179 | 180 |
| 180 void blockPredecessorsOf(HTMLImport* child); | 181 void blockPredecessorsOf(HTMLImport* child); |
| 181 void blockFromRunningScript(); | 182 void blockFromRunningScript(); |
| 182 void blockFromCreatingDocument(); | |
| 183 void waitLoaderOrChildren(); | 183 void waitLoaderOrChildren(); |
| 184 void unblockFromRunningScript(); | 184 void unblockFromRunningScript(); |
| 185 void unblockFromCreatingDocument(); | |
| 186 void becomeReady(); | 185 void becomeReady(); |
| 187 | 186 |
| 188 bool isBlockedFromCreatingDocumentByPredecessors() const; | |
| 189 bool isBlockedFromRunningScriptByPredecessors() const; | 187 bool isBlockedFromRunningScriptByPredecessors() const; |
| 190 bool isBlockingFollowersFromRunningScript() const; | 188 bool isBlockingFollowersFromRunningScript() const; |
| 191 bool isBlockingFollowersFromCreatingDocument() const; | 189 bool isBlockingFollowersFromCreatingDocument() const; |
| 192 | 190 |
| 193 State m_state; | 191 State m_state; |
| 194 | 192 |
| 195 bool m_createdByParser : 1; | 193 bool m_createdByParser : 1; |
| 196 }; | 194 }; |
| 197 | 195 |
| 198 // An abstract class to decouple its sublcass HTMLImportsController. | 196 // An abstract class to decouple its sublcass HTMLImportsController. |
| 199 class HTMLImportRoot : public HTMLImport { | 197 class HTMLImportRoot : public HTMLImport { |
| 200 public: | 198 public: |
| 201 HTMLImportRoot() : HTMLImport(Ready) { } | 199 HTMLImportRoot() : HTMLImport(Ready) { } |
| 202 | 200 |
| 203 virtual void blockerGone() = 0; | 201 virtual void blockerGone() = 0; |
| 204 virtual HTMLImportsController* toController() = 0; | 202 virtual HTMLImportsController* toController() = 0; |
| 205 virtual HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0)
const = 0; | 203 virtual HTMLImportChild* findLinkFor(const KURL&, HTMLImport* excluding = 0)
const = 0; |
| 206 }; | 204 }; |
| 207 | 205 |
| 208 } // namespace WebCore | 206 } // namespace WebCore |
| 209 | 207 |
| 210 #endif // HTMLImport_h | 208 #endif // HTMLImport_h |
| OLD | NEW |