Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ad9df679eb1a2e5c64e2c1298c0e23b10304a231..99992d9c0f03e07148e03b9249acaf89ab7eddd4 100644
--- a/third_party/WebKit/Source/core/html/ImageDocument.cpp
+++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
@@ -163,7 +163,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->imageSize(LayoutObject::shouldRespectImageOrientation(document()->imageElement()->layoutObject()), 1.0f));
+ IntSize size = flooredIntSize(cachedImage->defaultConcreteObjectSize(LayoutObject::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 +263,7 @@ float ImageDocument::scale() const
return 1;
ASSERT(m_imageElement->cachedImage());
- LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
+ LayoutSize imageSize = m_imageElement->cachedImage()->defaultConcreteObjectSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
LayoutSize windowSize = LayoutSize(view->width(), view->height());
float widthScale = windowSize.width().toFloat() / imageSize.width().toFloat();
@@ -278,7 +278,7 @@ void ImageDocument::resizeImageToFit(ScaleType type)
return;
ASSERT(m_imageElement->cachedImage());
- LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
+ LayoutSize imageSize = m_imageElement->cachedImage()->defaultConcreteObjectSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
float scale = this->scale();
m_imageElement->setWidth(static_cast<int>(imageSize.width() * scale));
@@ -320,7 +320,7 @@ void ImageDocument::imageUpdated()
return;
updateLayoutTreeIfNeeded();
- if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->imageSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this)).isEmpty())
+ if (!m_imageElement->cachedImage() || m_imageElement->cachedImage()->defaultConcreteObjectSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this)).isEmpty())
return;
m_imageSizeIsKnown = true;
@@ -339,7 +339,7 @@ void ImageDocument::restoreImageSize(ScaleType type)
return;
ASSERT(m_imageElement->cachedImage());
- LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), 1.0f);
+ LayoutSize imageSize = m_imageElement->cachedImage()->defaultConcreteObjectSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), 1.0f);
m_imageElement->setWidth(imageSize.width());
m_imageElement->setHeight(imageSize.height());
@@ -363,7 +363,7 @@ bool ImageDocument::imageFitsInWindow() const
return true;
ASSERT(m_imageElement->cachedImage());
- LayoutSize imageSize = m_imageElement->cachedImage()->imageSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
+ LayoutSize imageSize = m_imageElement->cachedImage()->defaultConcreteObjectSize(LayoutObject::shouldRespectImageOrientation(m_imageElement->layoutObject()), pageZoomFactor(this));
LayoutSize windowSize = LayoutSize(view->width(), view->height());
return imageSize.width() <= windowSize.width() && imageSize.height() <= windowSize.height();

Powered by Google App Engine
This is Rietveld 408576698