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

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

Issue 686723002: Improve RAII of StyleResolverState. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix assertions. Created 6 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class CSSStyleSheet; 48 class CSSStyleSheet;
49 class CSSValue; 49 class CSSValue;
50 class ContainerNode; 50 class ContainerNode;
51 class Document; 51 class Document;
52 class Element; 52 class Element;
53 class ElementRuleCollector; 53 class ElementRuleCollector;
54 class Interpolation; 54 class Interpolation;
55 class MediaQueryEvaluator; 55 class MediaQueryEvaluator;
56 class RuleData; 56 class RuleData;
57 class StyleKeyframe; 57 class StyleKeyframe;
58 class StyleBasisContext;
58 class StylePropertySet; 59 class StylePropertySet;
59 class StyleResolverStats; 60 class StyleResolverStats;
60 class StyleRule; 61 class StyleRule;
61 class StyleRuleKeyframes; 62 class StyleRuleKeyframes;
62 class StyleRulePage; 63 class StyleRulePage;
63 class ViewportStyleResolver; 64 class ViewportStyleResolver;
64 65
65 class MatchResult; 66 class MatchResult;
66 67
67 enum StyleSharingBehavior { 68 enum StyleSharingBehavior {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing, 107 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
107 RuleMatchingBehavior = MatchAllRules); 108 RuleMatchingBehavior = MatchAllRules);
108 109
109 PassRefPtr<RenderStyle> styleForKeyframe(Element&, const RenderStyle&, Rende rStyle* parentStyle, const StyleKeyframe*, const AtomicString& animationName); 110 PassRefPtr<RenderStyle> styleForKeyframe(Element&, const RenderStyle&, Rende rStyle* parentStyle, const StyleKeyframe*, const AtomicString& animationName);
110 static PassRefPtrWillBeRawPtr<AnimatableValue> createAnimatableValueSnapshot (Element&, CSSPropertyID, CSSValue&); 111 static PassRefPtrWillBeRawPtr<AnimatableValue> createAnimatableValueSnapshot (Element&, CSSPropertyID, CSSValue&);
111 static PassRefPtrWillBeRawPtr<AnimatableValue> createAnimatableValueSnapshot (StyleResolverState&, CSSPropertyID, CSSValue&); 112 static PassRefPtrWillBeRawPtr<AnimatableValue> createAnimatableValueSnapshot (StyleResolverState&, CSSPropertyID, CSSValue&);
112 113
113 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq uest&, RenderStyle* parentStyle); 114 PassRefPtr<RenderStyle> pseudoStyleForElement(Element*, const PseudoStyleReq uest&, RenderStyle* parentStyle);
114 115
115 PassRefPtr<RenderStyle> styleForPage(int pageIndex); 116 PassRefPtr<RenderStyle> styleForPage(int pageIndex);
116 PassRefPtr<RenderStyle> defaultStyleForElement(); 117 PassRefPtr<RenderStyle> initialRenderStyle();
117 PassRefPtr<RenderStyle> styleForText(Text*); 118 PassRefPtr<RenderStyle> styleForText(Text*);
118 119
119 static PassRefPtr<RenderStyle> styleForDocument(Document&); 120 static PassRefPtr<RenderStyle> styleForDocument(Document&);
120 121
121 // FIXME: It could be better to call appendAuthorStyleSheets() directly afte r we factor StyleResolver further. 122 // FIXME: It could be better to call appendAuthorStyleSheets() directly afte r we factor StyleResolver further.
122 // https://bugs.webkit.org/show_bug.cgi?id=108890 123 // https://bugs.webkit.org/show_bug.cgi?id=108890
123 void appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSSt yleSheet> >&); 124 void appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSSt yleSheet> >&);
124 void resetAuthorStyle(TreeScope&); 125 void resetAuthorStyle(TreeScope&);
125 void finishAppendAuthorStyleSheets(); 126 void finishAppendAuthorStyleSheets();
126 127
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag e, const String& pageName); 255 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag e, const String& pageName);
255 void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage > >& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >&, bool isLeftPage, bool isFirstPage, const String& pageName); 256 void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage > >& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >&, bool isLeftPage, bool isFirstPage, const String& pageName);
256 void collectViewportRules(); 257 void collectViewportRules();
257 258
258 bool isLeftPage(int pageIndex) const; 259 bool isLeftPage(int pageIndex) const;
259 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } 260 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); }
260 bool isFirstPage(int pageIndex) const; 261 bool isFirstPage(int pageIndex) const;
261 String pageName(int pageIndex) const; 262 String pageName(int pageIndex) const;
262 263
263 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, Rend erStyle* parentStyle, StyleResolverState&); 264 PassRefPtr<RenderStyle> styleForContext(const StyleBasisContext&);
265 PassRefPtr<RenderStyle> parentStyleForContext(const StyleBasisContext&);
266
267 bool pseudoStyleForElementInternal(const PseudoStyleRequest&, StyleResolverS tate&, const StyleBasisContext&);
264 268
265 Document& document() { return *m_document; } 269 Document& document() { return *m_document; }
266 270
267 // FIXME: This likely belongs on RuleSet. 271 // FIXME: This likely belongs on RuleSet.
268 typedef WillBeHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRuleKeyframes > > KeyframesRuleMap; 272 typedef WillBeHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRuleKeyframes > > KeyframesRuleMap;
269 KeyframesRuleMap m_keyframesRuleMap; 273 KeyframesRuleMap m_keyframesRuleMap;
270 274
271 static RenderStyle* s_styleNotYetAvailable; 275 static RenderStyle* s_styleNotYetAvailable;
272 276
273 void cacheBorderAndBackground(); 277 void cacheBorderAndBackground();
(...skipping 30 matching lines...) Expand all
304 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; 308 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals;
305 unsigned m_styleResolverStatsSequence; 309 unsigned m_styleResolverStatsSequence;
306 310
307 // Use only for Internals::updateStyleAndReturnAffectedElementCount. 311 // Use only for Internals::updateStyleAndReturnAffectedElementCount.
308 unsigned m_accessCount; 312 unsigned m_accessCount;
309 }; 313 };
310 314
311 } // namespace blink 315 } // namespace blink
312 316
313 #endif // StyleResolver_h 317 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698