Index: third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp |
diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp |
index 0eeb5bb14664187b58e582eeb290f1cd9947ccf1..f5d81de03db4b58b5b5ca2217c80ab651e27f9da 100644 |
--- a/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp |
+++ b/third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp |
@@ -93,11 +93,28 @@ bool StyleFetchedImageSet::errorOccurred() const |
return m_bestFitImage->errorOccurred(); |
} |
-LayoutSize StyleFetchedImageSet::imageSize(const LayoutObject* layoutObject, float multiplier) const |
+LayoutSize StyleFetchedImageSet::imageSize(const LayoutObject* layoutObject, float multiplier, const LayoutSize& defaultObjectSize) const |
{ |
- LayoutSize scaledImageSize = m_bestFitImage->imageSize(LayoutObject::shouldRespectImageOrientation(layoutObject), multiplier); |
- scaledImageSize.scale(1 / m_imageScaleFactor); |
- return scaledImageSize; |
+ if (m_bestFitImage->image() && m_bestFitImage->image()->isSVGImage()) { |
+ FloatSize unzoomedDefaultObjectSize(defaultObjectSize); |
+ unzoomedDefaultObjectSize.scale(1 / multiplier); |
+ LayoutSize concreteObjectSize(toSVGImage(m_bestFitImage->image())->calculateConcreteObjectSize(unzoomedDefaultObjectSize)); |
+ |
+ // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. |
+ LayoutSize minimumSize(concreteObjectSize.width() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit(), |
+ concreteObjectSize.height() > LayoutUnit() ? LayoutUnit(1) : LayoutUnit()); |
+ concreteObjectSize.scale(multiplier); |
+ concreteObjectSize.clampToMinimumSize(minimumSize); |
+ |
+ return concreteObjectSize; |
+ } |
+ |
+ // Image orientation should only be respected for content images, |
+ // not decorative ones as StyleImage (backgrounds, border-image, |
+ // etc.) |
+ const RespectImageOrientationEnum shouldRespectImageOrientation = DoNotRespectImageOrientation; |
fs
2016/03/03 15:22:53
Same as above.
davve
2016/03/04 06:49:43
Done.
|
+ |
+ return m_bestFitImage->imageSize(shouldRespectImageOrientation, multiplier); |
} |
bool StyleFetchedImageSet::imageHasRelativeSize() const |