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

Side by Side Diff: Source/core/css/CSSStyleSheet.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, 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/css/CSSParser-in.cpp ('k') | Source/core/css/ElementRuleCollector.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return adoptRef(new CSSStyleSheet(sheet, ownerRule)); 73 return adoptRef(new CSSStyleSheet(sheet, ownerRule));
74 } 74 }
75 75
76 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, Node* ownerNode) 76 PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s heet, Node* ownerNode)
77 { 77 {
78 return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::min imumPosition())); 78 return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::min imumPosition()));
79 } 79 }
80 80
81 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding) 81 PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KUR L& baseURL, const TextPosition& startPosition, const String& encoding)
82 { 82 {
83 CSSParserContext parserContext(ownerNode->document(), baseURL, encoding); 83 CSSParserContext parserContext(&ownerNode->document(), baseURL, encoding);
84 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext); 84 RefPtr<StyleSheetContents> sheet = StyleSheetContents::create(baseURL.string (), parserContext);
85 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition)); 85 return adoptRef(new CSSStyleSheet(sheet.release(), ownerNode, true, startPos ition));
86 } 86 }
87 87
88 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule) 88 CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR ule* ownerRule)
89 : m_contents(contents) 89 : m_contents(contents)
90 , m_isInlineStylesheet(false) 90 , m_isInlineStylesheet(false)
91 , m_isDisabled(false) 91 , m_isDisabled(false)
92 , m_ownerNode(0) 92 , m_ownerNode(0)
93 , m_ownerRule(ownerRule) 93 , m_ownerRule(ownerRule)
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 CSSStyleSheet* CSSStyleSheet::parentStyleSheet() const 350 CSSStyleSheet* CSSStyleSheet::parentStyleSheet() const
351 { 351 {
352 return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0; 352 return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;
353 } 353 }
354 354
355 Document* CSSStyleSheet::ownerDocument() const 355 Document* CSSStyleSheet::ownerDocument() const
356 { 356 {
357 const CSSStyleSheet* root = this; 357 const CSSStyleSheet* root = this;
358 while (root->parentStyleSheet()) 358 while (root->parentStyleSheet())
359 root = root->parentStyleSheet(); 359 root = root->parentStyleSheet();
360 return root->ownerNode() ? root->ownerNode()->document() : 0; 360 return root->ownerNode() ? &root->ownerNode()->document() : 0;
361 } 361 }
362 362
363 void CSSStyleSheet::clearChildRuleCSSOMWrappers() 363 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
364 { 364 {
365 m_childRuleCSSOMWrappers.clear(); 365 m_childRuleCSSOMWrappers.clear();
366 } 366 }
367 367
368 } 368 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser-in.cpp ('k') | Source/core/css/ElementRuleCollector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698