| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 * @return Maximum page scale factor to be used with the content. | 259 * @return Maximum page scale factor to be used with the content. |
| 260 */ | 260 */ |
| 261 public float getMaxPageScaleFactor() { return mMaxPageScaleFactor; } | 261 public float getMaxPageScaleFactor() { return mMaxPageScaleFactor; } |
| 262 | 262 |
| 263 /** | 263 /** |
| 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. | |
| 270 */ | |
| 271 public boolean hasFixedPageScale() { return mMinPageScaleFactor == mMaxPageS
caleFactor; } | |
| 272 | |
| 273 /** | |
| 274 * @return Maximum possible horizontal scroll in physical pixels. | 269 * @return Maximum possible horizontal scroll in physical pixels. |
| 275 */ | 270 */ |
| 276 public float getMaxHorizontalScrollPix() { | 271 public float getMaxHorizontalScrollPix() { |
| 277 return getContentWidthPix() - getLastFrameViewportWidthPix(); | 272 return getContentWidthPix() - getLastFrameViewportWidthPix(); |
| 278 } | 273 } |
| 279 | 274 |
| 280 /** | 275 /** |
| 281 * @return Maximum possible vertical scroll in physical pixels. | 276 * @return Maximum possible vertical scroll in physical pixels. |
| 282 */ | 277 */ |
| 283 public float getMaxVerticalScrollPix() { | 278 public float getMaxVerticalScrollPix() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return pix / (mDeviceScaleFactor * mPageScaleFactor); | 314 return pix / (mDeviceScaleFactor * mPageScaleFactor); |
| 320 } | 315 } |
| 321 | 316 |
| 322 /** | 317 /** |
| 323 * @return Local CSS converted to physical coordinates. | 318 * @return Local CSS converted to physical coordinates. |
| 324 */ | 319 */ |
| 325 public float fromLocalCssToPix(float css) { | 320 public float fromLocalCssToPix(float css) { |
| 326 return css * mPageScaleFactor * mDeviceScaleFactor; | 321 return css * mPageScaleFactor * mDeviceScaleFactor; |
| 327 } | 322 } |
| 328 } | 323 } |
| OLD | NEW |