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 "core/css/MediaValues.h" | 5 #include "core/css/MediaValues.h" |
6 | 6 |
7 #include "core/css/CSSHelper.h" | 7 #include "core/css/CSSHelper.h" |
8 #include "core/css/MediaValuesCached.h" | 8 #include "core/css/MediaValuesCached.h" |
9 #include "core/css/MediaValuesDynamic.h" | 9 #include "core/css/MediaValuesDynamic.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 frame->GetPage()->GetChromeClient().GetScreenInfo()); | 172 frame->GetPage()->GetChromeClient().GetScreenInfo()); |
173 } | 173 } |
174 | 174 |
175 bool MediaValues::ComputeLengthImpl(double value, | 175 bool MediaValues::ComputeLengthImpl(double value, |
176 CSSPrimitiveValue::UnitType type, | 176 CSSPrimitiveValue::UnitType type, |
177 unsigned default_font_size, | 177 unsigned default_font_size, |
178 double viewport_width, | 178 double viewport_width, |
179 double viewport_height, | 179 double viewport_height, |
180 double& result) { | 180 double& result) { |
181 // The logic in this function is duplicated from | 181 // The logic in this function is duplicated from |
182 // CSSToLengthConversionData::zoomedComputedPixels() because | 182 // CSSToLengthConversionData::ZoomedComputedPixels() because |
183 // MediaValues::computeLength() needs nearly identical logic, but we haven't | 183 // MediaValues::ComputeLength() needs nearly identical logic, but we haven't |
184 // found a way to make CSSToLengthConversionData::zoomedComputedPixels() more | 184 // found a way to make CSSToLengthConversionData::ZoomedComputedPixels() more |
185 // generic (to solve both cases) without hurting performance. | 185 // generic (to solve both cases) without hurting performance. |
186 // FIXME - Unite the logic here with CSSToLengthConversionData in a performant | 186 // FIXME - Unite the logic here with CSSToLengthConversionData in a performant |
187 // way. | 187 // way. |
188 switch (type) { | 188 switch (type) { |
189 case CSSPrimitiveValue::UnitType::kEms: | 189 case CSSPrimitiveValue::UnitType::kEms: |
190 case CSSPrimitiveValue::UnitType::kRems: | 190 case CSSPrimitiveValue::UnitType::kRems: |
191 result = value * default_font_size; | 191 result = value * default_font_size; |
192 return true; | 192 return true; |
193 case CSSPrimitiveValue::UnitType::kPixels: | 193 case CSSPrimitiveValue::UnitType::kPixels: |
194 case CSSPrimitiveValue::UnitType::kUserUnits: | 194 case CSSPrimitiveValue::UnitType::kUserUnits: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 LocalFrame* MediaValues::FrameFrom(Document& document) { | 238 LocalFrame* MediaValues::FrameFrom(Document& document) { |
239 Document* executing_document = document.ImportsController() | 239 Document* executing_document = document.ImportsController() |
240 ? document.ImportsController()->Master() | 240 ? document.ImportsController()->Master() |
241 : &document; | 241 : &document; |
242 DCHECK(executing_document); | 242 DCHECK(executing_document); |
243 return executing_document->GetFrame(); | 243 return executing_document->GetFrame(); |
244 } | 244 } |
245 | 245 |
246 } // namespace blink | 246 } // namespace blink |
OLD | NEW |