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

Side by Side Diff: sky/engine/core/css/MediaValues.cpp

Issue 788883005: Remove REM units. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/css/MediaQueryExp.cpp ('k') | sky/engine/core/css/MediaValuesTest.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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sky/engine/config.h" 5 #include "sky/engine/config.h"
6 #include "sky/engine/core/css/MediaValues.h" 6 #include "sky/engine/core/css/MediaValues.h"
7 7
8 #include "sky/engine/core/css/CSSHelper.h" 8 #include "sky/engine/core/css/CSSHelper.h"
9 #include "sky/engine/core/css/MediaValuesCached.h" 9 #include "sky/engine/core/css/MediaValuesCached.h"
10 #include "sky/engine/core/css/MediaValuesDynamic.h" 10 #include "sky/engine/core/css/MediaValuesDynamic.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 bool MediaValues::computeLengthImpl(double value, CSSPrimitiveValue::UnitType ty pe, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, d ouble& result) 129 bool MediaValues::computeLengthImpl(double value, CSSPrimitiveValue::UnitType ty pe, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, d ouble& result)
130 { 130 {
131 // The logic in this function is duplicated from CSSPrimitiveValue::computeL engthDouble 131 // The logic in this function is duplicated from CSSPrimitiveValue::computeL engthDouble
132 // because MediaValues::computeLength needs nearly identical logic, but we h aven't found a way to make 132 // because MediaValues::computeLength needs nearly identical logic, but we h aven't found a way to make
133 // CSSPrimitiveValue::computeLengthDouble more generic (to solve both cases) without hurting performance. 133 // CSSPrimitiveValue::computeLengthDouble more generic (to solve both cases) without hurting performance.
134 134
135 // FIXME - Unite the logic here with CSSPrimitiveValue in a performant way. 135 // FIXME - Unite the logic here with CSSPrimitiveValue in a performant way.
136 double factor = 0; 136 double factor = 0;
137 switch (type) { 137 switch (type) {
138 case CSSPrimitiveValue::CSS_EMS: 138 case CSSPrimitiveValue::CSS_EMS:
139 case CSSPrimitiveValue::CSS_REMS:
140 factor = defaultFontSize; 139 factor = defaultFontSize;
141 break; 140 break;
142 case CSSPrimitiveValue::CSS_PX: 141 case CSSPrimitiveValue::CSS_PX:
143 factor = 1; 142 factor = 1;
144 break; 143 break;
145 case CSSPrimitiveValue::CSS_EXS: 144 case CSSPrimitiveValue::CSS_EXS:
146 // FIXME: We have a bug right now where the zoom will be applied twice t o EX units. 145 // FIXME: We have a bug right now where the zoom will be applied twice t o EX units.
147 // FIXME: We don't seem to be able to cache fontMetrics related values. 146 // FIXME: We don't seem to be able to cache fontMetrics related values.
148 // Trying to access them is triggering some sort of microtask. Serving t he spec's default instead. 147 // Trying to access them is triggering some sort of microtask. Serving t he spec's default instead.
149 factor = defaultFontSize / 2.0; 148 factor = defaultFontSize / 2.0;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 189 }
191 190
192 LocalFrame* MediaValues::frameFrom(Document& document) 191 LocalFrame* MediaValues::frameFrom(Document& document)
193 { 192 {
194 Document* executingDocument = document.importsController() ? document.import sController()->master() : &document; 193 Document* executingDocument = document.importsController() ? document.import sController()->master() : &document;
195 ASSERT(executingDocument); 194 ASSERT(executingDocument);
196 return executingDocument->frame(); 195 return executingDocument->frame();
197 } 196 }
198 197
199 } // namespace 198 } // namespace
OLDNEW
« no previous file with comments | « sky/engine/core/css/MediaQueryExp.cpp ('k') | sky/engine/core/css/MediaValuesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698