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 27 matching lines...) Expand all Loading... |
38 #include "core/page/ChromeClient.h" | 38 #include "core/page/ChromeClient.h" |
39 #include "public/platform/WebScreenInfo.h" | 39 #include "public/platform/WebScreenInfo.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 Screen::Screen(LocalFrame* frame) | 43 Screen::Screen(LocalFrame* frame) |
44 : DOMWindowProperty(frame) | 44 : DOMWindowProperty(frame) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 unsigned Screen::height() const | 48 int Screen::height() const |
49 { | 49 { |
50 if (!m_frame) | 50 if (!m_frame) |
51 return 0; | 51 return 0; |
52 FrameHost* host = m_frame->host(); | 52 FrameHost* host = m_frame->host(); |
53 if (!host) | 53 if (!host) |
54 return 0; | 54 return 0; |
55 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 55 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
56 return lroundf(host->chromeClient().screenInfo().rect.height * host->dev
iceScaleFactor()); | 56 return lroundf(host->chromeClient().screenInfo().rect.height * host->dev
iceScaleFactor()); |
57 return static_cast<unsigned>(host->chromeClient().screenInfo().rect.height); | 57 return host->chromeClient().screenInfo().rect.height; |
58 } | 58 } |
59 | 59 |
60 unsigned Screen::width() const | 60 int Screen::width() const |
61 { | 61 { |
62 if (!m_frame) | 62 if (!m_frame) |
63 return 0; | 63 return 0; |
64 FrameHost* host = m_frame->host(); | 64 FrameHost* host = m_frame->host(); |
65 if (!host) | 65 if (!host) |
66 return 0; | 66 return 0; |
67 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 67 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
68 return lroundf(host->chromeClient().screenInfo().rect.width * host->devi
ceScaleFactor()); | 68 return lroundf(host->chromeClient().screenInfo().rect.width * host->devi
ceScaleFactor()); |
69 return static_cast<unsigned>(host->chromeClient().screenInfo().rect.width); | 69 return host->chromeClient().screenInfo().rect.width; |
70 } | 70 } |
71 | 71 |
72 unsigned Screen::colorDepth() const | 72 unsigned Screen::colorDepth() const |
73 { | 73 { |
74 if (!m_frame || !m_frame->host()) | 74 if (!m_frame || !m_frame->host()) |
75 return 0; | 75 return 0; |
76 return static_cast<unsigned>(m_frame->host()->chromeClient().screenInfo().de
pth); | 76 return static_cast<unsigned>(m_frame->host()->chromeClient().screenInfo().de
pth); |
77 } | 77 } |
78 | 78 |
79 unsigned Screen::pixelDepth() const | 79 unsigned Screen::pixelDepth() const |
(...skipping 20 matching lines...) Expand all Loading... |
100 if (!m_frame) | 100 if (!m_frame) |
101 return 0; | 101 return 0; |
102 FrameHost* host = m_frame->host(); | 102 FrameHost* host = m_frame->host(); |
103 if (!host) | 103 if (!host) |
104 return 0; | 104 return 0; |
105 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 105 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
106 return lroundf(host->chromeClient().screenInfo().availableRect.y * host-
>deviceScaleFactor()); | 106 return lroundf(host->chromeClient().screenInfo().availableRect.y * host-
>deviceScaleFactor()); |
107 return static_cast<int>(host->chromeClient().screenInfo().availableRect.y); | 107 return static_cast<int>(host->chromeClient().screenInfo().availableRect.y); |
108 } | 108 } |
109 | 109 |
110 unsigned Screen::availHeight() const | 110 int Screen::availHeight() const |
111 { | 111 { |
112 if (!m_frame) | 112 if (!m_frame) |
113 return 0; | 113 return 0; |
114 FrameHost* host = m_frame->host(); | 114 FrameHost* host = m_frame->host(); |
115 if (!host) | 115 if (!host) |
116 return 0; | 116 return 0; |
117 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 117 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
118 return lroundf(host->chromeClient().screenInfo().availableRect.height *
host->deviceScaleFactor()); | 118 return lroundf(host->chromeClient().screenInfo().availableRect.height *
host->deviceScaleFactor()); |
119 return static_cast<unsigned>(host->chromeClient().screenInfo().availableRect
.height); | 119 return host->chromeClient().screenInfo().availableRect.height; |
120 } | 120 } |
121 | 121 |
122 unsigned Screen::availWidth() const | 122 int Screen::availWidth() const |
123 { | 123 { |
124 if (!m_frame) | 124 if (!m_frame) |
125 return 0; | 125 return 0; |
126 FrameHost* host = m_frame->host(); | 126 FrameHost* host = m_frame->host(); |
127 if (!host) | 127 if (!host) |
128 return 0; | 128 return 0; |
129 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) | 129 if (host->settings().reportScreenSizeInPhysicalPixelsQuirk()) |
130 return lroundf(host->chromeClient().screenInfo().availableRect.width * h
ost->deviceScaleFactor()); | 130 return lroundf(host->chromeClient().screenInfo().availableRect.width * h
ost->deviceScaleFactor()); |
131 return static_cast<unsigned>(host->chromeClient().screenInfo().availableRect
.width); | 131 return host->chromeClient().screenInfo().availableRect.width; |
132 } | 132 } |
133 | 133 |
134 DEFINE_TRACE(Screen) | 134 DEFINE_TRACE(Screen) |
135 { | 135 { |
136 HeapSupplementable<Screen>::trace(visitor); | 136 HeapSupplementable<Screen>::trace(visitor); |
137 DOMWindowProperty::trace(visitor); | 137 DOMWindowProperty::trace(visitor); |
138 } | 138 } |
139 | 139 |
140 } // namespace blink | 140 } // namespace blink |
OLD | NEW |