| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 Screen::Screen(LocalFrame* frame) : ContextClient(frame) {} | 41 Screen::Screen(LocalFrame* frame) : ContextClient(frame) {} |
| 42 | 42 |
| 43 int Screen::height() const { | 43 int Screen::height() const { |
| 44 if (!frame()) | 44 if (!frame()) |
| 45 return 0; | 45 return 0; |
| 46 FrameHost* host = frame()->host(); | 46 FrameHost* host = frame()->host(); |
| 47 if (!host) | 47 if (!host) |
| 48 return 0; | 48 return 0; |
| 49 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 49 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 50 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 50 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 51 return lroundf(screenInfo.rect.height * screenInfo.deviceScaleFactor); | 51 return lroundf(screenInfo.rect.height * screenInfo.deviceScaleFactor); |
| 52 } | 52 } |
| 53 return host->chromeClient().screenInfo().rect.height; | 53 return host->chromeClient().screenInfo().rect.height; |
| 54 } | 54 } |
| 55 | 55 |
| 56 int Screen::width() const { | 56 int Screen::width() const { |
| 57 if (!frame()) | 57 if (!frame()) |
| 58 return 0; | 58 return 0; |
| 59 FrameHost* host = frame()->host(); | 59 FrameHost* host = frame()->host(); |
| 60 if (!host) | 60 if (!host) |
| 61 return 0; | 61 return 0; |
| 62 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 62 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 63 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 63 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 64 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor); | 64 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor); |
| 65 } | 65 } |
| 66 return host->chromeClient().screenInfo().rect.width; | 66 return host->chromeClient().screenInfo().rect.width; |
| 67 } | 67 } |
| 68 | 68 |
| 69 unsigned Screen::colorDepth() const { | 69 unsigned Screen::colorDepth() const { |
| 70 if (!frame() || !frame()->host()) | 70 if (!frame() || !frame()->host()) |
| 71 return 0; | 71 return 0; |
| 72 return static_cast<unsigned>( | 72 return static_cast<unsigned>( |
| 73 frame()->host()->chromeClient().screenInfo().depth); | 73 frame()->host()->chromeClient().screenInfo().depth); |
| 74 } | 74 } |
| 75 | 75 |
| 76 unsigned Screen::pixelDepth() const { | 76 unsigned Screen::pixelDepth() const { |
| 77 if (!frame()) | 77 if (!frame()) |
| 78 return 0; | 78 return 0; |
| 79 return static_cast<unsigned>( | 79 return static_cast<unsigned>( |
| 80 frame()->host()->chromeClient().screenInfo().depth); | 80 frame()->host()->chromeClient().screenInfo().depth); |
| 81 } | 81 } |
| 82 | 82 |
| 83 int Screen::availLeft() const { | 83 int Screen::availLeft() const { |
| 84 if (!frame()) | 84 if (!frame()) |
| 85 return 0; | 85 return 0; |
| 86 FrameHost* host = frame()->host(); | 86 FrameHost* host = frame()->host(); |
| 87 if (!host) | 87 if (!host) |
| 88 return 0; | 88 return 0; |
| 89 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 89 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 90 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 90 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 91 return lroundf(screenInfo.availableRect.x * screenInfo.deviceScaleFactor); | 91 return lroundf(screenInfo.availableRect.x * screenInfo.deviceScaleFactor); |
| 92 } | 92 } |
| 93 return static_cast<int>(host->chromeClient().screenInfo().availableRect.x); | 93 return static_cast<int>(host->chromeClient().screenInfo().availableRect.x); |
| 94 } | 94 } |
| 95 | 95 |
| 96 int Screen::availTop() const { | 96 int Screen::availTop() const { |
| 97 if (!frame()) | 97 if (!frame()) |
| 98 return 0; | 98 return 0; |
| 99 FrameHost* host = frame()->host(); | 99 FrameHost* host = frame()->host(); |
| 100 if (!host) | 100 if (!host) |
| 101 return 0; | 101 return 0; |
| 102 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 102 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 103 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 103 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 104 return lroundf(screenInfo.availableRect.y * screenInfo.deviceScaleFactor); | 104 return lroundf(screenInfo.availableRect.y * screenInfo.deviceScaleFactor); |
| 105 } | 105 } |
| 106 return static_cast<int>(host->chromeClient().screenInfo().availableRect.y); | 106 return static_cast<int>(host->chromeClient().screenInfo().availableRect.y); |
| 107 } | 107 } |
| 108 | 108 |
| 109 int Screen::availHeight() const { | 109 int Screen::availHeight() const { |
| 110 if (!frame()) | 110 if (!frame()) |
| 111 return 0; | 111 return 0; |
| 112 FrameHost* host = frame()->host(); | 112 FrameHost* host = frame()->host(); |
| 113 if (!host) | 113 if (!host) |
| 114 return 0; | 114 return 0; |
| 115 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 115 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 116 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 116 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 117 return lroundf(screenInfo.availableRect.height * | 117 return lroundf(screenInfo.availableRect.height * |
| 118 screenInfo.deviceScaleFactor); | 118 screenInfo.deviceScaleFactor); |
| 119 } | 119 } |
| 120 return host->chromeClient().screenInfo().availableRect.height; | 120 return host->chromeClient().screenInfo().availableRect.height; |
| 121 } | 121 } |
| 122 | 122 |
| 123 int Screen::availWidth() const { | 123 int Screen::availWidth() const { |
| 124 if (!frame()) | 124 if (!frame()) |
| 125 return 0; | 125 return 0; |
| 126 FrameHost* host = frame()->host(); | 126 FrameHost* host = frame()->host(); |
| 127 if (!host) | 127 if (!host) |
| 128 return 0; | 128 return 0; |
| 129 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) { | 129 if (host->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 130 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); | 130 WebScreenInfo screenInfo = host->chromeClient().screenInfo(); |
| 131 return lroundf(screenInfo.availableRect.width * | 131 return lroundf(screenInfo.availableRect.width * |
| 132 screenInfo.deviceScaleFactor); | 132 screenInfo.deviceScaleFactor); |
| 133 } | 133 } |
| 134 return host->chromeClient().screenInfo().availableRect.width; | 134 return host->chromeClient().screenInfo().availableRect.width; |
| 135 } | 135 } |
| 136 | 136 |
| 137 DEFINE_TRACE(Screen) { | 137 DEFINE_TRACE(Screen) { |
| 138 ContextClient::trace(visitor); | 138 ContextClient::trace(visitor); |
| 139 Supplementable<Screen>::trace(visitor); | 139 Supplementable<Screen>::trace(visitor); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |