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 6508005: Revert 78366 - 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)
61 , m_embedded(false) 60 , m_embedded(false)
62 , m_processed(false) // Child sheets get marked as processed when the libxsl t engine has finally seen them. 61 , m_processed(false) // Child sheets get marked as processed when the libxsl t engine has finally seen them.
63 , m_stylesheetDoc(0) 62 , m_stylesheetDoc(0)
64 , m_stylesheetDocTaken(false) 63 , m_stylesheetDocTaken(false)
65 , m_parentStyleSheet(0) 64 , m_parentStyleSheet(0)
66 { 65 {
67 } 66 }
68 67
69 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded) 68 XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded)
70 : StyleSheet(parentNode, originalURL, finalURL) 69 : StyleSheet(parentNode, originalURL, finalURL)
71 , m_ownerDocument(parentNode->document())
72 , m_embedded(embedded) 70 , m_embedded(embedded)
73 , m_processed(true) // The root sheet starts off processed. 71 , m_processed(true) // The root sheet starts off processed.
74 , m_stylesheetDoc(0) 72 , m_stylesheetDoc(0)
75 , m_stylesheetDocTaken(false) 73 , m_stylesheetDocTaken(false)
76 , m_parentStyleSheet(0) 74 , m_parentStyleSheet(0)
77 { 75 {
78 } 76 }
79 77
80 XSLStyleSheet::~XSLStyleSheet() 78 XSLStyleSheet::~XSLStyleSheet()
81 { 79 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (rule->isImportRule()) { 121 if (rule->isImportRule()) {
124 XSLImportRule* import = static_cast<XSLImportRule*>(rule); 122 XSLImportRule* import = static_cast<XSLImportRule*>(rule);
125 if (import->styleSheet()) 123 if (import->styleSheet())
126 import->styleSheet()->clearDocuments(); 124 import->styleSheet()->clearDocuments();
127 } 125 }
128 } 126 }
129 } 127 }
130 128
131 CachedResourceLoader* XSLStyleSheet::cachedResourceLoader() 129 CachedResourceLoader* XSLStyleSheet::cachedResourceLoader()
132 { 130 {
133 if (!m_ownerDocument) 131 Document* document = ownerDocument();
132 if (!document)
134 return 0; 133 return 0;
135 return m_ownerDocument->cachedResourceLoader(); 134 return document->cachedResourceLoader();
136 } 135 }
137 136
138 bool XSLStyleSheet::parseString(const String& string, bool) 137 bool XSLStyleSheet::parseString(const String& string, bool)
139 { 138 {
140 // Parse in a single chunk into an xmlDocPtr 139 // Parse in a single chunk into an xmlDocPtr
141 const UChar BOM = 0xFEFF; 140 const UChar BOM = 0xFEFF;
142 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B OM); 141 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B OM);
143 if (!m_stylesheetDocTaken) 142 if (!m_stylesheetDocTaken)
144 xmlFreeDoc(m_stylesheetDoc); 143 xmlFreeDoc(m_stylesheetDoc);
145 m_stylesheetDocTaken = false; 144 m_stylesheetDocTaken = false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ASSERT(!m_stylesheetDocTaken); 250 ASSERT(!m_stylesheetDocTaken);
252 xsltStylesheetPtr result = xsltParseStylesheetDoc(m_stylesheetDoc); 251 xsltStylesheetPtr result = xsltParseStylesheetDoc(m_stylesheetDoc);
253 if (result) 252 if (result)
254 m_stylesheetDocTaken = true; 253 m_stylesheetDocTaken = true;
255 return result; 254 return result;
256 } 255 }
257 256
258 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent) 257 void XSLStyleSheet::setParentStyleSheet(XSLStyleSheet* parent)
259 { 258 {
260 m_parentStyleSheet = parent; 259 m_parentStyleSheet = parent;
261 if (parent) 260 }
262 m_ownerDocument = parent->ownerDocument(); 261
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;
263 } 270 }
264 271
265 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri) 272 xmlDocPtr XSLStyleSheet::locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri)
266 { 273 {
267 bool matchedParent = (parentDoc == document()); 274 bool matchedParent = (parentDoc == document());
268 unsigned len = length(); 275 unsigned len = length();
269 for (unsigned i = 0; i < len; ++i) { 276 for (unsigned i = 0; i < len; ++i) {
270 StyleBase* rule = item(i); 277 StyleBase* rule = item(i);
271 if (rule->isImportRule()) { 278 if (rule->isImportRule()) {
272 XSLImportRule* import = static_cast<XSLImportRule*>(rule); 279 XSLImportRule* import = static_cast<XSLImportRule*>(rule);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 { 313 {
307 ASSERT(!m_processed); 314 ASSERT(!m_processed);
308 ASSERT(!m_stylesheetDocTaken); 315 ASSERT(!m_stylesheetDocTaken);
309 m_processed = true; 316 m_processed = true;
310 m_stylesheetDocTaken = true; 317 m_stylesheetDocTaken = true;
311 } 318 }
312 319
313 } // namespace WebCore 320 } // namespace WebCore
314 321
315 #endif // ENABLE(XSLT) 322 #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