Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp

Issue 2354333008: Fix use-after-scope in SharedStyleFinderTest. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698