| OLD | NEW |
| 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 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "core/xml/XSLImportRule.h" | 23 #include "core/xml/XSLImportRule.h" |
| 24 | 24 |
| 25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
| 26 #include "core/loader/cache/CachedResourceLoader.h" | 26 #include "core/loader/cache/CachedResourceLoader.h" |
| 27 #include "core/loader/cache/CachedResourceRequest.h" | 27 #include "core/loader/cache/CachedResourceRequest.h" |
| 28 #include "core/loader/cache/CachedResourceRequestInitiators.h" |
| 28 #include "core/loader/cache/CachedXSLStyleSheet.h" | 29 #include "core/loader/cache/CachedXSLStyleSheet.h" |
| 29 #include "core/xml/XSLStyleSheet.h" | 30 #include "core/xml/XSLStyleSheet.h" |
| 30 | 31 |
| 31 namespace WebCore { | 32 namespace WebCore { |
| 32 | 33 |
| 33 XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href) | 34 XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href) |
| 34 : m_parentStyleSheet(parent) | 35 : m_parentStyleSheet(parent) |
| 35 , m_strHref(href) | 36 , m_strHref(href) |
| 36 , m_cachedSheet(0) | 37 , m_cachedSheet(0) |
| 37 , m_loading(false) | 38 , m_loading(false) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // use parent styleheet's URL as the base URL | 91 // use parent styleheet's URL as the base URL |
| 91 absHref = KURL(parentSheet->baseURL(), m_strHref).string(); | 92 absHref = KURL(parentSheet->baseURL(), m_strHref).string(); |
| 92 | 93 |
| 93 // Check for a cycle in our import chain. If we encounter a stylesheet | 94 // Check for a cycle in our import chain. If we encounter a stylesheet |
| 94 // in our parent chain with the same URL, then just bail. | 95 // in our parent chain with the same URL, then just bail. |
| 95 for (XSLStyleSheet* parentSheet = parentStyleSheet(); parentSheet; parentShe
et = parentSheet->parentStyleSheet()) { | 96 for (XSLStyleSheet* parentSheet = parentStyleSheet(); parentSheet; parentShe
et = parentSheet->parentStyleSheet()) { |
| 96 if (absHref == parentSheet->baseURL().string()) | 97 if (absHref == parentSheet->baseURL().string()) |
| 97 return; | 98 return; |
| 98 } | 99 } |
| 99 | 100 |
| 100 CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document
()->completeURL(absHref))); | 101 CachedResourceRequest request(ResourceRequest(cachedResourceLoader->document
()->completeURL(absHref)), cachedResourceRequestInitiators().xml); |
| 101 m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet(request); | 102 m_cachedSheet = cachedResourceLoader->requestXSLStyleSheet(request); |
| 102 | 103 |
| 103 if (m_cachedSheet) { | 104 if (m_cachedSheet) { |
| 104 m_cachedSheet->addClient(this); | 105 m_cachedSheet->addClient(this); |
| 105 | 106 |
| 106 // If the imported sheet is in the cache, then setXSLStyleSheet gets cal
led, | 107 // If the imported sheet is in the cache, then setXSLStyleSheet gets cal
led, |
| 107 // and the sheet even gets parsed (via parseString). In this case we ha
ve | 108 // and the sheet even gets parsed (via parseString). In this case we ha
ve |
| 108 // loaded (even if our subresources haven't), so if we have a stylesheet
after | 109 // loaded (even if our subresources haven't), so if we have a stylesheet
after |
| 109 // checking the cache, then we've clearly loaded. | 110 // checking the cache, then we've clearly loaded. |
| 110 if (!m_styleSheet) | 111 if (!m_styleSheet) |
| 111 m_loading = true; | 112 m_loading = true; |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace WebCore | 116 } // namespace WebCore |
| OLD | NEW |