OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 void ChromeClientImpl::setWindowRect(const FloatRect& r) | 165 void ChromeClientImpl::setWindowRect(const FloatRect& r) |
166 { | 166 { |
167 if (m_webView->client()) | 167 if (m_webView->client()) |
168 m_webView->client()->setWindowRect(IntRect(r)); | 168 m_webView->client()->setWindowRect(IntRect(r)); |
169 } | 169 } |
170 | 170 |
171 FloatRect ChromeClientImpl::windowRect() | 171 FloatRect ChromeClientImpl::windowRect() |
172 { | 172 { |
173 WebRect rect; | 173 if (m_webView->client()) { |
174 if (m_webView->client()) | 174 // On Chrome for Android, rootWindowRect is in physical screen pixels |
175 rect = m_webView->client()->rootWindowRect(); | 175 // instead of density independent (UI) pixels, and must be scaled down. |
176 else { | 176 FloatRect rect = FloatRect(m_webView->client()->rootWindowRect()); |
177 // These numbers will be fairly wrong. The window's x/y coordinates will | 177 if (!m_webView->page()->settings()->applyDeviceScaleFactorInCompositor()
) |
178 // be the top left corner of the screen and the size will be the content | 178 rect.scale(1 / m_webView->client()->screenInfo().deviceScaleFactor); |
179 // size instead of the window size. | 179 return rect; |
180 rect.width = m_webView->size().width; | |
181 rect.height = m_webView->size().height; | |
182 } | 180 } |
183 return FloatRect(rect); | 181 |
| 182 // These numbers will be fairly wrong. The window's x/y coordinates will |
| 183 // be the top left corner of the screen and the size will be the content |
| 184 // size instead of the window size. |
| 185 return FloatRect(0, 0, m_webView->size().width, m_webView->size().height); |
184 } | 186 } |
185 | 187 |
186 FloatRect ChromeClientImpl::pageRect() | 188 FloatRect ChromeClientImpl::pageRect() |
187 { | 189 { |
188 // We hide the details of the window's border thickness from the web page by | 190 // We hide the details of the window's border thickness from the web page by |
189 // simple re-using the window position here. So, from the point-of-view of | 191 // simple re-using the window position here. So, from the point-of-view of |
190 // the web page, the window has no border. | 192 // the web page, the window has no border. |
191 return windowRect(); | 193 return windowRect(); |
192 } | 194 } |
193 | 195 |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 { | 1147 { |
1146 } | 1148 } |
1147 | 1149 |
1148 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche
me, const String& baseURL, const String& url, const String& title) | 1150 void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& sche
me, const String& baseURL, const String& url, const String& title) |
1149 { | 1151 { |
1150 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); | 1152 m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); |
1151 } | 1153 } |
1152 #endif | 1154 #endif |
1153 | 1155 |
1154 } // namespace WebKit | 1156 } // namespace WebKit |
OLD | NEW |