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

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: When baseRenderStyle!=0: 1) don't inherit, and 2) use defaultStyleForElement as fallback parent. 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 namespace blink { 44 namespace blink {
45 45
46 class AnimatableValue; 46 class AnimatableValue;
47 class CSSRuleList; 47 class CSSRuleList;
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 ElementResolveContext;
53 class ElementRuleCollector; 54 class ElementRuleCollector;
54 class Interpolation; 55 class Interpolation;
55 class MediaQueryEvaluator; 56 class MediaQueryEvaluator;
56 class RuleData; 57 class RuleData;
57 class StyleKeyframe; 58 class StyleKeyframe;
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;
(...skipping 43 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> styleForText(Text*); 117 PassRefPtr<RenderStyle> styleForText(Text*);
118 118
119 static PassRefPtr<RenderStyle> styleForDocument(Document&); 119 static PassRefPtr<RenderStyle> styleForDocument(Document&);
120 120
121 // FIXME: It could be better to call appendAuthorStyleSheets() directly afte r we factor StyleResolver further. 121 // 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 122 // https://bugs.webkit.org/show_bug.cgi?id=108890
123 void appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSSt yleSheet> >&); 123 void appendAuthorStyleSheets(const WillBeHeapVector<RefPtrWillBeMember<CSSSt yleSheet> >&);
124 void resetAuthorStyle(TreeScope&); 124 void resetAuthorStyle(TreeScope&);
125 void finishAppendAuthorStyleSheets(); 125 void finishAppendAuthorStyleSheets();
126 126
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 253
254 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag e, const String& pageName); 254 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); 255 void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage > >& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >&, bool isLeftPage, bool isFirstPage, const String& pageName);
256 void collectViewportRules(); 256 void collectViewportRules();
257 257
258 bool isLeftPage(int pageIndex) const; 258 bool isLeftPage(int pageIndex) const;
259 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } 259 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); }
260 bool isFirstPage(int pageIndex) const; 260 bool isFirstPage(int pageIndex) const;
261 String pageName(int pageIndex) const; 261 String pageName(int pageIndex) const;
262 262
263 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, Rend erStyle* parentStyle, StyleResolverState&); 263 bool pseudoStyleForElementInternal(const PseudoStyleRequest&, RenderStyle* p arentStyle, StyleResolverState&);
264 264
265 Document& document() { return *m_document; } 265 Document& document() { return *m_document; }
266 266
267 // FIXME: This likely belongs on RuleSet. 267 // FIXME: This likely belongs on RuleSet.
268 typedef WillBeHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRuleKeyframes > > KeyframesRuleMap; 268 typedef WillBeHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRuleKeyframes > > KeyframesRuleMap;
269 KeyframesRuleMap m_keyframesRuleMap; 269 KeyframesRuleMap m_keyframesRuleMap;
270 270
271 static RenderStyle* s_styleNotYetAvailable; 271 static RenderStyle* s_styleNotYetAvailable;
272 272
273 void cacheBorderAndBackground(); 273 void cacheBorderAndBackground();
(...skipping 30 matching lines...) Expand all
304 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; 304 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals;
305 unsigned m_styleResolverStatsSequence; 305 unsigned m_styleResolverStatsSequence;
306 306
307 // Use only for Internals::updateStyleAndReturnAffectedElementCount. 307 // Use only for Internals::updateStyleAndReturnAffectedElementCount.
308 unsigned m_accessCount; 308 unsigned m_accessCount;
309 }; 309 };
310 310
311 } // namespace blink 311 } // namespace blink
312 312
313 #endif // StyleResolver_h 313 #endif // StyleResolver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698