| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/resolver/SharedStyleFinder.h" | 5 #include "core/css/resolver/SharedStyleFinder.h" |
| 6 | 6 |
| 7 #include "core/css/RuleFeature.h" | 7 #include "core/css/RuleFeature.h" |
| 8 #include "core/css/RuleSet.h" | 8 #include "core/css/RuleSet.h" |
| 9 #include "core/css/parser/CSSParser.h" | 9 #include "core/css/parser/CSSParser.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 for (auto ruleFeature : ruleFeatures) | 61 for (auto ruleFeature : ruleFeatures) |
| 62 ruleSet->addRule(ruleFeature.rule, ruleFeature.selectorIndex, RuleHa
sNoSpecialState); | 62 ruleSet->addRule(ruleFeature.rule, ruleFeature.selectorIndex, RuleHa
sNoSpecialState); |
| 63 return ruleSet; | 63 return ruleSet; |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool matchesRuleSet(Element& element, RuleSet* ruleSet) | 66 bool matchesRuleSet(Element& element, RuleSet* ruleSet) |
| 67 { | 67 { |
| 68 if (!ruleSet) | 68 if (!ruleSet) |
| 69 return false; | 69 return false; |
| 70 | 70 |
| 71 SharedStyleFinder finder(ElementResolveContext(element), | 71 ElementResolveContext context(element); |
| 72 SharedStyleFinder finder(context, |
| 72 m_ruleSet->features(), | 73 m_ruleSet->features(), |
| 73 m_siblingRuleSet, | 74 m_siblingRuleSet, |
| 74 m_uncommonAttributeRuleSet, | 75 m_uncommonAttributeRuleSet, |
| 75 document().ensureStyleResolver()); | 76 document().ensureStyleResolver()); |
| 76 | 77 |
| 77 return finder.matchesRuleSet(ruleSet); | 78 return finder.matchesRuleSet(ruleSet); |
| 78 } | 79 } |
| 79 | 80 |
| 80 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 81 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
| 81 Persistent<RuleSet> m_ruleSet; | 82 Persistent<RuleSet> m_ruleSet; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 ASSERT_TRUE(b); | 184 ASSERT_TRUE(b); |
| 184 | 185 |
| 185 EXPECT_FALSE(a->isDragged()); | 186 EXPECT_FALSE(a->isDragged()); |
| 186 EXPECT_FALSE(b->isDragged()); | 187 EXPECT_FALSE(b->isDragged()); |
| 187 | 188 |
| 188 EXPECT_TRUE(matchesUncommonAttributeRuleSet(*a)); | 189 EXPECT_TRUE(matchesUncommonAttributeRuleSet(*a)); |
| 189 EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b)); | 190 EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b)); |
| 190 } | 191 } |
| 191 | 192 |
| 192 } // namespace blink | 193 } // namespace blink |
| OLD | NEW |