| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/DocumentStyleSheetCollection.h" | 28 #include "core/dom/DocumentStyleSheetCollection.h" |
| 29 | 29 |
| 30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
| 31 #include "SVGNames.h" | 31 #include "SVGNames.h" |
| 32 #include "core/css/CSSStyleSheet.h" | 32 #include "core/css/CSSStyleSheet.h" |
| 33 #include "core/css/resolver/StyleResolver.h" | 33 #include "core/css/resolver/StyleResolver.h" |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/ProcessingInstruction.h" | 36 #include "core/dom/ProcessingInstruction.h" |
| 37 #include "core/dom/StyleSheetCollections.h" | 37 #include "core/dom/StyleEngine.h" |
| 38 #include "core/html/HTMLIFrameElement.h" | 38 #include "core/html/HTMLIFrameElement.h" |
| 39 #include "core/html/HTMLLinkElement.h" | 39 #include "core/html/HTMLLinkElement.h" |
| 40 #include "core/html/HTMLStyleElement.h" | 40 #include "core/html/HTMLStyleElement.h" |
| 41 #include "core/page/Settings.h" | 41 #include "core/page/Settings.h" |
| 42 #include "core/svg/SVGStyleElement.h" | 42 #include "core/svg/SVGStyleElement.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
| 47 | 47 |
| 48 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope) | 48 DocumentStyleSheetCollection::DocumentStyleSheetCollection(TreeScope& treeScope) |
| 49 : StyleSheetCollection(treeScope) | 49 : StyleSheetCollection(treeScope) |
| 50 { | 50 { |
| 51 ASSERT(treeScope.rootNode() == &treeScope.rootNode()->document()); | 51 ASSERT(treeScope.rootNode() == &treeScope.rootNode()->document()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DocumentStyleSheetCollection::collectStyleSheets(StyleSheetCollections* col
lections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet>
>& activeSheets) | 54 void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* collections,
Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& active
Sheets) |
| 55 { | 55 { |
| 56 if (document()->settings() && !document()->settings()->authorAndUserStylesEn
abled()) | 56 if (document()->settings() && !document()->settings()->authorAndUserStylesEn
abled()) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); | 59 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); |
| 60 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); | 60 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); |
| 61 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { | 61 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { |
| 62 Node* n = *it; | 62 Node* n = *it; |
| 63 StyleSheet* sheet = 0; | 63 StyleSheet* sheet = 0; |
| 64 CSSStyleSheet* activeSheet = 0; | 64 CSSStyleSheet* activeSheet = 0; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (activeSheet) | 136 if (activeSheet) |
| 137 activeSheets.append(activeSheet); | 137 activeSheets.append(activeSheet); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyl
eSheet> >& sheets, Document* document) | 141 static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyl
eSheet> >& sheets, Document* document) |
| 142 { | 142 { |
| 143 HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame(); | 143 HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame(); |
| 144 if (!seamlessParentIFrame) | 144 if (!seamlessParentIFrame) |
| 145 return; | 145 return; |
| 146 sheets.append(seamlessParentIFrame->document().styleSheetCollections()->acti
veAuthorStyleSheets()); | 146 sheets.append(seamlessParentIFrame->document().styleEngine()->activeAuthorSt
yleSheets()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleSheetCollections
* collections, StyleResolverUpdateMode updateMode) | 149 bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* collecti
ons, StyleResolverUpdateMode updateMode) |
| 150 { | 150 { |
| 151 Vector<RefPtr<StyleSheet> > styleSheets; | 151 Vector<RefPtr<StyleSheet> > styleSheets; |
| 152 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; | 152 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; |
| 153 activeCSSStyleSheets.append(collections->injectedAuthorStyleSheets()); | 153 activeCSSStyleSheets.append(collections->injectedAuthorStyleSheets()); |
| 154 activeCSSStyleSheets.append(collections->documentAuthorStyleSheets()); | 154 activeCSSStyleSheets.append(collections->documentAuthorStyleSheets()); |
| 155 collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, documen
t()); | 155 collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, documen
t()); |
| 156 collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); | 156 collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); |
| 157 | 157 |
| 158 StyleResolverUpdateType styleResolverUpdateType; | 158 StyleResolverUpdateType styleResolverUpdateType; |
| 159 bool requiresFullStyleRecalc; | 159 bool requiresFullStyleRecalc; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 177 } | 177 } |
| 178 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); | 178 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); |
| 179 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); | 179 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); |
| 180 m_styleSheetsForStyleSheetList.swap(styleSheets); | 180 m_styleSheetsForStyleSheetList.swap(styleSheets); |
| 181 updateUsesRemUnits(); | 181 updateUsesRemUnits(); |
| 182 | 182 |
| 183 return requiresFullStyleRecalc; | 183 return requiresFullStyleRecalc; |
| 184 } | 184 } |
| 185 | 185 |
| 186 } | 186 } |
| OLD | NEW |