| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 StyleSheetCollection::StyleSheetCollection(TreeScope& treeScope) | 40 StyleSheetCollection::StyleSheetCollection(TreeScope& treeScope) |
| 41 : m_treeScope(treeScope) | 41 : m_treeScope(treeScope) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 StyleSheetCollection::~StyleSheetCollection() | 45 StyleSheetCollection::~StyleSheetCollection() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void StyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool) | 49 void StyleSheetCollection::addStyleSheetCandidateNode(HTMLStyleElement& element) |
| 50 { | 50 { |
| 51 if (!node->inDocument()) | 51 ASSERT(element.inActiveDocument()); |
| 52 return; | 52 m_styleSheetCandidateNodes.add(&element); |
| 53 | |
| 54 // Until the <body> exists, we have no choice but to compare document positi
ons, | |
| 55 // since styles outside of the body and head continue to be shunted into the
head | |
| 56 // (and thus can shift to end up before dynamically added DOM content that i
s also | |
| 57 // outside the body). | |
| 58 m_styleSheetCandidateNodes.add(node); | |
| 59 } | 53 } |
| 60 | 54 |
| 61 void StyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNo
de* scopingNode) | 55 void StyleSheetCollection::removeStyleSheetCandidateNode(HTMLStyleElement& eleme
nt) |
| 62 { | 56 { |
| 63 m_styleSheetCandidateNodes.remove(node); | 57 m_styleSheetCandidateNodes.remove(&element); |
| 64 } | 58 } |
| 65 | 59 |
| 66 void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& she
ets) | 60 void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& she
ets) |
| 67 { | 61 { |
| 68 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); | 62 for (Node* node : m_styleSheetCandidateNodes) { |
| 69 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); | 63 ASSERT(isHTMLStyleElement(*node)); |
| 70 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { | |
| 71 Node* node = *it; | |
| 72 if (!isHTMLStyleElement(*node)) | |
| 73 continue; | |
| 74 if (CSSStyleSheet* sheet = toHTMLStyleElement(node)->sheet()) | 64 if (CSSStyleSheet* sheet = toHTMLStyleElement(node)->sheet()) |
| 75 sheets.append(sheet); | 65 sheets.append(sheet); |
| 76 } | 66 } |
| 77 } | 67 } |
| 78 | 68 |
| 79 void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine) | 69 void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine) |
| 80 { | 70 { |
| 81 Vector<RefPtr<CSSStyleSheet>> candidateSheets; | 71 Vector<RefPtr<CSSStyleSheet>> candidateSheets; |
| 82 collectStyleSheets(candidateSheets); | 72 collectStyleSheets(candidateSheets); |
| 83 | 73 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 103 | 93 |
| 104 // TODO(esprehn): We should use LocalStyleChange, :host rule changes | 94 // TODO(esprehn): We should use LocalStyleChange, :host rule changes |
| 105 // can only impact the host directly as Sky has no descendant selectors. | 95 // can only impact the host directly as Sky has no descendant selectors. |
| 106 if (root.isShadowRoot()) | 96 if (root.isShadowRoot()) |
| 107 toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange); | 97 toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange); |
| 108 | 98 |
| 109 m_activeAuthorStyleSheets.swap(candidateSheets); | 99 m_activeAuthorStyleSheets.swap(candidateSheets); |
| 110 } | 100 } |
| 111 | 101 |
| 112 } | 102 } |
| OLD | NEW |