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

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

Issue 184813005: Make Document::implementation() method return reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 m_docType = docType; 667 m_docType = docType;
668 if (m_docType) { 668 if (m_docType) {
669 this->adoptIfNeeded(*m_docType); 669 this->adoptIfNeeded(*m_docType);
670 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) 670 if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false))
671 m_isMobileDocument = true; 671 m_isMobileDocument = true;
672 } 672 }
673 // Doctype affects the interpretation of the stylesheets. 673 // Doctype affects the interpretation of the stylesheets.
674 clearStyleResolver(); 674 clearStyleResolver();
675 } 675 }
676 676
677 DOMImplementation* Document::implementation() 677 DOMImplementation& Document::implementation()
678 { 678 {
679 if (!m_implementation) 679 if (!m_implementation)
680 m_implementation = DOMImplementation::create(*this); 680 m_implementation = DOMImplementation::create(*this);
681 return m_implementation.get(); 681 return *m_implementation;
682 } 682 }
683 683
684 bool Document::hasManifest() const 684 bool Document::hasManifest() const
685 { 685 {
686 return documentElement() && documentElement()->hasTagName(htmlTag) && docume ntElement()->hasAttribute(manifestAttr); 686 return documentElement() && documentElement()->hasTagName(htmlTag) && docume ntElement()->hasAttribute(manifestAttr);
687 } 687 }
688 688
689 Location* Document::location() const 689 Location* Document::location() const
690 { 690 {
691 if (!frame()) 691 if (!frame())
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 if (m_contentLanguage == language) 1141 if (m_contentLanguage == language)
1142 return; 1142 return;
1143 m_contentLanguage = language; 1143 m_contentLanguage = language;
1144 1144
1145 // Document's style depends on the content language. 1145 // Document's style depends on the content language.
1146 setNeedsStyleRecalc(SubtreeStyleChange); 1146 setNeedsStyleRecalc(SubtreeStyleChange);
1147 } 1147 }
1148 1148
1149 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta te) 1149 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta te)
1150 { 1150 {
1151 if (!implementation()->hasFeature("XML", String())) { 1151 if (!implementation().hasFeature("XML", String())) {
1152 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML."); 1152 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML.");
1153 return; 1153 return;
1154 } 1154 }
1155 1155
1156 if (!XMLDocumentParser::supportsXMLVersion(version)) { 1156 if (!XMLDocumentParser::supportsXMLVersion(version)) {
1157 exceptionState.throwDOMException(NotSupportedError, "This document does not support the XML version '" + version + "'."); 1157 exceptionState.throwDOMException(NotSupportedError, "This document does not support the XML version '" + version + "'.");
1158 return; 1158 return;
1159 } 1159 }
1160 1160
1161 m_xmlVersion = version; 1161 m_xmlVersion = version;
1162 } 1162 }
1163 1163
1164 void Document::setXMLStandalone(bool standalone, ExceptionState& exceptionState) 1164 void Document::setXMLStandalone(bool standalone, ExceptionState& exceptionState)
1165 { 1165 {
1166 if (!implementation()->hasFeature("XML", String())) { 1166 if (!implementation().hasFeature("XML", String())) {
1167 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML."); 1167 exceptionState.throwDOMException(NotSupportedError, "This document does not support XML.");
1168 return; 1168 return;
1169 } 1169 }
1170 1170
1171 m_xmlStandalone = standalone ? Standalone : NotStandalone; 1171 m_xmlStandalone = standalone ? Standalone : NotStandalone;
1172 } 1172 }
1173 1173
1174 KURL Document::baseURI() const 1174 KURL Document::baseURI() const
1175 { 1175 {
1176 return m_baseURL; 1176 return m_baseURL;
(...skipping 4257 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 void Document::defaultEventHandler(Event* event) 5434 void Document::defaultEventHandler(Event* event)
5435 { 5435 {
5436 if (frame() && frame()->remotePlatformLayer()) { 5436 if (frame() && frame()->remotePlatformLayer()) {
5437 frame()->chromeClient().forwardInputEvent(this, event); 5437 frame()->chromeClient().forwardInputEvent(this, event);
5438 return; 5438 return;
5439 } 5439 }
5440 Node::defaultEventHandler(event); 5440 Node::defaultEventHandler(event);
5441 } 5441 }
5442 5442
5443 } // namespace WebCore 5443 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698