| Index: Source/core/html/ImageDocument.cpp
|
| diff --git a/Source/core/html/ImageDocument.cpp b/Source/core/html/ImageDocument.cpp
|
| index 6f07b40cfbb805eedce39c0a92111589331b582e..c9c35c89285b50ba80c978a7277dc6fa678db4e1 100644
|
| --- a/Source/core/html/ImageDocument.cpp
|
| +++ b/Source/core/html/ImageDocument.cpp
|
| @@ -232,9 +232,9 @@ float ImageDocument::scale() const
|
| return min(widthScale, heightScale);
|
| }
|
|
|
| -void ImageDocument::resizeImageToFit()
|
| +void ImageDocument::resizeImageToFit(bool resizeZoomedDocument)
|
| {
|
| - if (!m_imageElement || m_imageElement->document() != this || pageZoomFactor(this) > 1)
|
| + if (!m_imageElement || m_imageElement->document() != this || (pageZoomFactor(this) > 1 && !resizeZoomedDocument))
|
| return;
|
|
|
| LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), pageZoomFactor(this));
|
| @@ -254,9 +254,9 @@ void ImageDocument::imageClicked(int x, int y)
|
| m_shouldShrinkImage = !m_shouldShrinkImage;
|
|
|
| if (m_shouldShrinkImage)
|
| - windowSizeChanged();
|
| + windowSizeChanged(true);
|
| else {
|
| - restoreImageSize();
|
| + restoreImageSize(true);
|
|
|
| updateLayout();
|
|
|
| @@ -283,13 +283,13 @@ void ImageDocument::imageUpdated()
|
|
|
| if (shouldShrinkToFit()) {
|
| // Force resizing of the image
|
| - windowSizeChanged();
|
| + windowSizeChanged(false);
|
| }
|
| }
|
|
|
| -void ImageDocument::restoreImageSize()
|
| +void ImageDocument::restoreImageSize(bool restoreZoomedDocument)
|
| {
|
| - if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this || pageZoomFactor(this) < 1)
|
| + if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this || (pageZoomFactor(this) < 1 && !restoreZoomedDocument))
|
| return;
|
|
|
| LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForRenderer(m_imageElement->renderer(), 1.0f);
|
| @@ -319,7 +319,7 @@ bool ImageDocument::imageFitsInWindow() const
|
| return imageSize.width() <= windowSize.width() && imageSize.height() <= windowSize.height();
|
| }
|
|
|
| -void ImageDocument::windowSizeChanged()
|
| +void ImageDocument::windowSizeChanged(bool resizeZoomedDocument)
|
| {
|
| if (!m_imageElement || !m_imageSizeIsKnown || m_imageElement->document() != this)
|
| return;
|
| @@ -340,13 +340,13 @@ void ImageDocument::windowSizeChanged()
|
| // If the window has been resized so that the image fits, restore the image size
|
| // otherwise update the restored image size.
|
| if (fitsInWindow)
|
| - restoreImageSize();
|
| + restoreImageSize(resizeZoomedDocument);
|
| else
|
| - resizeImageToFit();
|
| + resizeImageToFit(resizeZoomedDocument);
|
| } else {
|
| // If the image isn't resized but needs to be, then resize it.
|
| if (!fitsInWindow) {
|
| - resizeImageToFit();
|
| + resizeImageToFit(resizeZoomedDocument);
|
| m_didShrinkImage = true;
|
| }
|
| }
|
| @@ -376,7 +376,7 @@ void ImageDocument::dispose()
|
| void ImageEventListener::handleEvent(ExecutionContext*, Event* event)
|
| {
|
| if (event->type() == EventTypeNames::resize)
|
| - m_doc->windowSizeChanged();
|
| + m_doc->windowSizeChanged(false);
|
| else if (event->type() == EventTypeNames::click && event->isMouseEvent()) {
|
| MouseEvent* mouseEvent = toMouseEvent(event);
|
| m_doc->imageClicked(mouseEvent->x(), mouseEvent->y());
|
|
|