| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
WillBeMember<CSSStyleSheet>>& styleSheets) | 181 void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
WillBeMember<CSSStyleSheet>>& styleSheets) |
| 182 { | 182 { |
| 183 for (unsigned i = 0; i < styleSheets.size(); ++i) | 183 for (unsigned i = 0; i < styleSheets.size(); ++i) |
| 184 m_pendingStyleSheets.remove(styleSheets[i].get()); | 184 m_pendingStyleSheets.remove(styleSheets[i].get()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet) | 187 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet) |
| 188 { | 188 { |
| 189 ASSERT(!cssSheet.disabled()); | 189 ASSERT(!cssSheet.disabled()); |
| 190 ASSERT(cssSheet.ownerDocument()); |
| 191 ASSERT(cssSheet.ownerNode()); |
| 192 ASSERT(isHTMLStyleElement(cssSheet.ownerNode()) || isSVGStyleElement(cssShee
t.ownerNode()) || cssSheet.ownerNode()->treeScope() == cssSheet.ownerDocument())
; |
| 193 |
| 190 if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_v
iewportDependentMediaQueryResults)) | 194 if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_v
iewportDependentMediaQueryResults)) |
| 191 return; | 195 return; |
| 192 | 196 |
| 193 TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), &cssShe
et); | 197 TreeScope* treeScope = &cssSheet.ownerNode()->treeScope(); |
| 194 if (!treeScope) | 198 // Sheets in the document scope of HTML imports apply to the main document |
| 195 return; | 199 // (m_document), so we override it for all document scoped sheets. |
| 196 | 200 if (treeScope->rootNode().isDocumentNode()) |
| 201 treeScope = m_document; |
| 197 treeScope->ensureScopedStyleResolver().appendCSSStyleSheet(cssSheet, *m_medi
um); | 202 treeScope->ensureScopedStyleResolver().appendCSSStyleSheet(cssSheet, *m_medi
um); |
| 198 } | 203 } |
| 199 | 204 |
| 200 void StyleResolver::appendPendingAuthorStyleSheets() | 205 void StyleResolver::appendPendingAuthorStyleSheets() |
| 201 { | 206 { |
| 202 for (const auto& styleSheet : m_pendingStyleSheets) | 207 for (const auto& styleSheet : m_pendingStyleSheets) |
| 203 appendCSSStyleSheet(*styleSheet); | 208 appendCSSStyleSheet(*styleSheet); |
| 204 | 209 |
| 205 m_pendingStyleSheets.clear(); | 210 m_pendingStyleSheets.clear(); |
| 206 finishAppendAuthorStyleSheets(); | 211 finishAppendAuthorStyleSheets(); |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 visitor->trace(m_watchedSelectorsRules); | 1444 visitor->trace(m_watchedSelectorsRules); |
| 1440 visitor->trace(m_treeBoundaryCrossingRules); | 1445 visitor->trace(m_treeBoundaryCrossingRules); |
| 1441 visitor->trace(m_styleResourceLoader); | 1446 visitor->trace(m_styleResourceLoader); |
| 1442 visitor->trace(m_styleSharingLists); | 1447 visitor->trace(m_styleSharingLists); |
| 1443 visitor->trace(m_pendingStyleSheets); | 1448 visitor->trace(m_pendingStyleSheets); |
| 1444 visitor->trace(m_document); | 1449 visitor->trace(m_document); |
| 1445 #endif | 1450 #endif |
| 1446 } | 1451 } |
| 1447 | 1452 |
| 1448 } // namespace blink | 1453 } // namespace blink |
| OLD | NEW |