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

Side by Side Diff: Source/core/dom/StyleElement.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/dom/SelectorQuery.cpp ('k') | Source/core/dom/Text.cpp » ('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) 2006, 2007 Rob Buis 2 * Copyright (C) 2006, 2007 Rob Buis
3 * Copyright (C) 2008 Apple, Inc. All rights reserved. 3 * Copyright (C) 2008 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void StyleElement::clearSheet() 117 void StyleElement::clearSheet()
118 { 118 {
119 ASSERT(m_sheet); 119 ASSERT(m_sheet);
120 m_sheet.release()->clearOwnerNode(); 120 m_sheet.release()->clearOwnerNode();
121 } 121 }
122 122
123 void StyleElement::createSheet(Element* e, const String& text) 123 void StyleElement::createSheet(Element* e, const String& text)
124 { 124 {
125 ASSERT(e); 125 ASSERT(e);
126 ASSERT(e->inDocument()); 126 ASSERT(e->inDocument());
127 Document* document = e->document(); 127 Document& document = e->document();
128 if (m_sheet) { 128 if (m_sheet) {
129 if (m_sheet->isLoading()) 129 if (m_sheet->isLoading())
130 document->styleSheetCollections()->removePendingSheet(e); 130 document.styleSheetCollections()->removePendingSheet(e);
131 clearSheet(); 131 clearSheet();
132 } 132 }
133 133
134 // If type is empty or CSS, this is a CSS style sheet. 134 // If type is empty or CSS, this is a CSS style sheet.
135 const AtomicString& type = this->type(); 135 const AtomicString& type = this->type();
136 if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url() , m_startPosition.m_line) && isCSS(e, type)) { 136 if (document.contentSecurityPolicy()->allowInlineStyle(e->document().url(), m_startPosition.m_line) && isCSS(e, type)) {
137 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); 137 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media());
138 138
139 MediaQueryEvaluator screenEval("screen", true); 139 MediaQueryEvaluator screenEval("screen", true);
140 MediaQueryEvaluator printEval("print", true); 140 MediaQueryEvaluator printEval("print", true);
141 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g et())) { 141 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g et())) {
142 document->styleSheetCollections()->addPendingSheet(); 142 document.styleSheetCollections()->addPendingSheet();
143 m_loading = true; 143 m_loading = true;
144 144
145 TextPosition startPosition = m_startPosition == TextPosition::belowR angePosition() ? TextPosition::minimumPosition() : m_startPosition; 145 TextPosition startPosition = m_startPosition == TextPosition::belowR angePosition() ? TextPosition::minimumPosition() : m_startPosition;
146 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu ment->inputEncoding()); 146 m_sheet = CSSStyleSheet::createInline(e, KURL(), startPosition, docu ment.inputEncoding());
147 m_sheet->setMediaQueries(mediaQueries.release()); 147 m_sheet->setMediaQueries(mediaQueries.release());
148 m_sheet->setTitle(e->title()); 148 m_sheet->setTitle(e->title());
149 m_sheet->contents()->parseStringAtPosition(text, startPosition, m_cr eatedByParser); 149 m_sheet->contents()->parseStringAtPosition(text, startPosition, m_cr eatedByParser);
150 150
151 m_loading = false; 151 m_loading = false;
152 } 152 }
153 } 153 }
154 154
155 if (m_sheet) 155 if (m_sheet)
156 m_sheet->contents()->checkLoaded(); 156 m_sheet->contents()->checkLoaded();
(...skipping 16 matching lines...) Expand all
173 return true; 173 return true;
174 } 174 }
175 175
176 void StyleElement::startLoadingDynamicSheet(Document* document) 176 void StyleElement::startLoadingDynamicSheet(Document* document)
177 { 177 {
178 ASSERT(document); 178 ASSERT(document);
179 document->styleSheetCollections()->addPendingSheet(); 179 document->styleSheetCollections()->addPendingSheet();
180 } 180 }
181 181
182 } 182 }
OLDNEW
« no previous file with comments | « Source/core/dom/SelectorQuery.cpp ('k') | Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698