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

Side by Side Diff: Source/core/css/resolver/StyleResolver.h

Issue 49093005: Fix memory error during selector matching due to getMatchedCSSRules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 16 matching lines...) Expand all
27 #include "core/css/InspectorCSSOMWrappers.h" 27 #include "core/css/InspectorCSSOMWrappers.h"
28 #include "core/css/PseudoStyleRequest.h" 28 #include "core/css/PseudoStyleRequest.h"
29 #include "core/css/RuleFeature.h" 29 #include "core/css/RuleFeature.h"
30 #include "core/css/RuleSet.h" 30 #include "core/css/RuleSet.h"
31 #include "core/css/SelectorChecker.h" 31 #include "core/css/SelectorChecker.h"
32 #include "core/css/SelectorFilter.h" 32 #include "core/css/SelectorFilter.h"
33 #include "core/css/SiblingTraversalStrategies.h" 33 #include "core/css/SiblingTraversalStrategies.h"
34 #include "core/css/resolver/MatchedPropertiesCache.h" 34 #include "core/css/resolver/MatchedPropertiesCache.h"
35 #include "core/css/resolver/ScopedStyleResolver.h" 35 #include "core/css/resolver/ScopedStyleResolver.h"
36 #include "core/css/resolver/StyleBuilder.h" 36 #include "core/css/resolver/StyleBuilder.h"
37 #include "core/css/resolver/StyleResolverIncludes.h"
37 #include "core/css/resolver/StyleResolverState.h" 38 #include "core/css/resolver/StyleResolverState.h"
38 #include "core/css/resolver/StyleResourceLoader.h" 39 #include "core/css/resolver/StyleResourceLoader.h"
39 #include "wtf/Deque.h" 40 #include "wtf/Deque.h"
40 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
41 #include "wtf/HashSet.h" 42 #include "wtf/HashSet.h"
42 #include "wtf/RefPtr.h" 43 #include "wtf/RefPtr.h"
43 #include "wtf/Vector.h" 44 #include "wtf/Vector.h"
44 45
45 namespace WebCore { 46 namespace WebCore {
46 47
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 230
230 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element). 231 // These methods will give back the set of rules that matched for a given el ement (or a pseudo-element).
231 enum CSSRuleFilter { 232 enum CSSRuleFilter {
232 UAAndUserCSSRules = 1 << 1, 233 UAAndUserCSSRules = 1 << 1,
233 AuthorCSSRules = 1 << 2, 234 AuthorCSSRules = 1 << 2,
234 EmptyCSSRules = 1 << 3, 235 EmptyCSSRules = 1 << 3,
235 CrossOriginCSSRules = 1 << 4, 236 CrossOriginCSSRules = 1 << 4,
236 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules, 237 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS SRules,
237 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, 238 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules,
238 }; 239 };
239 PassRefPtr<CSSRuleList> styleRulesForElement(Element*, unsigned rulesToInclu de = AllButEmptyCSSRules); 240 PassRefPtr<CSSRuleList> styleRulesForElement(Element*, unsigned rulesToInclu de = AllButEmptyCSSRules, ShouldIncludeStyleSheetInCSSOMWrapper = IncludeStyleSh eetInCSSOMWrapper);
240 PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, unsig ned rulesToInclude = AllButEmptyCSSRules); 241 PassRefPtr<CSSRuleList> pseudoStyleRulesForElement(Element*, PseudoId, unsig ned rulesToInclude = AllButEmptyCSSRules, ShouldIncludeStyleSheetInCSSOMWrapper = IncludeStyleSheetInCSSOMWrapper);
241 242
242 // |properties| is an array with |count| elements. 243 // |properties| is an array with |count| elements.
243 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count , RenderStyle*); 244 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count , RenderStyle*);
244 245
245 CSSFontSelector* fontSelector() const { return m_fontSelector.get(); } 246 CSSFontSelector* fontSelector() const { return m_fontSelector.get(); }
246 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); } 247 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol ver.get(); }
247 248
248 typedef Vector<OwnPtr<MediaQueryResult> > MediaQueryResultList; 249 typedef Vector<OwnPtr<MediaQueryResult> > MediaQueryResultList;
249 MediaQueryResultList* viewportDependentMediaQueryResults() { return &m_viewp ortDependentMediaQueryResults; } 250 MediaQueryResultList* viewportDependentMediaQueryResults() { return &m_viewp ortDependentMediaQueryResults; }
250 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); } 251 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM ediaQueryResults.isEmpty(); }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 PseudoId ignoreDynamicPseudo = NOPSEUDO; 378 PseudoId ignoreDynamicPseudo = NOPSEUDO;
378 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches) 379 if (selectorChecker.match(selectorCheckingContext, ignoreDynamicPseudo, DOMSiblingTraversalStrategy()) == SelectorChecker::SelectorMatches)
379 return true; 380 return true;
380 } 381 }
381 return false; 382 return false;
382 } 383 }
383 384
384 } // namespace WebCore 385 } // namespace WebCore
385 386
386 #endif // StyleResolver_h 387 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698