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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 11 matching lines...) Expand all Loading... |
22 * | 22 * |
23 * You should have received a copy of the GNU Library General Public License | 23 * You should have received a copy of the GNU Library General Public License |
24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
27 */ | 27 */ |
28 | 28 |
29 #include "core/dom/StyleSheetCollection.h" | 29 #include "core/dom/StyleSheetCollection.h" |
30 | 30 |
31 #include "core/css/CSSStyleSheet.h" | 31 #include "core/css/CSSStyleSheet.h" |
| 32 #include "core/css/RuleSet.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 StyleSheetCollection::StyleSheetCollection() {} | 36 StyleSheetCollection::StyleSheetCollection() {} |
36 | 37 |
37 void StyleSheetCollection::dispose() { | 38 void StyleSheetCollection::dispose() { |
38 m_styleSheetsForStyleSheetList.clear(); | 39 m_styleSheetsForStyleSheetList.clear(); |
39 m_activeAuthorStyleSheets.clear(); | 40 m_activeAuthorStyleSheets.clear(); |
40 } | 41 } |
41 | 42 |
42 void StyleSheetCollection::swap(StyleSheetCollection& other) { | 43 void StyleSheetCollection::swap(StyleSheetCollection& other) { |
43 ::blink::swap(m_styleSheetsForStyleSheetList, | 44 ::blink::swap(m_styleSheetsForStyleSheetList, |
44 other.m_styleSheetsForStyleSheetList, this, &other); | 45 other.m_styleSheetsForStyleSheetList, this, &other); |
45 m_activeAuthorStyleSheets.swap(other.m_activeAuthorStyleSheets); | 46 m_activeAuthorStyleSheets.swap(other.m_activeAuthorStyleSheets); |
46 } | 47 } |
47 | 48 |
48 void StyleSheetCollection::swapSheetsForSheetList( | 49 void StyleSheetCollection::swapSheetsForSheetList( |
49 HeapVector<Member<StyleSheet>>& sheets) { | 50 HeapVector<Member<StyleSheet>>& sheets) { |
50 // Only called for collection of HTML Imports that never has active sheets. | 51 // Only called for collection of HTML Imports that never has active sheets. |
51 DCHECK(m_activeAuthorStyleSheets.isEmpty()); | 52 DCHECK(m_activeAuthorStyleSheets.isEmpty()); |
52 ::blink::swap(m_styleSheetsForStyleSheetList, sheets, this); | 53 ::blink::swap(m_styleSheetsForStyleSheetList, sheets, this); |
53 } | 54 } |
54 | 55 |
55 void StyleSheetCollection::appendActiveStyleSheet(CSSStyleSheet* sheet) { | 56 void StyleSheetCollection::appendActiveStyleSheet( |
56 m_activeAuthorStyleSheets.append(sheet); | 57 const ActiveStyleSheet& activeSheet) { |
57 } | 58 m_activeAuthorStyleSheets.append(activeSheet); |
58 | |
59 void StyleSheetCollection::appendActiveStyleSheets( | |
60 const HeapVector<Member<CSSStyleSheet>>& sheets) { | |
61 m_activeAuthorStyleSheets.appendVector(sheets); | |
62 } | |
63 | |
64 void StyleSheetCollection::appendActiveStyleSheets( | |
65 const HeapVector<TraceWrapperMember<CSSStyleSheet>>& sheets) { | |
66 for (CSSStyleSheet* sheet : sheets) { | |
67 m_activeAuthorStyleSheets.append(sheet); | |
68 } | |
69 } | 59 } |
70 | 60 |
71 void StyleSheetCollection::appendSheetForList(StyleSheet* sheet) { | 61 void StyleSheetCollection::appendSheetForList(StyleSheet* sheet) { |
72 m_styleSheetsForStyleSheetList.append( | 62 m_styleSheetsForStyleSheetList.append( |
73 TraceWrapperMember<StyleSheet>(this, sheet)); | 63 TraceWrapperMember<StyleSheet>(this, sheet)); |
74 } | 64 } |
75 | 65 |
76 DEFINE_TRACE(StyleSheetCollection) { | 66 DEFINE_TRACE(StyleSheetCollection) { |
77 visitor->trace(m_activeAuthorStyleSheets); | 67 visitor->trace(m_activeAuthorStyleSheets); |
78 visitor->trace(m_styleSheetsForStyleSheetList); | 68 visitor->trace(m_styleSheetsForStyleSheetList); |
79 } | 69 } |
80 | 70 |
81 DEFINE_TRACE_WRAPPERS(StyleSheetCollection) { | 71 DEFINE_TRACE_WRAPPERS(StyleSheetCollection) { |
82 for (auto sheet : m_styleSheetsForStyleSheetList) { | 72 for (auto sheet : m_styleSheetsForStyleSheetList) { |
83 visitor->traceWrappers(sheet); | 73 visitor->traceWrappers(sheet); |
84 } | 74 } |
85 } | 75 } |
86 | 76 |
87 } // namespace blink | 77 } // namespace blink |
OLD | NEW |