| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 { | 66 { |
| 67 ASSERT(frame && frame->document()); | 67 ASSERT(frame && frame->document()); |
| 68 return !frame->document()->inQuirksMode(); | 68 return !frame->document()->inQuirksMode(); |
| 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 // FIXME: Broken for OOPI. These checks can't assume there will be a top level |
| 77 // FrameView. |
| 76 int MediaValues::calculateColorBitsPerComponent(LocalFrame* frame) const | 78 int MediaValues::calculateColorBitsPerComponent(LocalFrame* frame) const |
| 77 { | 79 { |
| 78 ASSERT(frame && frame->page() && frame->page()->mainFrame()); | 80 ASSERT(frame && frame->page() && frame->page()->mainFrame()); |
| 79 if (screenIsMonochrome(frame->page()->mainFrame()->view())) | 81 if (!frame->page()->mainFrame()->isLocalFrame() |
| 82 || screenIsMonochrome(toLocalFrame(frame->page()->mainFrame())->view())) |
| 80 return 0; | 83 return 0; |
| 81 return screenDepthPerComponent(frame->view()); | 84 return screenDepthPerComponent(frame->view()); |
| 82 } | 85 } |
| 83 | 86 |
| 84 int MediaValues::calculateMonochromeBitsPerComponent(LocalFrame* frame) const | 87 int MediaValues::calculateMonochromeBitsPerComponent(LocalFrame* frame) const |
| 85 { | 88 { |
| 86 ASSERT(frame && frame->page() && frame->page()->mainFrame()); | 89 ASSERT(frame && frame->page() && frame->page()->mainFrame()); |
| 87 if (screenIsMonochrome(frame->page()->mainFrame()->view())) | 90 if (!frame->page()->mainFrame()->isLocalFrame() |
| 88 return screenDepthPerComponent(frame->view()); | 91 || !screenIsMonochrome(toLocalFrame(frame->page()->mainFrame())->view())
) |
| 89 return 0; | 92 return 0; |
| 93 return screenDepthPerComponent(frame->view()); |
| 90 } | 94 } |
| 91 | 95 |
| 92 int MediaValues::calculateDefaultFontSize(LocalFrame* frame) const | 96 int MediaValues::calculateDefaultFontSize(LocalFrame* frame) const |
| 93 { | 97 { |
| 94 return frame->host()->settings().defaultFontSize(); | 98 return frame->host()->settings().defaultFontSize(); |
| 95 } | 99 } |
| 96 | 100 |
| 97 bool MediaValues::calculateScanMediaType(LocalFrame* frame) const | 101 bool MediaValues::calculateScanMediaType(LocalFrame* frame) const |
| 98 { | 102 { |
| 99 ASSERT(frame && frame->view()); | 103 ASSERT(frame && frame->view()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 default: | 199 default: |
| 196 return false; | 200 return false; |
| 197 } | 201 } |
| 198 | 202 |
| 199 ASSERT(factor > 0); | 203 ASSERT(factor > 0); |
| 200 result = value * factor; | 204 result = value * factor; |
| 201 return true; | 205 return true; |
| 202 } | 206 } |
| 203 | 207 |
| 204 } // namespace | 208 } // namespace |
| OLD | NEW |