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

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

Issue 715633006: Remove FontDescriptionChangeScope, and let FontBuilder partially apply values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: IsSetFlag -> PropertySetFlag. Created 5 years, 10 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } 59 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); }
60 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } 60 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); }
61 61
62 const ElementResolveContext& elementContext() const { return m_elementContex t; } 62 const ElementResolveContext& elementContext() const { return m_elementContex t; }
63 63
64 void setStyle(PassRefPtr<RenderStyle> style) 64 void setStyle(PassRefPtr<RenderStyle> style)
65 { 65 {
66 // FIXME: Improve RAII of StyleResolverState to remove this function. 66 // FIXME: Improve RAII of StyleResolverState to remove this function.
67 m_style = style; 67 m_style = style;
68 m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), r ootElementStyle(), document().renderView(), m_style->effectiveZoom()); 68 m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), r ootElementStyle(), document().renderView(), m_style->effectiveZoom());
69 m_fontBuilder.setFontDescription(m_style->fontDescription());
70 } 69 }
71 const RenderStyle* style() const { return m_style.get(); } 70 const RenderStyle* style() const { return m_style.get(); }
72 RenderStyle* style() { return m_style.get(); } 71 RenderStyle* style() { return m_style.get(); }
73 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } 72 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); }
74 73
75 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; } 74 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
76 75
77 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); } 76 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); }
78 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); } 77 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); }
79 78
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return m_elementStyleResources.styleImage(document(), document().textLin kColors(), style()->color(), propertyId, value); 119 return m_elementStyleResources.styleImage(document(), document().textLin kColors(), style()->color(), propertyId, value);
121 } 120 }
122 121
123 FontBuilder& fontBuilder() { return m_fontBuilder; } 122 FontBuilder& fontBuilder() { return m_fontBuilder; }
124 // FIXME: These exist as a primitive way to track mutations to font-related properties 123 // FIXME: These exist as a primitive way to track mutations to font-related properties
125 // on a RenderStyle. As designed, these are very error-prone, as some caller s 124 // on a RenderStyle. As designed, these are very error-prone, as some caller s
126 // set these directly on the RenderStyle w/o telling us. Presumably we'll 125 // set these directly on the RenderStyle w/o telling us. Presumably we'll
127 // want to design a better wrapper around RenderStyle for tracking these mut ations 126 // want to design a better wrapper around RenderStyle for tracking these mut ations
128 // and separate it from StyleResolverState. 127 // and separate it from StyleResolverState.
129 const FontDescription& parentFontDescription() { return m_parentStyle->fontD escription(); } 128 const FontDescription& parentFontDescription() { return m_parentStyle->fontD escription(); }
130 void setZoom(float f) { m_fontBuilder.didChangeFontParameters(m_style->setZo om(f)); } 129
131 void setEffectiveZoom(float f) { m_fontBuilder.didChangeFontParameters(m_sty le->setEffectiveZoom(f)); } 130 void setZoom(float f)
132 void setWritingMode(WritingMode writingMode) { m_fontBuilder.didChangeFontPa rameters(m_style->setWritingMode(writingMode)); } 131 {
133 void setTextOrientation(TextOrientation textOrientation) { m_fontBuilder.did ChangeFontParameters(m_style->setTextOrientation(textOrientation)); } 132 if (m_style->setZoom(f))
133 m_fontBuilder.didChangeEffectiveZoom();
134 }
135 void setEffectiveZoom(float f)
136 {
137 if (m_style->setEffectiveZoom(f))
138 m_fontBuilder.didChangeEffectiveZoom();
139 }
140 void setWritingMode(WritingMode writingMode)
141 {
142 if (m_style->setWritingMode(writingMode))
143 m_fontBuilder.didChangeWritingMode();
144 }
145 void setTextOrientation(TextOrientation textOrientation)
146 {
147 if (m_style->setTextOrientation(textOrientation))
148 m_fontBuilder.didChangeTextOrientation();
149 }
134 150
135 private: 151 private:
136 ElementResolveContext m_elementContext; 152 ElementResolveContext m_elementContext;
137 RawPtrWillBeMember<Document> m_document; 153 RawPtrWillBeMember<Document> m_document;
138 154
139 // m_style is the primary output for each element's style resolve. 155 // m_style is the primary output for each element's style resolve.
140 RefPtr<RenderStyle> m_style; 156 RefPtr<RenderStyle> m_style;
141 157
142 CSSToLengthConversionData m_cssToLengthConversionData; 158 CSSToLengthConversionData m_cssToLengthConversionData;
143 159
144 // m_parentStyle is not always just ElementResolveContext::parentStyle, 160 // m_parentStyle is not always just ElementResolveContext::parentStyle,
145 // so we keep it separate. 161 // so we keep it separate.
146 RefPtr<RenderStyle> m_parentStyle; 162 RefPtr<RenderStyle> m_parentStyle;
147 163
148 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; 164 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
149 165
150 bool m_applyPropertyToRegularStyle; 166 bool m_applyPropertyToRegularStyle;
151 bool m_applyPropertyToVisitedLinkStyle; 167 bool m_applyPropertyToVisitedLinkStyle;
152 168
153 FontBuilder m_fontBuilder; 169 FontBuilder m_fontBuilder;
154 170
155 OwnPtr<CachedUAStyle> m_cachedUAStyle; 171 OwnPtr<CachedUAStyle> m_cachedUAStyle;
156 172
157 ElementStyleResources m_elementStyleResources; 173 ElementStyleResources m_elementStyleResources;
158 }; 174 };
159 175
160 } // namespace blink 176 } // namespace blink
161 177
162 #endif // StyleResolverState_h 178 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698