OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 /** | 7 /** |
8 * Cached copy of all positions and scales (CSS-to-DIP-to-physical pixels) | 8 * Cached copy of all positions and scales (CSS-to-DIP-to-physical pixels) |
9 * reported from the renderer. | 9 * reported from the renderer. |
10 * Provides wrappers and a utility class to help with coordinate transforms on t he client side. | 10 * Provides wrappers and a utility class to help with coordinate transforms on t he client side. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 * @return Current device scale factor (maps DIP pixels to physical pixels). | 264 * @return Current device scale factor (maps DIP pixels to physical pixels). |
265 */ | 265 */ |
266 public float getDeviceScaleFactor() { return mDeviceScaleFactor; } | 266 public float getDeviceScaleFactor() { return mDeviceScaleFactor; } |
267 | 267 |
268 /** | 268 /** |
269 * @return True if the page doesn't allow zoom-in/zoom-out. | 269 * @return True if the page doesn't allow zoom-in/zoom-out. |
270 */ | 270 */ |
271 public boolean hasFixedPageScale() { return mMinPageScaleFactor == mMaxPageS caleFactor; } | 271 public boolean hasFixedPageScale() { return mMinPageScaleFactor == mMaxPageS caleFactor; } |
272 | 272 |
273 /** | 273 /** |
274 * @return True if the page has a width=device-width or narrower viewport. | |
275 */ | |
276 public boolean hasMobileViewport() { | |
277 float windowWidthDip = mPageScaleFactor * mLastFrameViewportWidthCss; | |
278 return mContentWidthCss <= windowWidthDp; | |
klobag.chromium
2013/10/23 21:02:36
is it a typo? windowWidthDip vs. windowWidthDp.
klobag.chromium
2013/10/23 21:02:36
Is it a typo? windowWidthDip vs windowWidthDp
johnme
2013/10/24 11:05:12
Done (oops!)
| |
279 } | |
280 | |
281 /** | |
274 * @return Maximum possible horizontal scroll in physical pixels. | 282 * @return Maximum possible horizontal scroll in physical pixels. |
275 */ | 283 */ |
276 public float getMaxHorizontalScrollPix() { | 284 public float getMaxHorizontalScrollPix() { |
277 return getContentWidthPix() - getLastFrameViewportWidthPix(); | 285 return getContentWidthPix() - getLastFrameViewportWidthPix(); |
278 } | 286 } |
279 | 287 |
280 /** | 288 /** |
281 * @return Maximum possible vertical scroll in physical pixels. | 289 * @return Maximum possible vertical scroll in physical pixels. |
282 */ | 290 */ |
283 public float getMaxVerticalScrollPix() { | 291 public float getMaxVerticalScrollPix() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 return pix / (mDeviceScaleFactor * mPageScaleFactor); | 327 return pix / (mDeviceScaleFactor * mPageScaleFactor); |
320 } | 328 } |
321 | 329 |
322 /** | 330 /** |
323 * @return Local CSS converted to physical coordinates. | 331 * @return Local CSS converted to physical coordinates. |
324 */ | 332 */ |
325 public float fromLocalCssToPix(float css) { | 333 public float fromLocalCssToPix(float css) { |
326 return css * mPageScaleFactor * mDeviceScaleFactor; | 334 return css * mPageScaleFactor * mDeviceScaleFactor; |
327 } | 335 } |
328 } | 336 } |
OLD | NEW |