OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights | 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 | 66 |
67 void StyleRuleImport::setCSSStyleSheet( | 67 void StyleRuleImport::setCSSStyleSheet( |
68 const String& href, | 68 const String& href, |
69 const KURL& baseURL, | 69 const KURL& baseURL, |
70 const String& charset, | 70 const String& charset, |
71 const CSSStyleSheetResource* cachedStyleSheet) { | 71 const CSSStyleSheetResource* cachedStyleSheet) { |
72 if (m_styleSheet) | 72 if (m_styleSheet) |
73 m_styleSheet->clearOwnerRule(); | 73 m_styleSheet->clearOwnerRule(); |
74 | 74 |
75 CSSParserContext context = m_parentStyleSheet | 75 CSSParserContext* context = new CSSParserContext( |
76 ? m_parentStyleSheet->parserContext() | 76 m_parentStyleSheet ? m_parentStyleSheet->parserContext() |
77 : strictCSSParserContext(); | 77 : strictCSSParserContext(), |
78 context.setCharset(charset); | 78 nullptr); |
| 79 context->setCharset(charset); |
79 Document* document = | 80 Document* document = |
80 m_parentStyleSheet ? m_parentStyleSheet->singleOwnerDocument() : nullptr; | 81 m_parentStyleSheet ? m_parentStyleSheet->singleOwnerDocument() : nullptr; |
81 if (!baseURL.isNull()) { | 82 if (!baseURL.isNull()) { |
82 context.setBaseURL(baseURL); | 83 context->setBaseURL(baseURL); |
83 if (document) | 84 if (document) { |
84 context.setReferrer(Referrer(baseURL.strippedForUseAsReferrer(), | 85 context->setReferrer(Referrer(baseURL.strippedForUseAsReferrer(), |
85 document->getReferrerPolicy())); | 86 document->getReferrerPolicy())); |
| 87 } |
86 } | 88 } |
87 | 89 |
88 m_styleSheet = StyleSheetContents::create(this, href, context); | 90 m_styleSheet = StyleSheetContents::create(this, href, context); |
89 | 91 |
90 m_styleSheet->parseAuthorStyleSheet( | 92 m_styleSheet->parseAuthorStyleSheet( |
91 cachedStyleSheet, document ? document->getSecurityOrigin() : 0); | 93 cachedStyleSheet, document ? document->getSecurityOrigin() : 0); |
92 | 94 |
93 m_loading = false; | 95 m_loading = false; |
94 | 96 |
95 if (m_parentStyleSheet) { | 97 if (m_parentStyleSheet) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // the sheet being imported is pending. | 144 // the sheet being imported is pending. |
143 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && | 145 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && |
144 rootSheet == m_parentStyleSheet) | 146 rootSheet == m_parentStyleSheet) |
145 m_parentStyleSheet->startLoadingDynamicSheet(); | 147 m_parentStyleSheet->startLoadingDynamicSheet(); |
146 m_loading = true; | 148 m_loading = true; |
147 m_resource->addClient(m_styleSheetClient); | 149 m_resource->addClient(m_styleSheetClient); |
148 } | 150 } |
149 } | 151 } |
150 | 152 |
151 } // namespace blink | 153 } // namespace blink |
OLD | NEW |