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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSToLengthConversionData.cpp

Issue 2392343005: Reflow comments in core/css (Closed)
Patch Set: Revert clang-format Created 4 years, 2 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 CSSToLengthConversionData::FontSizes::FontSizes(const ComputedStyle* style, 47 CSSToLengthConversionData::FontSizes::FontSizes(const ComputedStyle* style,
48 const ComputedStyle* rootStyle) 48 const ComputedStyle* rootStyle)
49 : FontSizes(style->computedFontSize(), 49 : FontSizes(style->computedFontSize(),
50 rootStyle ? rootStyle->computedFontSize() : 1.0f, 50 rootStyle ? rootStyle->computedFontSize() : 1.0f,
51 &style->font()) {} 51 &style->font()) {}
52 52
53 float CSSToLengthConversionData::FontSizes::ex() const { 53 float CSSToLengthConversionData::FontSizes::ex() const {
54 ASSERT(m_font); 54 ASSERT(m_font);
55 // FIXME: We have a bug right now where the zoom will be applied twice to EX u nits. 55 // FIXME: We have a bug right now where the zoom will be applied twice to EX
56 // We really need to compute EX using fontMetrics for the original specifiedSi ze and not use 56 // units. We really need to compute EX using fontMetrics for the original
57 // our actual constructed layoutObject font. 57 // specifiedSize and not use our actual constructed layoutObject font.
58 if (!m_font->getFontMetrics().hasXHeight()) 58 if (!m_font->getFontMetrics().hasXHeight())
59 return m_em / 2.0f; 59 return m_em / 2.0f;
60 return m_font->getFontMetrics().xHeight(); 60 return m_font->getFontMetrics().xHeight();
61 } 61 }
62 62
63 float CSSToLengthConversionData::FontSizes::ch() const { 63 float CSSToLengthConversionData::FontSizes::ch() const {
64 ASSERT(m_font); 64 ASSERT(m_font);
65 return m_font->getFontMetrics().zeroWidth(); 65 return m_font->getFontMetrics().zeroWidth();
66 } 66 }
67 67
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 float CSSToLengthConversionData::remFontSize() const { 113 float CSSToLengthConversionData::remFontSize() const {
114 m_style->setHasRemUnits(); 114 m_style->setHasRemUnits();
115 return m_fontSizes.rem(); 115 return m_fontSizes.rem();
116 } 116 }
117 117
118 double CSSToLengthConversionData::zoomedComputedPixels( 118 double CSSToLengthConversionData::zoomedComputedPixels(
119 double value, 119 double value,
120 CSSPrimitiveValue::UnitType type) const { 120 CSSPrimitiveValue::UnitType type) const {
121 // The logic in this function is duplicated in MediaValues::computeLength() 121 // The logic in this function is duplicated in MediaValues::computeLength()
122 // because MediaValues::computeLength() needs nearly identical logic, but we h aven't found a way to make 122 // because MediaValues::computeLength() needs nearly identical logic, but we
123 // zoomedComputedPixels() more generic (to solve both cases) without hurting p erformance. 123 // haven't found a way to make zoomedComputedPixels() more generic (to solve
124 // both cases) without hurting performance.
124 switch (type) { 125 switch (type) {
125 case CSSPrimitiveValue::UnitType::Pixels: 126 case CSSPrimitiveValue::UnitType::Pixels:
126 case CSSPrimitiveValue::UnitType::UserUnits: 127 case CSSPrimitiveValue::UnitType::UserUnits:
127 return value * zoom(); 128 return value * zoom();
128 129
129 case CSSPrimitiveValue::UnitType::Centimeters: 130 case CSSPrimitiveValue::UnitType::Centimeters:
130 return value * cssPixelsPerCentimeter * zoom(); 131 return value * cssPixelsPerCentimeter * zoom();
131 132
132 case CSSPrimitiveValue::UnitType::Millimeters: 133 case CSSPrimitiveValue::UnitType::Millimeters:
133 return value * cssPixelsPerMillimeter * zoom(); 134 return value * cssPixelsPerMillimeter * zoom();
(...skipping 12 matching lines...) Expand all
146 147
147 case CSSPrimitiveValue::UnitType::ViewportHeight: 148 case CSSPrimitiveValue::UnitType::ViewportHeight:
148 return value * viewportHeightPercent() * zoom(); 149 return value * viewportHeightPercent() * zoom();
149 150
150 case CSSPrimitiveValue::UnitType::ViewportMin: 151 case CSSPrimitiveValue::UnitType::ViewportMin:
151 return value * viewportMinPercent() * zoom(); 152 return value * viewportMinPercent() * zoom();
152 153
153 case CSSPrimitiveValue::UnitType::ViewportMax: 154 case CSSPrimitiveValue::UnitType::ViewportMax:
154 return value * viewportMaxPercent() * zoom(); 155 return value * viewportMaxPercent() * zoom();
155 156
156 // We do not apply the zoom factor when we are computing the value of the fo nt-size property. The zooming 157 // We do not apply the zoom factor when we are computing the value of the
157 // for font sizes is much more complicated, since we have to worry about enf orcing the minimum font size preference 158 // font-size property. The zooming for font sizes is much more complicated,
159 // since we have to worry about enforcing the minimum font size preference
158 // as well as enforcing the implicit "smart minimum." 160 // as well as enforcing the implicit "smart minimum."
159 case CSSPrimitiveValue::UnitType::Ems: 161 case CSSPrimitiveValue::UnitType::Ems:
160 case CSSPrimitiveValue::UnitType::QuirkyEms: 162 case CSSPrimitiveValue::UnitType::QuirkyEms:
161 return value * emFontSize(); 163 return value * emFontSize();
162 164
163 case CSSPrimitiveValue::UnitType::Exs: 165 case CSSPrimitiveValue::UnitType::Exs:
164 return value * exFontSize(); 166 return value * exFontSize();
165 167
166 case CSSPrimitiveValue::UnitType::Rems: 168 case CSSPrimitiveValue::UnitType::Rems:
167 return value * remFontSize(); 169 return value * remFontSize();
168 170
169 case CSSPrimitiveValue::UnitType::Chs: 171 case CSSPrimitiveValue::UnitType::Chs:
170 return value * chFontSize(); 172 return value * chFontSize();
171 173
172 default: 174 default:
173 ASSERT_NOT_REACHED(); 175 ASSERT_NOT_REACHED();
174 return 0; 176 return 0;
175 } 177 }
176 } 178 }
177 179
178 } // namespace blink 180 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSyntaxDescriptor.cpp ('k') | third_party/WebKit/Source/core/css/CSSValueList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698