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

Unified Diff: Source/core/css/ElementRuleCollector.h

Issue 49093005: Fix memory error during selector matching due to getMatchedCSSRules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: stop calling willMutateRules Created 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/ElementRuleCollector.h
diff --git a/Source/core/css/ElementRuleCollector.h b/Source/core/css/ElementRuleCollector.h
index bf832169c70272526d847502f027fbc2a7469db2..8a540d998fdb34f034e2eb9d1943bc6f9602a760 100644
--- a/Source/core/css/ElementRuleCollector.h
+++ b/Source/core/css/ElementRuleCollector.h
@@ -27,6 +27,7 @@
#include "core/css/resolver/ElementResolveContext.h"
#include "core/css/resolver/MatchRequest.h"
#include "core/css/resolver/MatchResult.h"
+#include "core/css/resolver/StyleResolverIncludes.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
@@ -76,7 +77,7 @@ private:
class ElementRuleCollector {
WTF_MAKE_NONCOPYABLE(ElementRuleCollector);
public:
- ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, RenderStyle* = 0);
+ ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, RenderStyle* = 0, ShouldIncludeStyleSheetInCSSOMWrapper = IncludeStyleSheetInCSSOMWrapper);
~ElementRuleCollector();
void setCanUseFastReject(bool canUseFastReject) { m_canUseFastReject = canUseFastReject; }
@@ -109,6 +110,8 @@ private:
void collectMatchingRulesForList(const RuleData*, SelectorChecker::BehaviorAtBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
bool ruleMatches(const RuleData&, const ContainerNode* scope, PseudoId&, SelectorChecker::BehaviorAtBoundary);
+ void appendCSSOMWrapperForRule(StyleRule*);
+
void sortMatchedRules();
void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder);
@@ -125,6 +128,7 @@ private:
bool m_canUseFastReject;
bool m_sameOriginOnly;
bool m_matchingUARules;
+ bool m_includeStyleSheet;
OwnPtr<Vector<MatchedRule, 32> > m_matchedRules;

Powered by Google App Engine
This is Rietveld 408576698