| 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 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/ShadowTreeStyleSheetCollection.h" | 28 #include "core/dom/ShadowTreeStyleSheetCollection.h" |
| 29 | 29 |
| 30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
| 31 #include "core/css/CSSStyleSheet.h" | 31 #include "core/css/CSSStyleSheet.h" |
| 32 #include "core/css/resolver/StyleResolver.h" | 32 #include "core/css/resolver/StyleResolver.h" |
| 33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
| 34 #include "core/dom/Element.h" | 34 #include "core/dom/Element.h" |
| 35 #include "core/dom/StyleSheetCollections.h" | 35 #include "core/dom/StyleEngine.h" |
| 36 #include "core/dom/shadow/ShadowRoot.h" | 36 #include "core/dom/shadow/ShadowRoot.h" |
| 37 #include "core/html/HTMLStyleElement.h" | 37 #include "core/html/HTMLStyleElement.h" |
| 38 #include "core/page/Settings.h" | 38 #include "core/page/Settings.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 using namespace HTMLNames; | 42 using namespace HTMLNames; |
| 43 | 43 |
| 44 ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot& shado
wRoot) | 44 ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot& shado
wRoot) |
| 45 : StyleSheetCollection(shadowRoot) | 45 : StyleSheetCollection(shadowRoot) |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleSheetCollections* c
ollections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleShee
t> >& activeSheets) | 49 void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine* collections
, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& acti
veSheets) |
| 50 { | 50 { |
| 51 if (document()->settings() && !document()->settings()->authorAndUserStylesEn
abled()) | 51 if (document()->settings() && !document()->settings()->authorAndUserStylesEn
abled()) |
| 52 return; | 52 return; |
| 53 | 53 |
| 54 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); | 54 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); |
| 55 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); | 55 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); |
| 56 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { | 56 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { |
| 57 Node* node = *it; | 57 Node* node = *it; |
| 58 StyleSheet* sheet = 0; | 58 StyleSheet* sheet = 0; |
| 59 CSSStyleSheet* activeSheet = 0; | 59 CSSStyleSheet* activeSheet = 0; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 87 if (rel.contains("alternate") && title.isEmpty()) | 87 if (rel.contains("alternate") && title.isEmpty()) |
| 88 activeSheet = 0; | 88 activeSheet = 0; |
| 89 | 89 |
| 90 if (sheet) | 90 if (sheet) |
| 91 styleSheets.append(sheet); | 91 styleSheets.append(sheet); |
| 92 if (activeSheet) | 92 if (activeSheet) |
| 93 activeSheets.append(activeSheet); | 93 activeSheets.append(activeSheet); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleSheetCollectio
ns* collections, StyleResolverUpdateMode updateMode) | 97 bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine* collec
tions, StyleResolverUpdateMode updateMode) |
| 98 { | 98 { |
| 99 Vector<RefPtr<StyleSheet> > styleSheets; | 99 Vector<RefPtr<StyleSheet> > styleSheets; |
| 100 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; | 100 Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; |
| 101 collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); | 101 collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); |
| 102 | 102 |
| 103 bool requiresFullStyleRecalc = true; | 103 bool requiresFullStyleRecalc = true; |
| 104 | 104 |
| 105 // If we have already decided to destroy StyleResolver, we don't need to ana
lyze. Reconstruction will take care. | 105 // If we have already decided to destroy StyleResolver, we don't need to ana
lyze. Reconstruction will take care. |
| 106 if (StyleResolver* styleResolver = document()->styleResolverIfExists()) { | 106 if (StyleResolver* styleResolver = document()->styleResolverIfExists()) { |
| 107 StyleResolverUpdateType styleResolverUpdateType; | 107 StyleResolverUpdateType styleResolverUpdateType; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 123 } | 123 } |
| 124 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); | 124 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); |
| 125 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); | 125 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); |
| 126 m_styleSheetsForStyleSheetList.swap(styleSheets); | 126 m_styleSheetsForStyleSheetList.swap(styleSheets); |
| 127 updateUsesRemUnits(); | 127 updateUsesRemUnits(); |
| 128 | 128 |
| 129 return requiresFullStyleRecalc; | 129 return requiresFullStyleRecalc; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } | 132 } |
| OLD | NEW |