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

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

Issue 323053002: Unapply effectiveZoom during SVG layout (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add tests Created 6 years, 6 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
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // on a RenderStyle. As designed, these are very error-prone, as some caller s 121 // on a RenderStyle. As designed, these are very error-prone, as some caller s
122 // set these directly on the RenderStyle w/o telling us. Presumably we'll 122 // set these directly on the RenderStyle w/o telling us. Presumably we'll
123 // want to design a better wrapper around RenderStyle for tracking these mut ations 123 // want to design a better wrapper around RenderStyle for tracking these mut ations
124 // and separate it from StyleResolverState. 124 // and separate it from StyleResolverState.
125 const FontDescription& parentFontDescription() { return m_parentStyle->fontD escription(); } 125 const FontDescription& parentFontDescription() { return m_parentStyle->fontD escription(); }
126 void setZoom(float f) { m_fontBuilder.didChangeFontParameters(m_style->setZo om(f)); } 126 void setZoom(float f) { m_fontBuilder.didChangeFontParameters(m_style->setZo om(f)); }
127 void setEffectiveZoom(float f) { m_fontBuilder.didChangeFontParameters(m_sty le->setEffectiveZoom(f)); } 127 void setEffectiveZoom(float f) { m_fontBuilder.didChangeFontParameters(m_sty le->setEffectiveZoom(f)); }
128 void setWritingMode(WritingMode writingMode) { m_fontBuilder.didChangeFontPa rameters(m_style->setWritingMode(writingMode)); } 128 void setWritingMode(WritingMode writingMode) { m_fontBuilder.didChangeFontPa rameters(m_style->setWritingMode(writingMode)); }
129 void setTextOrientation(TextOrientation textOrientation) { m_fontBuilder.did ChangeFontParameters(m_style->setTextOrientation(textOrientation)); } 129 void setTextOrientation(TextOrientation textOrientation) { m_fontBuilder.did ChangeFontParameters(m_style->setTextOrientation(textOrientation)); }
130 130
131 // SVG handles zooming in a different way compared to CSS. The whole documen t is scaled instead
132 // of each individual length value in the render style / tree. CSSPrimitiveV alue::computeLength*()
133 // multiplies each resolved length with the zoom multiplier - so for SVG we need to disable that.
134 // Though all CSS values that can be applied to outermost <svg> elements (wi dth/height/border/padding...)
135 // need to respect the scaling. RenderBox (the parent class of RenderSVGRoot ) grabs values like
136 // width/height/border/padding/... from the RenderStyle -> for SVG these val ues would never scale,
137 // if we'd pass a 1.0 zoom factor everyhwere. So we only pass a zoom factor of 1.0 for specific
138 // properties that are NOT allowed to scale within a zoomed SVG document (le tter/word-spacing/font-size).
139 bool useSVGZoomRules() const { return element() && element()->isSVGElement() ; }
140
141 private: 131 private:
142 ElementResolveContext m_elementContext; 132 ElementResolveContext m_elementContext;
143 Document& m_document; 133 Document& m_document;
144 134
145 // m_style is the primary output for each element's style resolve. 135 // m_style is the primary output for each element's style resolve.
146 RefPtr<RenderStyle> m_style; 136 RefPtr<RenderStyle> m_style;
147 137
148 CSSToLengthConversionData m_cssToLengthConversionData; 138 CSSToLengthConversionData m_cssToLengthConversionData;
149 139
150 // m_parentStyle is not always just element->parentNode()->style() 140 // m_parentStyle is not always just element->parentNode()->style()
(...skipping 16 matching lines...) Expand all
167 // a back-pointer to this object. 157 // a back-pointer to this object.
168 CSSToStyleMap m_styleMap; 158 CSSToStyleMap m_styleMap;
169 Vector<AtomicString> m_contentAttrValues; 159 Vector<AtomicString> m_contentAttrValues;
170 160
171 RawPtrWillBeMember<StyleRule> m_currentRule; 161 RawPtrWillBeMember<StyleRule> m_currentRule;
172 }; 162 };
173 163
174 } // namespace WebCore 164 } // namespace WebCore
175 165
176 #endif // StyleResolverState_h 166 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | Source/core/rendering/svg/SVGTextLayoutEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698