| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void StyleResolver::initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBe
Member<StyleRule> >& watchedSelectors) | 171 void StyleResolver::initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBe
Member<StyleRule> >& watchedSelectors) |
| 172 { | 172 { |
| 173 if (!watchedSelectors.size()) | 173 if (!watchedSelectors.size()) |
| 174 return; | 174 return; |
| 175 m_watchedSelectorsRules = RuleSet::create(); | 175 m_watchedSelectorsRules = RuleSet::create(); |
| 176 for (unsigned i = 0; i < watchedSelectors.size(); ++i) | 176 for (unsigned i = 0; i < watchedSelectors.size(); ++i) |
| 177 m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHas
NoSpecialState); | 177 m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHas
NoSpecialState); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void StyleResolver::lazyAppendAuthorStyleSheets(unsigned firstNew, const Vector<
RefPtr<CSSStyleSheet> >& styleSheets) | 180 void StyleResolver::lazyAppendAuthorStyleSheets(unsigned firstNew, const WillBeH
eapVector<RefPtrWillBeMember<CSSStyleSheet> >& styleSheets) |
| 181 { | 181 { |
| 182 unsigned size = styleSheets.size(); | 182 unsigned size = styleSheets.size(); |
| 183 for (unsigned i = firstNew; i < size; ++i) | 183 for (unsigned i = firstNew; i < size; ++i) |
| 184 m_pendingStyleSheets.add(styleSheets[i].get()); | 184 m_pendingStyleSheets.add(styleSheets[i].get()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void StyleResolver::removePendingAuthorStyleSheets(const Vector<RefPtr<CSSStyleS
heet> >& styleSheets) | 187 void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
WillBeMember<CSSStyleSheet> >& styleSheets) |
| 188 { | 188 { |
| 189 for (unsigned i = 0; i < styleSheets.size(); ++i) | 189 for (unsigned i = 0; i < styleSheets.size(); ++i) |
| 190 m_pendingStyleSheets.remove(styleSheets[i].get()); | 190 m_pendingStyleSheets.remove(styleSheets[i].get()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet* cssSheet) | 193 void StyleResolver::appendCSSStyleSheet(CSSStyleSheet* cssSheet) |
| 194 { | 194 { |
| 195 ASSERT(cssSheet); | 195 ASSERT(cssSheet); |
| 196 ASSERT(!cssSheet->disabled()); | 196 ASSERT(!cssSheet->disabled()); |
| 197 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) | 197 if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m
_viewportDependentMediaQueryResults)) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 209 void StyleResolver::appendPendingAuthorStyleSheets() | 209 void StyleResolver::appendPendingAuthorStyleSheets() |
| 210 { | 210 { |
| 211 setBuildScopedStyleTreeInDocumentOrder(false); | 211 setBuildScopedStyleTreeInDocumentOrder(false); |
| 212 for (ListHashSet<CSSStyleSheet*, 16>::iterator it = m_pendingStyleSheets.beg
in(); it != m_pendingStyleSheets.end(); ++it) | 212 for (ListHashSet<CSSStyleSheet*, 16>::iterator it = m_pendingStyleSheets.beg
in(); it != m_pendingStyleSheets.end(); ++it) |
| 213 appendCSSStyleSheet(*it); | 213 appendCSSStyleSheet(*it); |
| 214 | 214 |
| 215 m_pendingStyleSheets.clear(); | 215 m_pendingStyleSheets.clear(); |
| 216 finishAppendAuthorStyleSheets(); | 216 finishAppendAuthorStyleSheets(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP
tr<CSSStyleSheet> >& styleSheets) | 219 void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const WillBeHeapV
ector<RefPtrWillBeMember<CSSStyleSheet> >& styleSheets) |
| 220 { | 220 { |
| 221 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver | 221 // This handles sheets added to the end of the stylesheet list only. In othe
r cases the style resolver |
| 222 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. | 222 // needs to be reconstructed. To handle insertions too the rule order number
s would need to be updated. |
| 223 unsigned size = styleSheets.size(); | 223 unsigned size = styleSheets.size(); |
| 224 for (unsigned i = firstNew; i < size; ++i) | 224 for (unsigned i = firstNew; i < size; ++i) |
| 225 appendCSSStyleSheet(styleSheets[i].get()); | 225 appendCSSStyleSheet(styleSheets[i].get()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void StyleResolver::finishAppendAuthorStyleSheets() | 228 void StyleResolver::finishAppendAuthorStyleSheets() |
| 229 { | 229 { |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) | 1015 PassRefPtr<StyleRuleList> StyleResolver::styleRulesForElement(Element* element,
unsigned rulesToInclude) |
| 1016 { | 1016 { |
| 1017 ASSERT(element); | 1017 ASSERT(element); |
| 1018 StyleResolverState state(document(), element); | 1018 StyleResolverState state(document(), element); |
| 1019 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); | 1019 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); |
| 1020 collector.setMode(SelectorChecker::CollectingStyleRules); | 1020 collector.setMode(SelectorChecker::CollectingStyleRules); |
| 1021 collectPseudoRulesForElement(element, collector, NOPSEUDO, rulesToInclude); | 1021 collectPseudoRulesForElement(element, collector, NOPSEUDO, rulesToInclude); |
| 1022 return collector.matchedStyleRuleList(); | 1022 return collector.matchedStyleRuleList(); |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 PassRefPtr<CSSRuleList> StyleResolver::pseudoCSSRulesForElement(Element* element
, PseudoId pseudoId, unsigned rulesToInclude) | 1025 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::pseudoCSSRulesForElement(Elem
ent* element, PseudoId pseudoId, unsigned rulesToInclude) |
| 1026 { | 1026 { |
| 1027 ASSERT(element); | 1027 ASSERT(element); |
| 1028 StyleResolverState state(document(), element); | 1028 StyleResolverState state(document(), element); |
| 1029 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); | 1029 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta
te.style()); |
| 1030 collector.setMode(SelectorChecker::CollectingCSSRules); | 1030 collector.setMode(SelectorChecker::CollectingCSSRules); |
| 1031 collectPseudoRulesForElement(element, collector, pseudoId, rulesToInclude); | 1031 collectPseudoRulesForElement(element, collector, pseudoId, rulesToInclude); |
| 1032 return collector.matchedCSSRuleList(); | 1032 return collector.matchedCSSRuleList(); |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 PassRefPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* element, unsi
gned rulesToInclude) | 1035 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* e
lement, unsigned rulesToInclude) |
| 1036 { | 1036 { |
| 1037 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude); | 1037 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) | 1040 void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCo
llector& collector, PseudoId pseudoId, unsigned rulesToInclude) |
| 1041 { | 1041 { |
| 1042 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); | 1042 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); |
| 1043 | 1043 |
| 1044 if (rulesToInclude & UAAndUserCSSRules) | 1044 if (rulesToInclude & UAAndUserCSSRules) |
| 1045 matchUARules(collector); | 1045 matchUARules(collector); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 bool StyleResolver::mediaQueryAffectedByViewportChange() const | 1408 bool StyleResolver::mediaQueryAffectedByViewportChange() const |
| 1409 { | 1409 { |
| 1410 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { | 1410 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { |
| 1411 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio
n) != m_viewportDependentMediaQueryResults[i]->m_result) | 1411 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio
n) != m_viewportDependentMediaQueryResults[i]->m_result) |
| 1412 return true; | 1412 return true; |
| 1413 } | 1413 } |
| 1414 return false; | 1414 return false; |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 } // namespace WebCore | 1417 } // namespace WebCore |
| OLD | NEW |