| 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 10 matching lines...) Expand all Loading... |
| 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #include "core/frame/Screen.h" | 29 #include "core/frame/Screen.h" |
| 30 | 30 |
| 31 #include "core/frame/FrameHost.h" | |
| 32 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 33 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 34 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
| 35 #include "core/inspector/InspectorInstrumentation.h" | 34 #include "core/inspector/InspectorInstrumentation.h" |
| 36 #include "core/page/ChromeClient.h" | 35 #include "core/page/ChromeClient.h" |
| 37 #include "core/page/Page.h" | 36 #include "core/page/Page.h" |
| 38 #include "public/platform/WebScreenInfo.h" | 37 #include "public/platform/WebScreenInfo.h" |
| 39 | 38 |
| 40 namespace blink { | 39 namespace blink { |
| 41 | 40 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 61 if (!page) | 60 if (!page) |
| 62 return 0; | 61 return 0; |
| 63 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { | 62 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 64 WebScreenInfo screenInfo = page->chromeClient().screenInfo(); | 63 WebScreenInfo screenInfo = page->chromeClient().screenInfo(); |
| 65 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor); | 64 return lroundf(screenInfo.rect.width * screenInfo.deviceScaleFactor); |
| 66 } | 65 } |
| 67 return page->chromeClient().screenInfo().rect.width; | 66 return page->chromeClient().screenInfo().rect.width; |
| 68 } | 67 } |
| 69 | 68 |
| 70 unsigned Screen::colorDepth() const { | 69 unsigned Screen::colorDepth() const { |
| 71 if (!frame() || !frame()->host()) | 70 if (!frame() || !frame()->page()) |
| 72 return 0; | 71 return 0; |
| 73 return static_cast<unsigned>( | 72 return static_cast<unsigned>( |
| 74 frame()->host()->chromeClient().screenInfo().depth); | 73 frame()->page()->chromeClient().screenInfo().depth); |
| 75 } | 74 } |
| 76 | 75 |
| 77 unsigned Screen::pixelDepth() const { | 76 unsigned Screen::pixelDepth() const { |
| 78 if (!frame()) | 77 if (!frame()) |
| 79 return 0; | 78 return 0; |
| 80 return static_cast<unsigned>( | 79 return static_cast<unsigned>( |
| 81 frame()->host()->chromeClient().screenInfo().depth); | 80 frame()->page()->chromeClient().screenInfo().depth); |
| 82 } | 81 } |
| 83 | 82 |
| 84 int Screen::availLeft() const { | 83 int Screen::availLeft() const { |
| 85 if (!frame()) | 84 if (!frame()) |
| 86 return 0; | 85 return 0; |
| 87 Page* page = frame()->page(); | 86 Page* page = frame()->page(); |
| 88 if (!page) | 87 if (!page) |
| 89 return 0; | 88 return 0; |
| 90 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { | 89 if (page->settings().getReportScreenSizeInPhysicalPixelsQuirk()) { |
| 91 WebScreenInfo screenInfo = page->chromeClient().screenInfo(); | 90 WebScreenInfo screenInfo = page->chromeClient().screenInfo(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 133 } |
| 135 return page->chromeClient().screenInfo().availableRect.width; | 134 return page->chromeClient().screenInfo().availableRect.width; |
| 136 } | 135 } |
| 137 | 136 |
| 138 DEFINE_TRACE(Screen) { | 137 DEFINE_TRACE(Screen) { |
| 139 DOMWindowClient::trace(visitor); | 138 DOMWindowClient::trace(visitor); |
| 140 Supplementable<Screen>::trace(visitor); | 139 Supplementable<Screen>::trace(visitor); |
| 141 } | 140 } |
| 142 | 141 |
| 143 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |