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

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

Issue 2812743003: Rename cleanup in comments in css/ directory. (Closed)
Patch Set: Created 3 years, 8 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const ComputedStyle* style, 90 const ComputedStyle* style,
91 const ComputedStyle* root_style, 91 const ComputedStyle* root_style,
92 const LayoutViewItem& layout_view_item, 92 const LayoutViewItem& layout_view_item,
93 float zoom) 93 float zoom)
94 : CSSToLengthConversionData(style, 94 : CSSToLengthConversionData(style,
95 FontSizes(style, root_style), 95 FontSizes(style, root_style),
96 ViewportSize(layout_view_item), 96 ViewportSize(layout_view_item),
97 zoom) {} 97 zoom) {}
98 98
99 double CSSToLengthConversionData::ViewportWidthPercent() const { 99 double CSSToLengthConversionData::ViewportWidthPercent() const {
100 // FIXME: Remove m_style from this class. Plumb viewport and rem unit 100 // FIXME: Remove style_ from this class. Plumb viewport and rem unit
101 // information through as output parameters on functions involved in length 101 // information through as output parameters on functions involved in length
102 // resolution. 102 // resolution.
103 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true); 103 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true);
104 return viewport_size_.Width() / 100; 104 return viewport_size_.Width() / 100;
105 } 105 }
106 double CSSToLengthConversionData::ViewportHeightPercent() const { 106 double CSSToLengthConversionData::ViewportHeightPercent() const {
107 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true); 107 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true);
108 return viewport_size_.Height() / 100; 108 return viewport_size_.Height() / 100;
109 } 109 }
110 double CSSToLengthConversionData::ViewportMinPercent() const { 110 double CSSToLengthConversionData::ViewportMinPercent() const {
111 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true); 111 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true);
112 return std::min(viewport_size_.Width(), viewport_size_.Height()) / 100; 112 return std::min(viewport_size_.Width(), viewport_size_.Height()) / 100;
113 } 113 }
114 double CSSToLengthConversionData::ViewportMaxPercent() const { 114 double CSSToLengthConversionData::ViewportMaxPercent() const {
115 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true); 115 const_cast<ComputedStyle*>(style_)->SetHasViewportUnits(true);
116 return std::max(viewport_size_.Width(), viewport_size_.Height()) / 100; 116 return std::max(viewport_size_.Width(), viewport_size_.Height()) / 100;
117 } 117 }
118 118
119 float CSSToLengthConversionData::RemFontSize() const { 119 float CSSToLengthConversionData::RemFontSize() const {
120 const_cast<ComputedStyle*>(style_)->SetHasRemUnits(); 120 const_cast<ComputedStyle*>(style_)->SetHasRemUnits();
121 return font_sizes_.Rem(); 121 return font_sizes_.Rem();
122 } 122 }
123 123
124 double CSSToLengthConversionData::ZoomedComputedPixels( 124 double CSSToLengthConversionData::ZoomedComputedPixels(
125 double value, 125 double value,
126 CSSPrimitiveValue::UnitType type) const { 126 CSSPrimitiveValue::UnitType type) const {
127 // The logic in this function is duplicated in MediaValues::computeLength() 127 // The logic in this function is duplicated in MediaValues::ComputeLength()
128 // because MediaValues::computeLength() needs nearly identical logic, but we 128 // because MediaValues::ComputeLength() needs nearly identical logic, but we
129 // haven't found a way to make zoomedComputedPixels() more generic (to solve 129 // haven't found a way to make ZoomedComputedPixels() more generic (to solve
130 // both cases) without hurting performance. 130 // both cases) without hurting performance.
131 switch (type) { 131 switch (type) {
132 case CSSPrimitiveValue::UnitType::kPixels: 132 case CSSPrimitiveValue::UnitType::kPixels:
133 case CSSPrimitiveValue::UnitType::kUserUnits: 133 case CSSPrimitiveValue::UnitType::kUserUnits:
134 return value * Zoom(); 134 return value * Zoom();
135 135
136 case CSSPrimitiveValue::UnitType::kCentimeters: 136 case CSSPrimitiveValue::UnitType::kCentimeters:
137 return value * kCssPixelsPerCentimeter * Zoom(); 137 return value * kCssPixelsPerCentimeter * Zoom();
138 138
139 case CSSPrimitiveValue::UnitType::kMillimeters: 139 case CSSPrimitiveValue::UnitType::kMillimeters:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 case CSSPrimitiveValue::UnitType::kChs: 177 case CSSPrimitiveValue::UnitType::kChs:
178 return value * ChFontSize(); 178 return value * ChFontSize();
179 179
180 default: 180 default:
181 NOTREACHED(); 181 NOTREACHED();
182 return 0; 182 return 0;
183 } 183 }
184 } 184 }
185 185
186 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698