| Index: third_party/WebKit/Source/core/html/ImageDocument.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/ImageDocument.cpp b/third_party/WebKit/Source/core/html/ImageDocument.cpp
|
| index bd2f8a7685c5eac14b4d81facb62392f618359dd..6dff01139bcce5a084c12c0c20174a076c3cd8e6 100644
|
| --- a/third_party/WebKit/Source/core/html/ImageDocument.cpp
|
| +++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
|
| @@ -42,6 +42,7 @@
|
| #include "core/html/HTMLHtmlElement.h"
|
| #include "core/html/HTMLImageElement.h"
|
| #include "core/html/HTMLMetaElement.h"
|
| +#include "core/layout/LayoutObject.h"
|
| #include "core/loader/DocumentLoader.h"
|
| #include "core/loader/FrameLoader.h"
|
| #include "core/loader/FrameLoaderClient.h"
|
| @@ -54,6 +55,18 @@ namespace blink {
|
|
|
| using namespace HTMLNames;
|
|
|
| +namespace {
|
| +
|
| +RespectImageOrientationEnum shouldRespectImageOrientation(LayoutObject* layoutObject)
|
| +{
|
| + if (layoutObject)
|
| + return layoutObject->shouldRespectImageOrientation();
|
| +
|
| + return DoNotRespectImageOrientation;
|
| +}
|
| +
|
| +} // anonymous namespace
|
| +
|
| class ImageEventListener : public EventListener {
|
| public:
|
| static PassRefPtrWillBeRawPtr<ImageEventListener> create(ImageDocument* document)
|
| @@ -163,7 +176,7 @@ void ImageDocumentParser::finish()
|
|
|
| // Report the natural image size in the page title, regardless of zoom level.
|
| // At a zoom level of 1 the image is guaranteed to have an integer size.
|
| - IntSize size = flooredIntSize(cachedImage->imageSizeForLayoutObject(document()->imageElement()->layoutObject(), 1.0f));
|
| + IntSize size = flooredIntSize(cachedImage->imageSize(shouldRespectImageOrientation(document()->imageElement()->layoutObject()), 1.0f));
|
| if (size.width()) {
|
| // Compute the title, we use the decoded filename of the resource, falling
|
| // back on the (decoded) hostname if there is no path.
|
| @@ -263,7 +276,7 @@ float ImageDocument::scale() const
|
| return 1;
|
|
|
| ASSERT(m_imageElement->cachedImage());
|
| - LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), pageZoomFactor(this));
|
| + LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
|
| LayoutSize windowSize = LayoutSize(view->width(), view->height());
|
|
|
| float widthScale = windowSize.width().toFloat() / imageSize.width().toFloat();
|
| @@ -278,7 +291,7 @@ void ImageDocument::resizeImageToFit(ScaleType type)
|
| return;
|
|
|
| ASSERT(m_imageElement->cachedImage());
|
| - LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), pageZoomFactor(this));
|
| + LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
|
|
|
| float scale = this->scale();
|
| m_imageElement->setWidth(static_cast<int>(imageSize.width() * scale));
|
| @@ -320,7 +333,7 @@ void ImageDocument::imageUpdated()
|
| return;
|
|
|
| updateLayoutTreeIfNeeded();
|
| - if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), pageZoomFactor(this)).isEmpty())
|
| + if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSize(shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this)).isEmpty())
|
| return;
|
|
|
| m_imageSizeIsKnown = true;
|
| @@ -339,7 +352,7 @@ void ImageDocument::restoreImageSize(ScaleType type)
|
| return;
|
|
|
| ASSERT(m_imageElement->cachedImage());
|
| - LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), 1.0f);
|
| + LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(shouldRespectImageOrientation(m_imageElement->layoutObject()), 1.0f);
|
| m_imageElement->setWidth(imageSize.width());
|
| m_imageElement->setHeight(imageSize.height());
|
|
|
| @@ -363,7 +376,7 @@ bool ImageDocument::imageFitsInWindow() const
|
| return true;
|
|
|
| ASSERT(m_imageElement->cachedImage());
|
| - LayoutSize imageSize = m_imageElement->cachedImage()->imageSizeForLayoutObject(m_imageElement->layoutObject(), pageZoomFactor(this));
|
| + LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
|
| LayoutSize windowSize = LayoutSize(view->width(), view->height());
|
|
|
| return imageSize.width() <= windowSize.width() && imageSize.height() <= windowSize.height();
|
|
|