109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)/*
209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *           (C) 1999 Antti Koivisto (koivisto@kde.org)
409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *           (C) 2001 Dirk Mueller (mueller@kde.org)
509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *           (C) 2006 Alexey Proskuryakov (ap@webkit.org)
609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Copyright (C) 2013 Google Inc. All rights reserved.
1009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *
1109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * This library is free software; you can redistribute it and/or
1209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * modify it under the terms of the GNU Library General Public
1309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * License as published by the Free Software Foundation; either
1409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * version 2 of the License, or (at your option) any later version.
1509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *
1609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * This library is distributed in the hope that it will be useful,
1709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
1809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Library General Public License for more details.
2009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) *
2109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * You should have received a copy of the GNU Library General Public License
2209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * along with this library; see the file COPYING.LIB.  If not, write to
2309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) * Boston, MA 02110-1301, USA.
2509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles) */
2609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
2709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "config.h"
2809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/dom/TreeScopeStyleSheetCollection.h"
2909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
3009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/css/CSSStyleSheet.h"
3109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/css/StyleRuleImport.h"
3209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/css/StyleSheetContents.h"
3307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch#include "core/css/invalidation/StyleSheetInvalidationAnalysis.h"
3409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/css/resolver/StyleResolver.h"
3509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/dom/Element.h"
3609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/dom/StyleEngine.h"
37d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#include "core/html/HTMLLinkElement.h"
3809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/html/HTMLStyleElement.h"
3909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
40c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
4109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
4209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScope)
4309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    : m_treeScope(treeScope)
4409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    , m_hadActiveLoadingStylesheet(false)
4509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    , m_usesRemUnits(false)
4609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
4709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
4809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
4909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void TreeScopeStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser)
5009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
5109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (!node->inDocument())
5209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
5309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
5409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Until the <body> exists, we have no choice but to compare document positions,
5509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // since styles outside of the body and head continue to be shunted into the head
5609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // (and thus can shift to end up before dynamically added DOM content that is also
5709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // outside the body).
5809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (createdByParser && document().body())
5909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        m_styleSheetCandidateNodes.parserAdd(node);
6009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    else
6109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        m_styleSheetCandidateNodes.add(node);
6209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
6309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
6409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void TreeScopeStyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
6509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
6609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    m_styleSheetCandidateNodes.remove(node);
6709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
6809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
69d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)TreeScopeStyleSheetCollection::StyleResolverUpdateType TreeScopeStyleSheetCollection::compareStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& oldStyleSheets, const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& newStylesheets, WillBeHeapVector<RawPtrWillBeMember<StyleSheetContents> >& addedSheets)
7009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
7109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    unsigned newStyleSheetCount = newStylesheets.size();
7209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    unsigned oldStyleSheetCount = oldStyleSheets.size();
7309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    ASSERT(newStyleSheetCount >= oldStyleSheetCount);
7409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
7509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (!newStyleSheetCount)
7609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return Reconstruct;
7709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
7809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    unsigned newIndex = 0;
7909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    for (unsigned oldIndex = 0; oldIndex < oldStyleSheetCount; ++oldIndex) {
8009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) {
8109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            addedSheets.append(newStylesheets[newIndex]->contents());
8209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            if (++newIndex == newStyleSheetCount)
8309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)                return Reconstruct;
8409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        }
8509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (++newIndex == newStyleSheetCount)
8609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            return Reconstruct;
8709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
8809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    bool hasInsertions = !addedSheets.isEmpty();
8909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    while (newIndex < newStyleSheetCount) {
9009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        addedSheets.append(newStylesheets[newIndex]->contents());
9109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        ++newIndex;
9209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
9309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
9409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
9509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    return hasInsertions ? Reset : Additive;
9609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
9709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
98d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)bool TreeScopeStyleSheetCollection::activeLoadingStyleSheetLoaded(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& newStyleSheets)
9909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
10009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
10109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    bool hasActiveLoadingStylesheet = false;
10209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    unsigned newStylesheetCount = newStyleSheets.size();
10309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    for (unsigned i = 0; i < newStylesheetCount; ++i) {
10409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (newStyleSheets[i]->isLoading())
10509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            hasActiveLoadingStylesheet = true;
10609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
10709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
10809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        m_hadActiveLoadingStylesheet = false;
10909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return true;
11009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
11109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
11209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    return false;
11309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
11409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
115d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)static bool findFontFaceRulesFromStyleSheetContents(const WillBeHeapVector<RawPtrWillBeMember<StyleSheetContents> >& sheets, WillBeHeapVector<RawPtrWillBeMember<const StyleRuleFontFace> >& fontFaceRules)
11609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
11709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    bool hasFontFaceRule = false;
11809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
11909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    for (unsigned i = 0; i < sheets.size(); ++i) {
12009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        ASSERT(sheets[i]);
12109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (sheets[i]->hasFontFaceRule()) {
12209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            // FIXME: We don't need this for styles in shadow tree.
12309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            sheets[i]->findFontFaceRules(fontFaceRules);
12409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            hasFontFaceRule = true;
12509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        }
12609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
12709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    return hasFontFaceRule;
12809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
12909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
13009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void TreeScopeStyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const StyleSheetCollection& newCollection, StyleSheetChange& change)
13109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
13209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (activeLoadingStyleSheetLoaded(newCollection.activeAuthorStyleSheets()))
13309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
13409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
13509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (updateMode != AnalyzedStyleUpdate)
13609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
13709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
13809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // Find out which stylesheets are new.
139d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    WillBeHeapVector<RawPtrWillBeMember<StyleSheetContents> > addedSheets;
14009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (m_activeAuthorStyleSheets.size() <= newCollection.activeAuthorStyleSheets().size()) {
14109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        change.styleResolverUpdateType = compareStyleSheets(m_activeAuthorStyleSheets, newCollection.activeAuthorStyleSheets(), addedSheets);
14209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    } else {
14309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        StyleResolverUpdateType updateType = compareStyleSheets(newCollection.activeAuthorStyleSheets(), m_activeAuthorStyleSheets, addedSheets);
14409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (updateType != Additive) {
14509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            change.styleResolverUpdateType = updateType;
14609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        } else {
14709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            change.styleResolverUpdateType = Reset;
14809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            // If @font-face is removed, needs full style recalc.
14909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            if (findFontFaceRulesFromStyleSheetContents(addedSheets, change.fontFaceRulesToRemove))
15009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)                return;
15109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        }
15209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
15309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
15409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // FIXME: If styleResolverUpdateType is Reconstruct, we should return early here since
15507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    // we need to recalc the whole document. It's wrong to use StyleSheetInvalidationAnalysis since
15609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // it only looks at the addedSheets.
15709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
15809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // No point in doing the analysis work if we're just going to recalc the whole document anyways.
15909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // This needs to be done after the compareStyleSheets calls above to ensure we don't throw away
16009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // the StyleResolver if we don't need to.
16109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (document().hasPendingForcedStyleRecalc())
16209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
16309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
16409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
16509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (!document().body() || document().hasNodesWithPlaceholderStyle())
16609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
16707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch    StyleSheetInvalidationAnalysis invalidationAnalysis(addedSheets);
16809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    if (invalidationAnalysis.dirtiesAllStyle())
16909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        return;
17009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    invalidationAnalysis.invalidateStyle(document());
17109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    change.requiresFullStyleRecalc = false;
17209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    return;
17309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
17409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
17509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets()
17609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
17709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    for (size_t i = 0; i < m_activeAuthorStyleSheets.size(); ++i) {
17809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents();
17909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (contents->hasMediaQueries())
18009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            contents->clearRuleSet();
18109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
18209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
18309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
184d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)void TreeScopeStyleSheetCollection::enableExitTransitionStylesheets()
185d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles){
186d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
187d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
188d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
189d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        Node* node = *it;
190d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        if (isHTMLLinkElement(*node))
191d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)            toHTMLLinkElement(node)->enableIfExitTransitionStyle();
192d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    }
193d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)}
194d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
195d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)static bool styleSheetsUseRemUnits(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet> >& sheets)
19609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
19709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    for (unsigned i = 0; i < sheets.size(); ++i) {
19809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)        if (sheets[i]->contents()->usesRemUnits())
19909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)            return true;
20009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    }
20109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    return false;
20209380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
20309380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
20409380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)void TreeScopeStyleSheetCollection::updateUsesRemUnits()
20509380295ba73501a205346becac22c6978e4671dTorne (Richard Coles){
20609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
20709380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
20809380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)
209197021e6b966cfb06891637935ef33fff06433d1Ben Murdochvoid TreeScopeStyleSheetCollection::trace(Visitor* visitor)
210197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch{
211c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    visitor->trace(m_treeScope);
212197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    visitor->trace(m_styleSheetCandidateNodes);
213197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    StyleSheetCollection::trace(visitor);
214197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch}
215197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch
21609380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)}
217