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 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 , m_writeRecursionIsTooDeep(false) | 501 , m_writeRecursionIsTooDeep(false) |
502 , m_writeRecursionDepth(0) | 502 , m_writeRecursionDepth(0) |
503 , m_taskRunner(MainThreadTaskRunner::create(this)) | 503 , m_taskRunner(MainThreadTaskRunner::create(this)) |
504 , m_registrationContext(initializer.registrationContext(this)) | 504 , m_registrationContext(initializer.registrationContext(this)) |
505 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) | 505 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi red) |
506 , m_timeline(AnimationTimeline::create(this)) | 506 , m_timeline(AnimationTimeline::create(this)) |
507 , m_templateDocumentHost(nullptr) | 507 , m_templateDocumentHost(nullptr) |
508 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) | 508 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) |
509 , m_hasViewportUnits(false) | 509 , m_hasViewportUnits(false) |
510 , m_styleRecalcElementCounter(0) | 510 , m_styleRecalcElementCounter(0) |
511 , m_backgroundParsingPolicy(AllowAsynchronousParsing) | |
511 { | 512 { |
512 if (m_frame) { | 513 if (m_frame) { |
513 ASSERT(m_frame->page()); | 514 ASSERT(m_frame->page()); |
514 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); | 515 provideContextFeaturesToDocumentFrom(*this, *m_frame->page()); |
515 | 516 |
516 m_fetcher = m_frame->loader().documentLoader()->fetcher(); | 517 m_fetcher = m_frame->loader().documentLoader()->fetcher(); |
517 } | 518 } |
518 | 519 |
519 if (!m_fetcher) | 520 if (!m_fetcher) |
520 m_fetcher = ResourceFetcher::create(0); | 521 m_fetcher = ResourceFetcher::create(0); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1226 } | 1227 } |
1227 | 1228 |
1228 KURL Document::baseURI() const | 1229 KURL Document::baseURI() const |
1229 { | 1230 { |
1230 return m_baseURL; | 1231 return m_baseURL; |
1231 } | 1232 } |
1232 | 1233 |
1233 void Document::setContent(const String& content) | 1234 void Document::setContent(const String& content) |
1234 { | 1235 { |
1235 open(); | 1236 open(); |
1236 // FIXME: This should probably use insert(), but that's (intentionally) | |
1237 // not implemented for the XML parser as it's normally synonymous with | |
1238 // document.write(). append() will end up yielding, but close() will | |
1239 // pump the tokenizer syncrhonously and finish the parse. | |
1240 m_parser->pinToMainThread(); | |
kbalazs
2014/12/05 23:37:57
Note that this called XMLDocumentParser::pinToMain
| |
1241 m_parser->append(content.impl()); | 1237 m_parser->append(content.impl()); |
1242 close(); | 1238 close(); |
1243 } | 1239 } |
1244 | 1240 |
1245 String Document::suggestedMIMEType() const | 1241 String Document::suggestedMIMEType() const |
1246 { | 1242 { |
1247 if (isXMLDocument()) { | 1243 if (isXMLDocument()) { |
1248 if (isXHTMLDocument()) | 1244 if (isXHTMLDocument()) |
1249 return "application/xhtml+xml"; | 1245 return "application/xhtml+xml"; |
1250 if (isSVGDocument()) | 1246 if (isSVGDocument()) |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2281 ASSERT(&cacheOwner == this || !m_axObjectCache); | 2277 ASSERT(&cacheOwner == this || !m_axObjectCache); |
2282 if (!cacheOwner.m_axObjectCache) | 2278 if (!cacheOwner.m_axObjectCache) |
2283 cacheOwner.m_axObjectCache = adoptPtr(AXObjectCache::create(cacheOwner)) ; | 2279 cacheOwner.m_axObjectCache = adoptPtr(AXObjectCache::create(cacheOwner)) ; |
2284 return cacheOwner.m_axObjectCache.get(); | 2280 return cacheOwner.m_axObjectCache.get(); |
2285 } | 2281 } |
2286 | 2282 |
2287 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser() | 2283 PassRefPtrWillBeRawPtr<DocumentParser> Document::createParser() |
2288 { | 2284 { |
2289 if (isHTMLDocument()) { | 2285 if (isHTMLDocument()) { |
2290 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( page()); | 2286 bool reportErrors = InspectorInstrumentation::collectingHTMLParseErrors( page()); |
2291 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors); | 2287 return HTMLDocumentParser::create(toHTMLDocument(*this), reportErrors, m _backgroundParsingPolicy); |
2292 } | 2288 } |
2293 // FIXME: this should probably pass the frame instead | 2289 // FIXME: this should probably pass the frame instead |
2294 return XMLDocumentParser::create(*this, view()); | 2290 return XMLDocumentParser::create(*this, view()); |
2295 } | 2291 } |
2296 | 2292 |
2297 bool Document::isFrameSet() const | 2293 bool Document::isFrameSet() const |
2298 { | 2294 { |
2299 if (!isHTMLDocument()) | 2295 if (!isHTMLDocument()) |
2300 return false; | 2296 return false; |
2301 return isHTMLFrameSetElement(body()); | 2297 return isHTMLFrameSetElement(body()); |
(...skipping 26 matching lines...) Expand all Loading... | |
2328 | 2324 |
2329 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint() ) | 2325 if (!parser->wasCreatedByScript() && parser->hasInsertionPoint() ) |
2330 return; | 2326 return; |
2331 } | 2327 } |
2332 } | 2328 } |
2333 | 2329 |
2334 if (m_frame->loader().state() == FrameStateProvisional) | 2330 if (m_frame->loader().state() == FrameStateProvisional) |
2335 m_frame->loader().stopAllLoaders(); | 2331 m_frame->loader().stopAllLoaders(); |
2336 } | 2332 } |
2337 | 2333 |
2334 forceSynchronousParsing(); | |
kbalazs
2014/12/05 23:37:57
This is in open() (not obvious from the context).
| |
2335 | |
2338 removeAllEventListenersRecursively(); | 2336 removeAllEventListenersRecursively(); |
2339 implicitOpen(); | 2337 implicitOpen(); |
2340 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) | 2338 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
2341 parser->setWasCreatedByScript(true); | 2339 parser->setWasCreatedByScript(true); |
2342 | 2340 |
2343 if (m_frame) | 2341 if (m_frame) |
2344 m_frame->loader().didExplicitOpen(); | 2342 m_frame->loader().didExplicitOpen(); |
2345 if (m_loadEventProgress != LoadEventInProgress && m_loadEventProgress != Unl oadEventInProgress) | 2343 if (m_loadEventProgress != LoadEventInProgress && m_loadEventProgress != Unl oadEventInProgress) |
2346 m_loadEventProgress = LoadEventNotRun; | 2344 m_loadEventProgress = LoadEventNotRun; |
2347 } | 2345 } |
2348 | 2346 |
2347 void Document::forceSynchronousParsing() | |
2348 { | |
2349 ASSERT(!m_parser); | |
2350 m_backgroundParsingPolicy = ForceSynchronousParsing; | |
2351 } | |
2352 | |
2349 void Document::detachParser() | 2353 void Document::detachParser() |
2350 { | 2354 { |
2351 if (!m_parser) | 2355 if (!m_parser) |
2352 return; | 2356 return; |
2353 m_parser->detach(); | 2357 m_parser->detach(); |
2354 m_parser.clear(); | 2358 m_parser.clear(); |
2355 } | 2359 } |
2356 | 2360 |
2357 void Document::cancelParsing() | 2361 void Document::cancelParsing() |
2358 { | 2362 { |
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5823 #ifndef NDEBUG | 5827 #ifndef NDEBUG |
5824 using namespace blink; | 5828 using namespace blink; |
5825 void showLiveDocumentInstances() | 5829 void showLiveDocumentInstances() |
5826 { | 5830 { |
5827 WeakDocumentSet& set = liveDocumentSet(); | 5831 WeakDocumentSet& set = liveDocumentSet(); |
5828 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 5832 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
5829 for (Document* document : set) | 5833 for (Document* document : set) |
5830 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); | 5834 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); |
5831 } | 5835 } |
5832 #endif | 5836 #endif |
OLD | NEW |