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

Unified Diff: Source/core/dom/ProcessingInstruction.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/dom/PseudoElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ProcessingInstruction.cpp
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index a4ede166be59dfecb0ea5c83f2553c96b6cb2003..66b466e4eecf31148c0b4002320891821454e219 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -63,7 +63,7 @@ ProcessingInstruction::~ProcessingInstruction()
m_resource->removeClient(this);
if (inDocument())
- document()->styleSheetCollections()->removeStyleSheetCandidateNode(this);
+ document().styleSheetCollections()->removeStyleSheetCandidateNode(this);
}
String ProcessingInstruction::nodeName() const
@@ -80,12 +80,12 @@ PassRefPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/)
{
// FIXME: Is it a problem that this does not copy m_localHref?
// What about other data members?
- return create(document(), m_target, m_data);
+ return create(&document(), m_target, m_data);
}
void ProcessingInstruction::checkStyleSheet()
{
- if (m_target == "xml-stylesheet" && document()->frame() && parentNode() == document()) {
+ if (m_target == "xml-stylesheet" && document().frame() && parentNode() == &document()) {
// see http://www.w3.org/TR/xml-stylesheet/
// ### support stylesheet included in a fragment of this (or another) document
// ### make sure this gets called when adding from javascript
@@ -128,30 +128,30 @@ void ProcessingInstruction::checkStyleSheet()
m_resource = 0;
}
- String url = document()->completeURL(href).string();
+ String url = document().completeURL(href).string();
if (!dispatchBeforeLoadEvent(url))
return;
m_loading = true;
- document()->styleSheetCollections()->addPendingSheet();
- FetchRequest request(ResourceRequest(document()->completeURL(href)), FetchInitiatorTypeNames::processinginstruction);
+ document().styleSheetCollections()->addPendingSheet();
+ FetchRequest request(ResourceRequest(document().completeURL(href)), FetchInitiatorTypeNames::processinginstruction);
if (m_isXSL)
- m_resource = document()->fetcher()->fetchXSLStyleSheet(request);
+ m_resource = document().fetcher()->fetchXSLStyleSheet(request);
else
{
String charset = attrs.get("charset");
if (charset.isEmpty())
- charset = document()->charset();
+ charset = document().charset();
request.setCharset(charset);
- m_resource = document()->fetcher()->fetchCSSStyleSheet(request);
+ m_resource = document().fetcher()->fetchCSSStyleSheet(request);
}
if (m_resource)
m_resource->addClient(this);
else {
// The request may have been denied if (for example) the stylesheet is local and the document is remote.
m_loading = false;
- document()->styleSheetCollections()->removePendingSheet(this);
+ document().styleSheetCollections()->removePendingSheet(this);
}
}
}
@@ -169,7 +169,7 @@ bool ProcessingInstruction::isLoading() const
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document()->styleSheetCollections()->removePendingSheet(this);
+ document().styleSheetCollections()->removePendingSheet(this);
return true;
}
return false;
@@ -183,7 +183,7 @@ void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
}
ASSERT(m_isCSS);
- CSSParserContext parserContext(document(), baseURL, charset);
+ CSSParserContext parserContext(&document(), baseURL, charset);
RefPtr<StyleSheetContents> newSheet = StyleSheetContents::create(href, parserContext);
@@ -248,7 +248,7 @@ Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
CharacterData::insertedInto(insertionPoint);
if (!insertionPoint->inDocument())
return InsertionDone;
- document()->styleSheetCollections()->addStyleSheetCandidateNode(this, m_createdByParser);
+ document().styleSheetCollections()->addStyleSheetCandidateNode(this, m_createdByParser);
checkStyleSheet();
return InsertionDone;
}
@@ -259,7 +259,7 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
if (!insertionPoint->inDocument())
return;
- document()->styleSheetCollections()->removeStyleSheetCandidateNode(this);
+ document().styleSheetCollections()->removeStyleSheetCandidateNode(this);
RefPtr<StyleSheet> removedSheet = m_sheet;
@@ -270,8 +270,8 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
}
// If we're in document teardown, then we don't need to do any notification of our sheet's removal.
- if (document()->renderer())
- document()->removedStyleSheet(removedSheet.get());
+ if (document().renderer())
+ document().removedStyleSheet(removedSheet.get());
}
void ProcessingInstruction::finishParsingChildren()
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | Source/core/dom/PseudoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698