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

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

Issue 23516012: Rename StyleSheetCollections to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/Element.cpp ('k') | Source/core/dom/ShadowTreeStyleSheetCollection.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 * Copyright (C) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2008, 2009 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,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #include "core/dom/ProcessingInstruction.h" 22 #include "core/dom/ProcessingInstruction.h"
23 23
24 #include "FetchInitiatorTypeNames.h" 24 #include "FetchInitiatorTypeNames.h"
25 #include "core/css/CSSStyleSheet.h" 25 #include "core/css/CSSStyleSheet.h"
26 #include "core/css/MediaList.h" 26 #include "core/css/MediaList.h"
27 #include "core/css/StyleSheetContents.h" 27 #include "core/css/StyleSheetContents.h"
28 #include "core/dom/Document.h" 28 #include "core/dom/Document.h"
29 #include "core/dom/StyleSheetCollections.h" 29 #include "core/dom/StyleEngine.h"
30 #include "core/fetch/CSSStyleSheetResource.h" 30 #include "core/fetch/CSSStyleSheetResource.h"
31 #include "core/fetch/FetchRequest.h" 31 #include "core/fetch/FetchRequest.h"
32 #include "core/fetch/ResourceFetcher.h" 32 #include "core/fetch/ResourceFetcher.h"
33 #include "core/fetch/XSLStyleSheetResource.h" 33 #include "core/fetch/XSLStyleSheetResource.h"
34 #include "core/xml/XSLStyleSheet.h" 34 #include "core/xml/XSLStyleSheet.h"
35 #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes() 35 #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes()
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 inline ProcessingInstruction::ProcessingInstruction(Document& document, const St ring& target, const String& data) 39 inline ProcessingInstruction::ProcessingInstruction(Document& document, const St ring& target, const String& data)
(...skipping 16 matching lines...) Expand all
56 56
57 ProcessingInstruction::~ProcessingInstruction() 57 ProcessingInstruction::~ProcessingInstruction()
58 { 58 {
59 if (m_sheet) 59 if (m_sheet)
60 m_sheet->clearOwnerNode(); 60 m_sheet->clearOwnerNode();
61 61
62 if (m_resource) 62 if (m_resource)
63 m_resource->removeClient(this); 63 m_resource->removeClient(this);
64 64
65 if (inDocument()) 65 if (inDocument())
66 document().styleSheetCollections()->removeStyleSheetCandidateNode(this); 66 document().styleEngine()->removeStyleSheetCandidateNode(this);
67 } 67 }
68 68
69 String ProcessingInstruction::nodeName() const 69 String ProcessingInstruction::nodeName() const
70 { 70 {
71 return m_target; 71 return m_target;
72 } 72 }
73 73
74 Node::NodeType ProcessingInstruction::nodeType() const 74 Node::NodeType ProcessingInstruction::nodeType() const
75 { 75 {
76 return PROCESSING_INSTRUCTION_NODE; 76 return PROCESSING_INSTRUCTION_NODE;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 if (m_resource) { 126 if (m_resource) {
127 m_resource->removeClient(this); 127 m_resource->removeClient(this);
128 m_resource = 0; 128 m_resource = 0;
129 } 129 }
130 130
131 String url = document().completeURL(href).string(); 131 String url = document().completeURL(href).string();
132 if (!dispatchBeforeLoadEvent(url)) 132 if (!dispatchBeforeLoadEvent(url))
133 return; 133 return;
134 134
135 m_loading = true; 135 m_loading = true;
136 document().styleSheetCollections()->addPendingSheet(); 136 document().styleEngine()->addPendingSheet();
137 FetchRequest request(ResourceRequest(document().completeURL(href)), FetchInitiatorTypeNames::processinginstruction); 137 FetchRequest request(ResourceRequest(document().completeURL(href)), FetchInitiatorTypeNames::processinginstruction);
138 if (m_isXSL) 138 if (m_isXSL)
139 m_resource = document().fetcher()->fetchXSLStyleSheet(request); 139 m_resource = document().fetcher()->fetchXSLStyleSheet(request);
140 else 140 else
141 { 141 {
142 String charset = attrs.get("charset"); 142 String charset = attrs.get("charset");
143 if (charset.isEmpty()) 143 if (charset.isEmpty())
144 charset = document().charset(); 144 charset = document().charset();
145 request.setCharset(charset); 145 request.setCharset(charset);
146 146
147 m_resource = document().fetcher()->fetchCSSStyleSheet(request); 147 m_resource = document().fetcher()->fetchCSSStyleSheet(request);
148 } 148 }
149 if (m_resource) 149 if (m_resource)
150 m_resource->addClient(this); 150 m_resource->addClient(this);
151 else { 151 else {
152 // The request may have been denied if (for example) the stylesh eet is local and the document is remote. 152 // The request may have been denied if (for example) the stylesh eet is local and the document is remote.
153 m_loading = false; 153 m_loading = false;
154 document().styleSheetCollections()->removePendingSheet(this); 154 document().styleEngine()->removePendingSheet(this);
155 } 155 }
156 } 156 }
157 } 157 }
158 } 158 }
159 159
160 bool ProcessingInstruction::isLoading() const 160 bool ProcessingInstruction::isLoading() const
161 { 161 {
162 if (m_loading) 162 if (m_loading)
163 return true; 163 return true;
164 if (!m_sheet) 164 if (!m_sheet)
165 return false; 165 return false;
166 return m_sheet->isLoading(); 166 return m_sheet->isLoading();
167 } 167 }
168 168
169 bool ProcessingInstruction::sheetLoaded() 169 bool ProcessingInstruction::sheetLoaded()
170 { 170 {
171 if (!isLoading()) { 171 if (!isLoading()) {
172 document().styleSheetCollections()->removePendingSheet(this); 172 document().styleEngine()->removePendingSheet(this);
173 return true; 173 return true;
174 } 174 }
175 return false; 175 return false;
176 } 176 }
177 177
178 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas eURL, const String& charset, const CSSStyleSheetResource* sheet) 178 void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas eURL, const String& charset, const CSSStyleSheetResource* sheet)
179 { 179 {
180 if (!inDocument()) { 180 if (!inDocument()) {
181 ASSERT(!m_sheet); 181 ASSERT(!m_sheet);
182 return; 182 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 return; 241 return;
242 242
243 addSubresourceURL(urls, sheet()->baseURL()); 243 addSubresourceURL(urls, sheet()->baseURL());
244 } 244 }
245 245
246 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint) 246 Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container Node* insertionPoint)
247 { 247 {
248 CharacterData::insertedInto(insertionPoint); 248 CharacterData::insertedInto(insertionPoint);
249 if (!insertionPoint->inDocument()) 249 if (!insertionPoint->inDocument())
250 return InsertionDone; 250 return InsertionDone;
251 document().styleSheetCollections()->addStyleSheetCandidateNode(this, m_creat edByParser); 251 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser );
252 checkStyleSheet(); 252 checkStyleSheet();
253 return InsertionDone; 253 return InsertionDone;
254 } 254 }
255 255
256 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint) 256 void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
257 { 257 {
258 CharacterData::removedFrom(insertionPoint); 258 CharacterData::removedFrom(insertionPoint);
259 if (!insertionPoint->inDocument()) 259 if (!insertionPoint->inDocument())
260 return; 260 return;
261 261
262 document().styleSheetCollections()->removeStyleSheetCandidateNode(this); 262 document().styleEngine()->removeStyleSheetCandidateNode(this);
263 263
264 RefPtr<StyleSheet> removedSheet = m_sheet; 264 RefPtr<StyleSheet> removedSheet = m_sheet;
265 265
266 if (m_sheet) { 266 if (m_sheet) {
267 ASSERT(m_sheet->ownerNode() == this); 267 ASSERT(m_sheet->ownerNode() == this);
268 m_sheet->clearOwnerNode(); 268 m_sheet->clearOwnerNode();
269 m_sheet = 0; 269 m_sheet = 0;
270 } 270 }
271 271
272 // If we're in document teardown, then we don't need to do any notification of our sheet's removal. 272 // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
273 if (document().renderer()) 273 if (document().renderer())
274 document().removedStyleSheet(removedSheet.get()); 274 document().removedStyleSheet(removedSheet.get());
275 } 275 }
276 276
277 void ProcessingInstruction::finishParsingChildren() 277 void ProcessingInstruction::finishParsingChildren()
278 { 278 {
279 m_createdByParser = false; 279 m_createdByParser = false;
280 CharacterData::finishParsingChildren(); 280 CharacterData::finishParsingChildren();
281 } 281 }
282 282
283 } // namespace 283 } // namespace
OLDNEW
« no previous file with comments | « Source/core/dom/Element.cpp ('k') | Source/core/dom/ShadowTreeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698