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

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

Issue 2616093003: Make CSSParserContext be garbage collected. (Closed)
Patch Set: fix fuzzer compile Created 3 years, 11 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
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/css/parser/CSSParserContext.h" 10 #include "core/css/parser/CSSParserContext.h"
(...skipping 13 matching lines...) Expand all
24 24
25 Document& document() { return m_dummyPageHolder->document(); } 25 Document& document() { return m_dummyPageHolder->document(); }
26 26
27 void setBodyContent(const String& html) { 27 void setBodyContent(const String& html) {
28 document().body()->setInnerHTML(html); 28 document().body()->setInnerHTML(html);
29 document().view()->updateAllLifecyclePhases(); 29 document().view()->updateAllLifecyclePhases();
30 } 30 }
31 31
32 void addSelector(const String& selector) { 32 void addSelector(const String& selector) {
33 StyleRuleBase* newRule = 33 StyleRuleBase* newRule =
34 CSSParser::parseRule(CSSParserContext(HTMLStandardMode, nullptr), 34 CSSParser::parseRule(new CSSParserContext(HTMLStandardMode), nullptr,
35 nullptr, selector + "{color:pink}"); 35 selector + "{color:pink}");
36 m_ruleSet->addStyleRule(static_cast<StyleRule*>(newRule), 36 m_ruleSet->addStyleRule(static_cast<StyleRule*>(newRule),
37 RuleHasNoSpecialState); 37 RuleHasNoSpecialState);
38 } 38 }
39 39
40 void finishAddingSelectors() { 40 void finishAddingSelectors() {
41 m_siblingRuleSet = makeRuleSet(m_ruleSet->features().siblingRules()); 41 m_siblingRuleSet = makeRuleSet(m_ruleSet->features().siblingRules());
42 m_uncommonAttributeRuleSet = 42 m_uncommonAttributeRuleSet =
43 makeRuleSet(m_ruleSet->features().uncommonAttributeRules()); 43 makeRuleSet(m_ruleSet->features().uncommonAttributeRules());
44 } 44 }
45 45
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ASSERT_TRUE(b); 176 ASSERT_TRUE(b);
177 177
178 EXPECT_FALSE(a->isDragged()); 178 EXPECT_FALSE(a->isDragged());
179 EXPECT_FALSE(b->isDragged()); 179 EXPECT_FALSE(b->isDragged());
180 180
181 EXPECT_TRUE(matchesUncommonAttributeRuleSet(*a)); 181 EXPECT_TRUE(matchesUncommonAttributeRuleSet(*a));
182 EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b)); 182 EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b));
183 } 183 }
184 184
185 } // namespace blink 185 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698