| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 , m_loadEventDelayCount(0) | 246 , m_loadEventDelayCount(0) |
| 247 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) | 247 , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) |
| 248 , m_didSetReferrerPolicy(false) | 248 , m_didSetReferrerPolicy(false) |
| 249 , m_referrerPolicy(ReferrerPolicyDefault) | 249 , m_referrerPolicy(ReferrerPolicyDefault) |
| 250 , m_elementRegistry(initializer.elementRegistry()) | 250 , m_elementRegistry(initializer.elementRegistry()) |
| 251 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) | 251 , m_elementDataCacheClearTimer(this, &Document::elementDataCacheClearTimerFi
red) |
| 252 , m_timeline(AnimationTimeline::create(this)) | 252 , m_timeline(AnimationTimeline::create(this)) |
| 253 , m_templateDocumentHost(nullptr) | 253 , m_templateDocumentHost(nullptr) |
| 254 , m_hasViewportUnits(false) | 254 , m_hasViewportUnits(false) |
| 255 , m_styleRecalcElementCounter(0) | 255 , m_styleRecalcElementCounter(0) |
| 256 , m_frameView(nullptr) |
| 256 { | 257 { |
| 257 setClient(this); | 258 setClient(this); |
| 258 | 259 |
| 259 if (!m_elementRegistry) | 260 if (!m_elementRegistry) |
| 260 m_elementRegistry = CustomElementRegistry::Create(); | 261 m_elementRegistry = CustomElementRegistry::Create(); |
| 261 | 262 |
| 262 m_fetcher = ResourceFetcher::create(this); | 263 m_fetcher = ResourceFetcher::create(this); |
| 263 | 264 |
| 264 // We depend on the url getting immediately set in subframes, but we | 265 // We depend on the url getting immediately set in subframes, but we |
| 265 // also depend on the url NOT getting immediately set in opened windows. | 266 // also depend on the url NOT getting immediately set in opened windows. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 #ifndef NDEBUG | 326 #ifndef NDEBUG |
| 326 liveDocumentSet().remove(this); | 327 liveDocumentSet().remove(this); |
| 327 #endif | 328 #endif |
| 328 #endif | 329 #endif |
| 329 | 330 |
| 330 setClient(0); | 331 setClient(0); |
| 331 | 332 |
| 332 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); | 333 InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); |
| 333 } | 334 } |
| 334 | 335 |
| 335 PassRefPtr<Document> Document::create(Document& document) | |
| 336 { | |
| 337 DocumentInit init = DocumentInit::fromContext(document.contextDocument()) | |
| 338 .withElementRegistry(document.elementRegistry()); | |
| 339 return adoptRef(new Document(init)); | |
| 340 } | |
| 341 | |
| 342 #if !ENABLE(OILPAN) | 336 #if !ENABLE(OILPAN) |
| 343 void Document::dispose() | 337 void Document::dispose() |
| 344 { | 338 { |
| 345 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); | 339 ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun); |
| 346 | 340 |
| 347 // We must make sure not to be retaining any of our children through | 341 // We must make sure not to be retaining any of our children through |
| 348 // these extra pointers or we will create a reference cycle. | 342 // these extra pointers or we will create a reference cycle. |
| 349 m_focusedElement = nullptr; | 343 m_focusedElement = nullptr; |
| 350 m_hoverNode = nullptr; | 344 m_hoverNode = nullptr; |
| 351 m_activeHoverElement = nullptr; | 345 m_activeHoverElement = nullptr; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS
tate& exceptionState) | 402 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS
tate& exceptionState) |
| 409 { | 403 { |
| 410 if (!isValidName(name)) { | 404 if (!isValidName(name)) { |
| 411 exceptionState.ThrowDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); | 405 exceptionState.ThrowDOMException(InvalidCharacterError, "The tag name pr
ovided ('" + name + "') is not a valid name."); |
| 412 return nullptr; | 406 return nullptr; |
| 413 } | 407 } |
| 414 | 408 |
| 415 return HTMLElementFactory::createElement(name, *this, false); | 409 return HTMLElementFactory::createElement(name, *this, false); |
| 416 } | 410 } |
| 417 | 411 |
| 412 PassRefPtr<Text> Document::createText(const String& text) |
| 413 { |
| 414 return Text::create(*this, text); |
| 415 } |
| 416 |
| 418 void Document::registerElement(const AtomicString& name, PassRefPtr<DartValue> t
ype, ExceptionState& es) | 417 void Document::registerElement(const AtomicString& name, PassRefPtr<DartValue> t
ype, ExceptionState& es) |
| 419 { | 418 { |
| 420 m_elementRegistry->RegisterElement(name, type); | 419 m_elementRegistry->RegisterElement(name, type); |
| 421 } | 420 } |
| 422 | 421 |
| 423 void Document::setImportsController(HTMLImportsController* controller) | 422 void Document::setImportsController(HTMLImportsController* controller) |
| 424 { | 423 { |
| 425 ASSERT(!m_importsController || !controller); | 424 ASSERT(!m_importsController || !controller); |
| 426 m_importsController = controller; | 425 m_importsController = controller; |
| 427 } | 426 } |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 { | 821 { |
| 823 return DOCUMENT_NODE; | 822 return DOCUMENT_NODE; |
| 824 } | 823 } |
| 825 | 824 |
| 826 void Document::setStateForNewFormElements(const Vector<String>& stateVector) | 825 void Document::setStateForNewFormElements(const Vector<String>& stateVector) |
| 827 { | 826 { |
| 828 } | 827 } |
| 829 | 828 |
| 830 FrameView* Document::view() const | 829 FrameView* Document::view() const |
| 831 { | 830 { |
| 831 if (m_frameView) |
| 832 return m_frameView; |
| 832 return m_frame ? m_frame->view() : 0; | 833 return m_frame ? m_frame->view() : 0; |
| 833 } | 834 } |
| 834 | 835 |
| 835 Page* Document::page() const | 836 Page* Document::page() const |
| 836 { | 837 { |
| 837 return m_frame ? m_frame->page() : 0; | 838 return m_frame ? m_frame->page() : 0; |
| 838 } | 839 } |
| 839 | 840 |
| 840 FrameHost* Document::frameHost() const | 841 FrameHost* Document::frameHost() const |
| 841 { | 842 { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 898 |
| 898 scheduleVisualUpdate(); | 899 scheduleVisualUpdate(); |
| 899 | 900 |
| 900 // TODO(esprehn): We should either rename this state, or change the other | 901 // TODO(esprehn): We should either rename this state, or change the other |
| 901 // users of scheduleVisualUpdate() so they don't expect different states. | 902 // users of scheduleVisualUpdate() so they don't expect different states. |
| 902 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); | 903 m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); |
| 903 } | 904 } |
| 904 | 905 |
| 905 void Document::scheduleVisualUpdate() | 906 void Document::scheduleVisualUpdate() |
| 906 { | 907 { |
| 907 page()->animator().scheduleVisualUpdate(); | 908 if (page()) |
| 909 page()->animator().scheduleVisualUpdate(); |
| 908 } | 910 } |
| 909 | 911 |
| 910 void Document::updateDistributionIfNeeded() | 912 void Document::updateDistributionIfNeeded() |
| 911 { | 913 { |
| 912 ScriptForbiddenScope forbidScript; | 914 ScriptForbiddenScope forbidScript; |
| 913 | 915 |
| 914 if (!childNeedsDistributionRecalc()) | 916 if (!childNeedsDistributionRecalc()) |
| 915 return; | 917 return; |
| 916 TRACE_EVENT0("blink", "Document::updateDistributionIfNeeded"); | 918 TRACE_EVENT0("blink", "Document::updateDistributionIfNeeded"); |
| 917 recalcDistribution(); | 919 recalcDistribution(); |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2225 using namespace blink; | 2227 using namespace blink; |
| 2226 void showLiveDocumentInstances() | 2228 void showLiveDocumentInstances() |
| 2227 { | 2229 { |
| 2228 WeakDocumentSet& set = liveDocumentSet(); | 2230 WeakDocumentSet& set = liveDocumentSet(); |
| 2229 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 2231 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 2230 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { | 2232 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it
) { |
| 2231 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); | 2233 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut
f8().data()); |
| 2232 } | 2234 } |
| 2233 } | 2235 } |
| 2234 #endif | 2236 #endif |
| OLD | NEW |