1e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch/* 2e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * (C) 1999 Antti Koivisto (koivisto@kde.org) 4e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * (C) 2001 Dirk Mueller (mueller@kde.org) 5e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. 7e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 8e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 902772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch * Copyright (C) 2013 Google Inc. All rights reserved. 10e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * 11e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * This library is free software; you can redistribute it and/or 12e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * modify it under the terms of the GNU Library General Public 13e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * License as published by the Free Software Foundation; either 14e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * version 2 of the License, or (at your option) any later version. 15e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * 16e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * This library is distributed in the hope that it will be useful, 17e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * but WITHOUT ANY WARRANTY; without even the implied warranty of 18e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Library General Public License for more details. 20e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * 21e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * You should have received a copy of the GNU Library General Public License 22e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * along with this library; see the file COPYING.LIB. If not, write to 23e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Boston, MA 02110-1301, USA. 25e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch */ 26e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 27e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "config.h" 28e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "core/dom/StyleSheetCollection.h" 29e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 30e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "core/css/CSSStyleSheet.h" 31e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 32c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 33e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 3409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)StyleSheetCollection::StyleSheetCollection() 3551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){ 3651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} 3751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) 3809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)StyleSheetCollection::~StyleSheetCollection() 3951b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){ 4051b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} 4151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) 4209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void StyleSheetCollection::swap(StyleSheetCollection& other) 4351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles){ 4451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) m_styleSheetsForStyleSheetList.swap(other.m_styleSheetsForStyleSheetList); 4551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) m_activeAuthorStyleSheets.swap(other.m_activeAuthorStyleSheets); 4651b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} 4751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles) 48d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)void StyleSheetCollection::swapSheetsForSheetList(WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >& sheets) 49e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch{ 5009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) // Only called for collection of HTML Imports that never has active sheets. 5109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) ASSERT(m_activeAuthorStyleSheets.isEmpty()); 5209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) m_styleSheetsForStyleSheetList.swap(sheets); 53e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch} 54e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 5543e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)void StyleSheetCollection::appendActiveStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& sheets) 56e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch{ 57d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_activeAuthorStyleSheets.appendVector(sheets); 58e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)} 59e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles) 6009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void StyleSheetCollection::appendActiveStyleSheet(CSSStyleSheet* sheet) 61e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles){ 6209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) m_activeAuthorStyleSheets.append(sheet); 63e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)} 64e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles) 6509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void StyleSheetCollection::appendSheetForList(StyleSheet* sheet) 66e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles){ 6709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) m_styleSheetsForStyleSheetList.append(sheet); 68e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles)} 69e1f1df5f01594c0e62e751e4b46e779b85c2faa5Torne (Richard Coles) 7043e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)void StyleSheetCollection::trace(Visitor* visitor) 7143e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles){ 7243e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) visitor->trace(m_activeAuthorStyleSheets); 7343e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) visitor->trace(m_styleSheetsForStyleSheetList); 7443e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles)} 7543e7502580f146aa5b3db8267ba6dbb5c733a489Torne (Richard Coles) 76e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch} 77