| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Rob Buis | 2 * Copyright (C) 2006, 2007 Rob Buis |
| 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. | 3 * Copyright (C) 2008 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, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 if (shadowRoot) | 95 if (shadowRoot) |
| 96 shadowRoot->unregisterScopedHTMLStyleChild(); | 96 shadowRoot->unregisterScopedHTMLStyleChild(); |
| 97 | 97 |
| 98 Document& document = element->document(); | 98 Document& document = element->document(); |
| 99 if (m_registeredAsCandidate) { | 99 if (m_registeredAsCandidate) { |
| 100 document.styleEngine().removeStyleSheetCandidateNode(element, shadowRoot
? *toTreeScope(shadowRoot) : toTreeScope(document)); | 100 document.styleEngine().removeStyleSheetCandidateNode(element, shadowRoot
? *toTreeScope(shadowRoot) : toTreeScope(document)); |
| 101 m_registeredAsCandidate = false; | 101 m_registeredAsCandidate = false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 RefPtrWillBeRawPtr<StyleSheet> removedSheet = m_sheet.get(); | 104 RawPtr<StyleSheet> removedSheet = m_sheet.get(); |
| 105 | 105 |
| 106 if (m_sheet) | 106 if (m_sheet) |
| 107 clearSheet(element); | 107 clearSheet(element); |
| 108 if (removedSheet) | 108 if (removedSheet) |
| 109 document.removedStyleSheet(removedSheet.get(), AnalyzedStyleUpdate); | 109 document.removedStyleSheet(removedSheet.get(), AnalyzedStyleUpdate); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void StyleElement::clearDocumentData(Document& document, Element* element) | 112 void StyleElement::clearDocumentData(Document& document, Element* element) |
| 113 { | 113 { |
| 114 if (m_sheet) | 114 if (m_sheet) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ASSERT(e->inDocument()); | 176 ASSERT(e->inDocument()); |
| 177 Document& document = e->document(); | 177 Document& document = e->document(); |
| 178 | 178 |
| 179 const ContentSecurityPolicy* csp = document.contentSecurityPolicy(); | 179 const ContentSecurityPolicy* csp = document.contentSecurityPolicy(); |
| 180 bool passesContentSecurityPolicyChecks = shouldBypassMainWorldCSP(e) | 180 bool passesContentSecurityPolicyChecks = shouldBypassMainWorldCSP(e) |
| 181 || csp->allowStyleWithHash(text) | 181 || csp->allowStyleWithHash(text) |
| 182 || csp->allowStyleWithNonce(e->fastGetAttribute(HTMLNames::nonceAttr)) | 182 || csp->allowStyleWithNonce(e->fastGetAttribute(HTMLNames::nonceAttr)) |
| 183 || csp->allowInlineStyle(e->document().url(), m_startPosition.m_line, te
xt); | 183 || csp->allowInlineStyle(e->document().url(), m_startPosition.m_line, te
xt); |
| 184 | 184 |
| 185 // Clearing the current sheet may remove the cache entry so create the new s
heet first | 185 // Clearing the current sheet may remove the cache entry so create the new s
heet first |
| 186 RefPtrWillBeRawPtr<CSSStyleSheet> newSheet = nullptr; | 186 RawPtr<CSSStyleSheet> newSheet = nullptr; |
| 187 | 187 |
| 188 // If type is empty or CSS, this is a CSS style sheet. | 188 // If type is empty or CSS, this is a CSS style sheet. |
| 189 const AtomicString& type = this->type(); | 189 const AtomicString& type = this->type(); |
| 190 if (isCSS(e, type) && passesContentSecurityPolicyChecks) { | 190 if (isCSS(e, type) && passesContentSecurityPolicyChecks) { |
| 191 RefPtrWillBeRawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(m
edia()); | 191 RawPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); |
| 192 | 192 |
| 193 MediaQueryEvaluator screenEval("screen", true); | 193 MediaQueryEvaluator screenEval("screen", true); |
| 194 MediaQueryEvaluator printEval("print", true); | 194 MediaQueryEvaluator printEval("print", true); |
| 195 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { | 195 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { |
| 196 m_loading = true; | 196 m_loading = true; |
| 197 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; | 197 TextPosition startPosition = m_startPosition == TextPosition::belowR
angePosition() ? TextPosition::minimumPosition() : m_startPosition; |
| 198 newSheet = document.styleEngine().createSheet(e, text, startPosition
); | 198 newSheet = document.styleEngine().createSheet(e, text, startPosition
); |
| 199 newSheet->setMediaQueries(mediaQueries.release()); | 199 newSheet->setMediaQueries(mediaQueries.release()); |
| 200 m_loading = false; | 200 m_loading = false; |
| 201 } | 201 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 231 { | 231 { |
| 232 document.styleEngine().addPendingSheet(); | 232 document.styleEngine().addPendingSheet(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 DEFINE_TRACE(StyleElement) | 235 DEFINE_TRACE(StyleElement) |
| 236 { | 236 { |
| 237 visitor->trace(m_sheet); | 237 visitor->trace(m_sheet); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |