Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 23453033: Have DOMPatchSupport and DocumentFragment deal with Document references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentFragment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 executeScriptsWaitingForResourcesIfNeeded(); 787 executeScriptsWaitingForResourcesIfNeeded();
788 } 788 }
789 789
790 bool Document::haveImportsLoaded() const 790 bool Document::haveImportsLoaded() const
791 { 791 {
792 return !m_import || !m_import->isBlocked(); 792 return !m_import || !m_import->isBlocked();
793 } 793 }
794 794
795 PassRefPtr<DocumentFragment> Document::createDocumentFragment() 795 PassRefPtr<DocumentFragment> Document::createDocumentFragment()
796 { 796 {
797 return DocumentFragment::create(&document()); 797 return DocumentFragment::create(document());
798 } 798 }
799 799
800 PassRefPtr<Text> Document::createTextNode(const String& data) 800 PassRefPtr<Text> Document::createTextNode(const String& data)
801 { 801 {
802 return Text::create(this, data); 802 return Text::create(this, data);
803 } 803 }
804 804
805 PassRefPtr<Comment> Document::createComment(const String& data) 805 PassRefPtr<Comment> Document::createComment(const String& data)
806 { 806 {
807 return Comment::create(this, data); 807 return Comment::create(this, data);
(...skipping 4533 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 { 5341 {
5342 AtomicString localeKey = locale; 5342 AtomicString localeKey = locale;
5343 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr olUIEnabled()) 5343 if (locale.isEmpty() || !RuntimeEnabledFeatures::langAttributeAwareFormContr olUIEnabled())
5344 localeKey = defaultLanguage(); 5344 localeKey = defaultLanguage();
5345 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr); 5345 LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr);
5346 if (result.isNewEntry) 5346 if (result.isNewEntry)
5347 result.iterator->value = Locale::create(localeKey); 5347 result.iterator->value = Locale::create(localeKey);
5348 return *(result.iterator->value); 5348 return *(result.iterator->value);
5349 } 5349 }
5350 5350
5351 Document* Document::ensureTemplateDocument() 5351 Document& Document::ensureTemplateDocument()
5352 { 5352 {
5353 if (const Document* document = templateDocument()) 5353 if (const Document* document = templateDocument())
5354 return const_cast<Document*>(document); 5354 return *const_cast<Document*>(document);
5355 5355
5356 if (isHTMLDocument()) { 5356 if (isHTMLDocument()) {
5357 DocumentInit init = DocumentInit::fromContext(contextDocument(), blankUR L()) 5357 DocumentInit init = DocumentInit::fromContext(contextDocument(), blankUR L())
5358 .withRegistrationContext(registrationContext()); 5358 .withRegistrationContext(registrationContext());
5359 m_templateDocument = HTMLDocument::create(init); 5359 m_templateDocument = HTMLDocument::create(init);
5360 } else { 5360 } else {
5361 m_templateDocument = Document::create(DocumentInit(blankURL())); 5361 m_templateDocument = Document::create(DocumentInit(blankURL()));
5362 } 5362 }
5363 5363
5364 m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor. 5364 m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
5365 5365
5366 return m_templateDocument.get(); 5366 return *m_templateDocument.get();
5367 } 5367 }
5368 5368
5369 PassRefPtr<FontLoader> Document::fontloader() 5369 PassRefPtr<FontLoader> Document::fontloader()
5370 { 5370 {
5371 if (!m_fontloader) 5371 if (!m_fontloader)
5372 m_fontloader = FontLoader::create(this); 5372 m_fontloader = FontLoader::create(this);
5373 return m_fontloader; 5373 return m_fontloader;
5374 } 5374 }
5375 5375
5376 void Document::didAssociateFormControl(Element* element) 5376 void Document::didAssociateFormControl(Element* element)
(...skipping 22 matching lines...) Expand all
5399 { 5399 {
5400 return DocumentLifecycleNotifier::create(this); 5400 return DocumentLifecycleNotifier::create(this);
5401 } 5401 }
5402 5402
5403 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5403 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5404 { 5404 {
5405 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5405 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5406 } 5406 }
5407 5407
5408 } // namespace WebCore 5408 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/DocumentFragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698