Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/MediaValues.h" | 6 #include "core/css/MediaValues.h" |
| 7 | 7 |
| 8 #include "core/css/CSSHelper.h" | 8 #include "core/css/CSSHelper.h" |
| 9 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
| 10 #include "core/css/MediaValuesDynamic.h" | 10 #include "core/css/MediaValuesDynamic.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 bool MediaValues::computeLengthImpl(double value, CSSPrimitiveValue::UnitType ty pe, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, d ouble& result) | 156 bool MediaValues::computeLengthImpl(double value, CSSPrimitiveValue::UnitType ty pe, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, d ouble& result) |
| 157 { | 157 { |
| 158 // The logic in this function is duplicated from CSSPrimitiveValue::computeL engthDouble | 158 // The logic in this function is duplicated from CSSPrimitiveValue::computeL engthDouble |
| 159 // because MediaValues::computeLength needs nearly identical logic, but we h aven't found a way to make | 159 // because MediaValues::computeLength needs nearly identical logic, but we h aven't found a way to make |
| 160 // CSSPrimitiveValue::computeLengthDouble more generic (to solve both cases) without hurting performance. | 160 // CSSPrimitiveValue::computeLengthDouble more generic (to solve both cases) without hurting performance. |
| 161 | 161 |
| 162 // FIXME - Unite the logic here with CSSPrimitiveValue in a performant way. | 162 // FIXME - Unite the logic here with CSSPrimitiveValue in a performant way. |
| 163 double factor = 0; | 163 double factor = 0; |
| 164 switch (type) { | 164 switch (type) { |
| 165 case CSSPrimitiveValue::UnitType::Ems: | 165 case CSSPrimitiveValue::UnitType::Ems: |
| 166 case CSSPrimitiveValue::UnitType::QuirkyEms: | |
|
Timothy Loh
2015/09/02 01:59:03
We won't get here with a quirky value
sashab
2015/09/02 03:54:49
Done.
| |
| 166 case CSSPrimitiveValue::UnitType::Rems: | 167 case CSSPrimitiveValue::UnitType::Rems: |
| 167 factor = defaultFontSize; | 168 factor = defaultFontSize; |
| 168 break; | 169 break; |
| 169 case CSSPrimitiveValue::UnitType::Pixels: | 170 case CSSPrimitiveValue::UnitType::Pixels: |
| 170 factor = 1; | 171 factor = 1; |
| 171 break; | 172 break; |
| 172 case CSSPrimitiveValue::UnitType::Exs: | 173 case CSSPrimitiveValue::UnitType::Exs: |
| 173 // FIXME: We have a bug right now where the zoom will be applied twice t o EX units. | 174 // FIXME: We have a bug right now where the zoom will be applied twice t o EX units. |
| 174 // FIXME: We don't seem to be able to cache fontMetrics related values. | 175 // FIXME: We don't seem to be able to cache fontMetrics related values. |
| 175 // Trying to access them is triggering some sort of microtask. Serving t he spec's default instead. | 176 // Trying to access them is triggering some sort of microtask. Serving t he spec's default instead. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 } | 218 } |
| 218 | 219 |
| 219 LocalFrame* MediaValues::frameFrom(Document& document) | 220 LocalFrame* MediaValues::frameFrom(Document& document) |
| 220 { | 221 { |
| 221 Document* executingDocument = document.importsController() ? document.import sController()->master() : &document; | 222 Document* executingDocument = document.importsController() ? document.import sController()->master() : &document; |
| 222 ASSERT(executingDocument); | 223 ASSERT(executingDocument); |
| 223 return executingDocument->frame(); | 224 return executingDocument->frame(); |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace | 227 } // namespace |
| OLD | NEW |