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

Unified Diff: third_party/WebKit/Source/core/css/CSSStyleSheet.cpp

Issue 2354773003: Make stylesheet owner node a reference instead of pointer. (Closed)
Patch Set: const Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
index b3c917b9ea20dae8bd7d356dd2a94992139c974b..a7e9f24fc2557873823cd346f06ad1c513657eb6 100644
--- a/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
+++ b/third_party/WebKit/Source/core/css/CSSStyleSheet.cpp
@@ -69,17 +69,16 @@ private:
};
#if DCHECK_IS_ON()
-static bool isAcceptableCSSStyleSheetParent(Node* parentNode)
+static bool isAcceptableCSSStyleSheetParent(const Node& parentNode)
{
// Only these nodes can be parents of StyleSheets, and they need to call
// clearOwnerNode() when moved out of document. Note that destructor of
// the nodes don't call clearOwnerNode() with Oilpan.
- return !parentNode
- || parentNode->isDocumentNode()
- || isHTMLLinkElement(*parentNode)
- || isHTMLStyleElement(*parentNode)
- || isSVGStyleElement(*parentNode)
- || parentNode->getNodeType() == Node::kProcessingInstructionNode;
+ return parentNode.isDocumentNode()
+ || isHTMLLinkElement(parentNode)
+ || isHTMLStyleElement(parentNode)
+ || isSVGStyleElement(parentNode)
+ || parentNode.getNodeType() == Node::kProcessingInstructionNode;
}
#endif
@@ -88,20 +87,20 @@ CSSStyleSheet* CSSStyleSheet::create(StyleSheetContents* sheet, CSSImportRule* o
return new CSSStyleSheet(sheet, ownerRule);
}
-CSSStyleSheet* CSSStyleSheet::create(StyleSheetContents* sheet, Node* ownerNode)
+CSSStyleSheet* CSSStyleSheet::create(StyleSheetContents* sheet, Node& ownerNode)
{
return new CSSStyleSheet(sheet, ownerNode, false, TextPosition::minimumPosition());
}
-CSSStyleSheet* CSSStyleSheet::createInline(StyleSheetContents* sheet, Node* ownerNode, const TextPosition& startPosition)
+CSSStyleSheet* CSSStyleSheet::createInline(StyleSheetContents* sheet, Node& ownerNode, const TextPosition& startPosition)
{
DCHECK(sheet);
return new CSSStyleSheet(sheet, ownerNode, true, startPosition);
}
-CSSStyleSheet* CSSStyleSheet::createInline(Node* ownerNode, const KURL& baseURL, const TextPosition& startPosition, const String& encoding)
+CSSStyleSheet* CSSStyleSheet::createInline(Node& ownerNode, const KURL& baseURL, const TextPosition& startPosition, const String& encoding)
{
- CSSParserContext parserContext(ownerNode->document(), nullptr, baseURL, encoding);
+ CSSParserContext parserContext(ownerNode.document(), nullptr, baseURL, encoding);
StyleSheetContents* sheet = StyleSheetContents::create(baseURL.getString(), parserContext);
return new CSSStyleSheet(sheet, ownerNode, true, startPosition);
}
@@ -118,11 +117,11 @@ CSSStyleSheet::CSSStyleSheet(StyleSheetContents* contents, CSSImportRule* ownerR
m_contents->registerClient(this);
}
-CSSStyleSheet::CSSStyleSheet(StyleSheetContents* contents, Node* ownerNode, bool isInlineStylesheet, const TextPosition& startPosition)
+CSSStyleSheet::CSSStyleSheet(StyleSheetContents* contents, Node& ownerNode, bool isInlineStylesheet, const TextPosition& startPosition)
: m_contents(contents)
, m_isInlineStylesheet(isInlineStylesheet)
, m_isDisabled(false)
- , m_ownerNode(ownerNode)
+ , m_ownerNode(&ownerNode)
, m_ownerRule(nullptr)
, m_startPosition(startPosition)
, m_loadCompleted(false)
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSStyleSheet.h ('k') | third_party/WebKit/Source/core/css/CSSStyleSheetResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698