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

Side by Side Diff: WebCore/xml/XSLStyleSheetLibxslt.cpp

Issue 6474050: Revert 78101 - Merge r76728, crbug 68263 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 9 years, 10 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
« no previous file with comments | « WebCore/xml/XSLStyleSheet.h ('k') | WebCore/xml/XSLStyleSheetQt.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 * This file is part of the XSL implementation. 2 * This file is part of the XSL implementation.
3 * 3 *
4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 SOFT_LINK(libxslt, xsltIsBlank, int, (xmlChar *str), (str)) 50 SOFT_LINK(libxslt, xsltIsBlank, int, (xmlChar *str), (str))
51 SOFT_LINK(libxslt, xsltGetNsProp, xmlChar *, (xmlNodePtr node, const xmlChar *na me, const xmlChar *nameSpace), (node, name, nameSpace)) 51 SOFT_LINK(libxslt, xsltGetNsProp, xmlChar *, (xmlNodePtr node, const xmlChar *na me, const xmlChar *nameSpace), (node, name, nameSpace))
52 SOFT_LINK(libxslt, xsltParseStylesheetDoc, xsltStylesheetPtr, (xmlDocPtr doc), ( doc)) 52 SOFT_LINK(libxslt, xsltParseStylesheetDoc, xsltStylesheetPtr, (xmlDocPtr doc), ( doc))
53 SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do c)) 53 SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do c))
54 #endif 54 #endif
55 55
56 namespace WebCore { 56 namespace WebCore {
57 57
58 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalUR L, const KURL& finalURL) 58 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalUR L, const KURL& finalURL)
59 : StyleSheet(parentRule, originalURL, finalURL) 59 : StyleSheet(parentRule, originalURL, finalURL)
60 , m_ownerDocument(0)
60 , m_embedded(false) 61 , m_embedded(false)
61 , m_processed(false) // Child sheets get marked as processed when the libxsl t engine has finally seen them. 62 , m_processed(false) // Child sheets get marked as processed when the libxsl t engine has finally seen them.
62 , m_stylesheetDoc(0) 63 , m_stylesheetDoc(0)
63 , m_stylesheetDocTaken(false) 64 , m_stylesheetDocTaken(false)
64 , m_parentStyleSheet(0) 65 , m_parentStyleSheet(0)
65 { 66 {
66 } 67 }
67 68
68 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded) 69 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)
69 : StyleSheet(parentNode, originalURL, finalURL) 70 : StyleSheet(parentNode, originalURL, finalURL)
71 , m_ownerDocument(parentNode->document())
70 , m_embedded(embedded) 72 , m_embedded(embedded)
71 , m_processed(true) // The root sheet starts off processed. 73 , m_processed(true) // The root sheet starts off processed.
72 , m_stylesheetDoc(0) 74 , m_stylesheetDoc(0)
73 , m_stylesheetDocTaken(false) 75 , m_stylesheetDocTaken(false)
74 , m_parentStyleSheet(0) 76 , m_parentStyleSheet(0)
75 { 77 {
76 } 78 }
77 79
78 XSLStyleSheet::~XSLStyleSheet() 80 XSLStyleSheet::~XSLStyleSheet()
79 { 81 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (rule->isImportRule()) { 123 if (rule->isImportRule()) {
122 XSLImportRule* import = static_cast<XSLImportRule*>(rule); 124 XSLImportRule* import = static_cast<XSLImportRule*>(rule);
123 if (import->styleSheet()) 125 if (import->styleSheet())
124 import->styleSheet()->clearDocuments(); 126 import->styleSheet()->clearDocuments();
125 } 127 }
126 } 128 }
127 } 129 }
128 130
129 CachedResourceLoader* XSLStyleSheet::cachedResourceLoader() 131 CachedResourceLoader* XSLStyleSheet::cachedResourceLoader()
130 { 132 {
131 Document* document = ownerDocument(); 133 if (!m_ownerDocument)
132 if (!document)
133 return 0; 134 return 0;
134 return document->cachedResourceLoader(); 135 return m_ownerDocument->cachedResourceLoader();
135 } 136 }
136 137
137 bool XSLStyleSheet::parseString(const String& string, bool) 138 bool XSLStyleSheet::parseString(const String& string, bool)
138 { 139 {
139 // Parse in a single chunk into an xmlDocPtr 140 // Parse in a single chunk into an xmlDocPtr
140 const UChar BOM = 0xFEFF; 141 const UChar BOM = 0xFEFF;
141 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B OM); 142 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B OM);
142 if (!m_stylesheetDocTaken) 143 if (!m_stylesheetDocTaken)
143 xmlFreeDoc(m_stylesheetDoc); 144 xmlFreeDoc(m_stylesheetDoc);
144 m_stylesheetDocTaken = false; 145 m_stylesheetDocTaken = false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ASSERT(!m_stylesheetDocTaken); 251 ASSERT(!m_stylesheetDocTaken);
251 xsltStylesheetPtr result = xsltParseStylesheetDoc(m_stylesheetDoc); 252 xsltStylesheetPtr result = xsltParseStylesheetDoc(m_stylesheetDoc);
252 if (result) 253 if (result)
253 m_stylesheetDocTaken = true; 254 m_stylesheetDocTaken = true;
254 return result; 255 return result;
255 } 256 }
256 257
257 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent) 258 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent)
258 { 259 {
259 m_parentStyleSheet = parent; 260 m_parentStyleSheet = parent;
260 } 261 if (parent)
261 262 m_ownerDocument = parent->ownerDocument();
262 Document* XSLStyleSheet::ownerDocument()
263 {
264 for (XSLStyleSheet* styleSheet = this; styleSheet; styleSheet = styleSheet-> parentStyleSheet()) {
265 Node* node = styleSheet->ownerNode();
266 if (node)
267 return node->document();
268 }
269 return 0;
270 } 263 }
271 264
272 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri) 265 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri)
273 { 266 {
274 bool matchedParent = (parentDoc == document()); 267 bool matchedParent = (parentDoc == document());
275 unsigned len = length(); 268 unsigned len = length();
276 for (unsigned i = 0; i < len; ++i) { 269 for (unsigned i = 0; i < len; ++i) {
277 StyleBase* rule = item(i); 270 StyleBase* rule = item(i);
278 if (rule->isImportRule()) { 271 if (rule->isImportRule()) {
279 XSLImportRule* import = static_cast<XSLImportRule*>(rule); 272 XSLImportRule* import = static_cast<XSLImportRule*>(rule);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 { 306 {
314 ASSERT(!m_processed); 307 ASSERT(!m_processed);
315 ASSERT(!m_stylesheetDocTaken); 308 ASSERT(!m_stylesheetDocTaken);
316 m_processed = true; 309 m_processed = true;
317 m_stylesheetDocTaken = true; 310 m_stylesheetDocTaken = true;
318 } 311 }
319 312
320 } // namespace WebCore 313 } // namespace WebCore
321 314
322 #endif // ENABLE(XSLT) 315 #endif // ENABLE(XSLT)
OLDNEW
« no previous file with comments | « WebCore/xml/XSLStyleSheet.h ('k') | WebCore/xml/XSLStyleSheetQt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698