| 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" | |
| 33 | 32 |
| 34 namespace blink { | 33 namespace blink { |
| 35 | 34 |
| 36 StyleSheetCollection::StyleSheetCollection() {} | 35 StyleSheetCollection::StyleSheetCollection() {} |
| 37 | 36 |
| 38 void StyleSheetCollection::dispose() { | 37 void StyleSheetCollection::dispose() { |
| 39 m_styleSheetsForStyleSheetList.clear(); | 38 m_styleSheetsForStyleSheetList.clear(); |
| 40 m_activeAuthorStyleSheets.clear(); | 39 m_activeAuthorStyleSheets.clear(); |
| 41 } | 40 } |
| 42 | 41 |
| 43 void StyleSheetCollection::swap(StyleSheetCollection& other) { | 42 void StyleSheetCollection::swap(StyleSheetCollection& other) { |
| 44 ::blink::swap(m_styleSheetsForStyleSheetList, | 43 ::blink::swap(m_styleSheetsForStyleSheetList, |
| 45 other.m_styleSheetsForStyleSheetList, this, &other); | 44 other.m_styleSheetsForStyleSheetList, this, &other); |
| 46 m_activeAuthorStyleSheets.swap(other.m_activeAuthorStyleSheets); | 45 m_activeAuthorStyleSheets.swap(other.m_activeAuthorStyleSheets); |
| 47 } | 46 } |
| 48 | 47 |
| 49 void StyleSheetCollection::swapSheetsForSheetList( | 48 void StyleSheetCollection::swapSheetsForSheetList( |
| 50 HeapVector<Member<StyleSheet>>& sheets) { | 49 HeapVector<Member<StyleSheet>>& sheets) { |
| 51 // Only called for collection of HTML Imports that never has active sheets. | 50 // Only called for collection of HTML Imports that never has active sheets. |
| 52 DCHECK(m_activeAuthorStyleSheets.isEmpty()); | 51 DCHECK(m_activeAuthorStyleSheets.isEmpty()); |
| 53 ::blink::swap(m_styleSheetsForStyleSheetList, sheets, this); | 52 ::blink::swap(m_styleSheetsForStyleSheetList, sheets, this); |
| 54 } | 53 } |
| 55 | 54 |
| 56 void StyleSheetCollection::appendActiveStyleSheet( | 55 void StyleSheetCollection::appendActiveStyleSheet(CSSStyleSheet* sheet) { |
| 57 const ActiveStyleSheet& activeSheet) { | 56 m_activeAuthorStyleSheets.append(sheet); |
| 58 m_activeAuthorStyleSheets.append(activeSheet); | 57 } |
| 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 } |
| 59 } | 69 } |
| 60 | 70 |
| 61 void StyleSheetCollection::appendSheetForList(StyleSheet* sheet) { | 71 void StyleSheetCollection::appendSheetForList(StyleSheet* sheet) { |
| 62 m_styleSheetsForStyleSheetList.append( | 72 m_styleSheetsForStyleSheetList.append( |
| 63 TraceWrapperMember<StyleSheet>(this, sheet)); | 73 TraceWrapperMember<StyleSheet>(this, sheet)); |
| 64 } | 74 } |
| 65 | 75 |
| 66 DEFINE_TRACE(StyleSheetCollection) { | 76 DEFINE_TRACE(StyleSheetCollection) { |
| 67 visitor->trace(m_activeAuthorStyleSheets); | 77 visitor->trace(m_activeAuthorStyleSheets); |
| 68 visitor->trace(m_styleSheetsForStyleSheetList); | 78 visitor->trace(m_styleSheetsForStyleSheetList); |
| 69 } | 79 } |
| 70 | 80 |
| 71 DEFINE_TRACE_WRAPPERS(StyleSheetCollection) { | 81 DEFINE_TRACE_WRAPPERS(StyleSheetCollection) { |
| 72 for (auto sheet : m_styleSheetsForStyleSheetList) { | 82 for (auto sheet : m_styleSheetsForStyleSheetList) { |
| 73 visitor->traceWrappers(sheet); | 83 visitor->traceWrappers(sheet); |
| 74 } | 84 } |
| 75 } | 85 } |
| 76 | 86 |
| 77 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |