| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 Node* ownerNode = sheet->ownerNode(); | 49 Node* ownerNode = sheet->ownerNode(); |
| 50 if (!isHTMLStyleElement(ownerNode)) | 50 if (!isHTMLStyleElement(ownerNode)) |
| 51 return &document; | 51 return &document; |
| 52 | 52 |
| 53 HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode); | 53 HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode); |
| 54 if (styleElement.isInShadowTree()) | 54 if (styleElement.isInShadowTree()) |
| 55 return styleElement.containingShadowRoot(); | 55 return styleElement.containingShadowRoot(); |
| 56 return &document; | 56 return &document; |
| 57 } | 57 } |
| 58 | 58 |
| 59 ScopedStyleResolver* ScopedStyleResolver::parent() const | |
| 60 { | |
| 61 for (TreeScope* scope = treeScope().parentTreeScope(); scope; scope = scope-
>parentTreeScope()) { | |
| 62 if (ScopedStyleResolver* resolver = scope->scopedStyleResolver()) | |
| 63 return resolver; | |
| 64 } | |
| 65 return 0; | |
| 66 } | |
| 67 | |
| 68 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media
QueryEvaluator& medium, StyleResolver* resolver) | 59 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const Media
QueryEvaluator& medium, StyleResolver* resolver) |
| 69 { | 60 { |
| 70 m_authorStyleSheets.append(cssSheet); | 61 m_authorStyleSheets.append(cssSheet); |
| 71 unsigned index = m_authorStyleSheets.size() - 1; | 62 unsigned index = m_authorStyleSheets.size() - 1; |
| 72 StyleSheetContents* sheet = cssSheet->contents(); | 63 StyleSheetContents* sheet = cssSheet->contents(); |
| 73 | 64 |
| 74 AddRuleFlags addRuleFlags = RuleHasNoSpecialState; | 65 AddRuleFlags addRuleFlags = RuleHasNoSpecialState; |
| 75 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); | 66 const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); |
| 76 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults())
; | 67 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults())
; |
| 77 resolver->processScopedRules(ruleSet, cssSheet, index, treeScope().rootNode(
)); | 68 resolver->processScopedRules(ruleSet, cssSheet, index, treeScope().rootNode(
)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 contextFlags |= SelectorChecker::ScopeContainsLastMatchedElement; | 117 contextFlags |= SelectorChecker::ScopeContainsLastMatchedElement; |
| 127 | 118 |
| 128 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); | 119 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
| 129 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { | 120 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
| 130 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], applyAuthorSt
yles, i); | 121 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet()
, includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], applyAuthorSt
yles, i); |
| 131 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::ContextFlags>(contextFlags), cascadeScope, cascadeOrder); | 122 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele
ctorChecker::ContextFlags>(contextFlags), cascadeScope, cascadeOrder); |
| 132 } | 123 } |
| 133 } | 124 } |
| 134 | 125 |
| 135 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |