| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 FrameView* view = frame()->view(); | 255 FrameView* view = frame()->view(); |
| 256 if (!view) | 256 if (!view) |
| 257 return 1.0f; | 257 return 1.0f; |
| 258 | 258 |
| 259 DCHECK(m_imageElement->cachedImage()); | 259 DCHECK(m_imageElement->cachedImage()); |
| 260 const float zoom = pageZoomFactor(this); | 260 const float zoom = pageZoomFactor(this); |
| 261 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject
::shouldRespectImageOrientation(m_imageElement->layoutObject()), zoom); | 261 LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject
::shouldRespectImageOrientation(m_imageElement->layoutObject()), zoom); |
| 262 | 262 |
| 263 // We want to pretend the viewport is larger when the user has zoomed the | 263 // We want to pretend the viewport is larger when the user has zoomed the |
| 264 // page in (but not when the zoom is coming from device scale). | 264 // page in (but not when the zoom is coming from device scale). |
| 265 const float manualZoom = zoom / view->getHostWindow()->windowToViewportScala
r(1.f); | 265 const float manualZoom = zoom / view->getHostWindow()->windowToViewportScala
r(*frame()->view(), 1.f); |
| 266 float widthScale = view->width() * manualZoom / imageSize.width().toFloat(); | 266 float widthScale = view->width() * manualZoom / imageSize.width().toFloat(); |
| 267 float heightScale = view->height() * manualZoom / imageSize.height().toFloat
(); | 267 float heightScale = view->height() * manualZoom / imageSize.height().toFloat
(); |
| 268 | 268 |
| 269 return min(widthScale, heightScale); | 269 return min(widthScale, heightScale); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ImageDocument::resizeImageToFit() | 272 void ImageDocument::resizeImageToFit() |
| 273 { | 273 { |
| 274 DCHECK_EQ(m_shrinkToFitMode, Desktop); | 274 DCHECK_EQ(m_shrinkToFitMode, Desktop); |
| 275 if (!m_imageElement || m_imageElement->document() != this) | 275 if (!m_imageElement || m_imageElement->document() != this) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 bool ImageEventListener::operator==(const EventListener& listener) const | 438 bool ImageEventListener::operator==(const EventListener& listener) const |
| 439 { | 439 { |
| 440 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) | 440 if (const ImageEventListener* imageEventListener = ImageEventListener::cast(
&listener)) |
| 441 return m_doc == imageEventListener->m_doc; | 441 return m_doc == imageEventListener->m_doc; |
| 442 return false; | 442 return false; |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace blink | 445 } // namespace blink |
| OLD | NEW |