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

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 1468023002: Rename imageSizeForLayoutObject() to imageSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring back ps#3 and fix nit Created 5 years, 1 month 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/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index 93853b0271992d367300e8e9b9334bc069ff02a5..65d4b6c90d16c78407b8130034ceaa4d13fc93b7 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -215,34 +215,34 @@ bool ImageResource::imageHasRelativeHeight() const
return false;
}
-LayoutSize ImageResource::imageSizeForLayoutObject(const LayoutObject* layoutObject, float multiplier, SizeType sizeType)
+LayoutSize ImageResource::imageSize(RespectImageOrientationEnum shouldRespectImageOrientation, float multiplier, SizeType sizeType)
{
ASSERT(!isPurgeable());
if (!m_image)
return LayoutSize();
- LayoutSize imageSize;
+ LayoutSize size;
- if (m_image->isBitmapImage() && (layoutObject && layoutObject->shouldRespectImageOrientation() == RespectImageOrientation))
- imageSize = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientation());
+ if (m_image->isBitmapImage() && shouldRespectImageOrientation == RespectImageOrientation)
+ size = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientation());
else
- imageSize = LayoutSize(m_image->size());
+ size = LayoutSize(m_image->size());
if (sizeType == IntrinsicCorrectedToDPR && m_hasDevicePixelRatioHeaderValue && m_devicePixelRatioHeaderValue > 0)
multiplier = 1.0 / m_devicePixelRatioHeaderValue;
if (multiplier == 1.0f)
- return imageSize;
+ return size;
// Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
float widthScale = m_image->hasRelativeWidth() ? 1.0f : multiplier;
float heightScale = m_image->hasRelativeHeight() ? 1.0f : multiplier;
- LayoutSize minimumSize(imageSize.width() > 0 ? 1 : 0, imageSize.height() > 0 ? 1 : 0);
- imageSize.scale(widthScale, heightScale);
- imageSize.clampToMinimumSize(minimumSize);
- ASSERT(multiplier != 1.0f || (imageSize.width().fraction() == 0.0f && imageSize.height().fraction() == 0.0f));
- return imageSize;
+ LayoutSize minimumSize(size.width() > 0 ? 1 : 0, size.height() > 0 ? 1 : 0);
+ size.scale(widthScale, heightScale);
+ size.clampToMinimumSize(minimumSize);
+ ASSERT(multiplier != 1.0f || (size.width().fraction() == 0.0f && size.height().fraction() == 0.0f));
+ return size;
}
void ImageResource::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698