| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 float MediaValues::calculateDevicePixelRatio(LocalFrame* frame) const | 71 float MediaValues::calculateDevicePixelRatio(LocalFrame* frame) const |
| 72 { | 72 { |
| 73 return frame->devicePixelRatio(); | 73 return frame->devicePixelRatio(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 int MediaValues::calculateColorBitsPerComponent(LocalFrame* frame) const | 76 int MediaValues::calculateColorBitsPerComponent(LocalFrame* frame) const |
| 77 { | 77 { |
| 78 ASSERT(frame && frame->page() && frame->page()->mainFrame()); | 78 ASSERT(frame && frame->page() && frame->page()->mainFrame()); |
| 79 if (screenIsMonochrome(frame->page()->mainFrame()->view())) | 79 if (!frame->page()->mainFrame()->isLocalFrame() |
| 80 || screenIsMonochrome(frame->page()->deprecatedLocalMainFrame()->view())
) |
| 80 return 0; | 81 return 0; |
| 81 return screenDepthPerComponent(frame->view()); | 82 return screenDepthPerComponent(frame->view()); |
| 82 } | 83 } |
| 83 | 84 |
| 84 int MediaValues::calculateMonochromeBitsPerComponent(LocalFrame* frame) const | 85 int MediaValues::calculateMonochromeBitsPerComponent(LocalFrame* frame) const |
| 85 { | 86 { |
| 86 ASSERT(frame && frame->page() && frame->page()->mainFrame()); | 87 ASSERT(frame && frame->page() && frame->page()->mainFrame()); |
| 87 if (screenIsMonochrome(frame->page()->mainFrame()->view())) | 88 if (!frame->page()->mainFrame()->isLocalFrame() |
| 88 return screenDepthPerComponent(frame->view()); | 89 || !screenIsMonochrome(frame->page()->deprecatedLocalMainFrame()->view()
)) |
| 89 return 0; | 90 return 0; |
| 91 return screenDepthPerComponent(frame->view()); |
| 90 } | 92 } |
| 91 | 93 |
| 92 int MediaValues::calculateDefaultFontSize(LocalFrame* frame) const | 94 int MediaValues::calculateDefaultFontSize(LocalFrame* frame) const |
| 93 { | 95 { |
| 94 return frame->host()->settings().defaultFontSize(); | 96 return frame->host()->settings().defaultFontSize(); |
| 95 } | 97 } |
| 96 | 98 |
| 97 bool MediaValues::calculateScanMediaType(LocalFrame* frame) const | 99 bool MediaValues::calculateScanMediaType(LocalFrame* frame) const |
| 98 { | 100 { |
| 99 ASSERT(frame && frame->view()); | 101 ASSERT(frame && frame->view()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 default: | 197 default: |
| 196 return false; | 198 return false; |
| 197 } | 199 } |
| 198 | 200 |
| 199 ASSERT(factor > 0); | 201 ASSERT(factor > 0); |
| 200 result = value * factor; | 202 result = value * factor; |
| 201 return true; | 203 return true; |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace | 206 } // namespace |
| OLD | NEW |