Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/StyleFetchedImage.cpp |
| diff --git a/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp b/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp |
| index f2e15b31e4c114262515a4a8c346468200ea4352..6f31eb6e9b91ae984c6ffd6bfb6f26b04cc35b1e 100644 |
| --- a/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp |
| +++ b/third_party/WebKit/Source/core/style/StyleFetchedImage.cpp |
| @@ -91,9 +91,27 @@ bool StyleFetchedImage::errorOccurred() const |
| return m_image->errorOccurred(); |
| } |
| -LayoutSize StyleFetchedImage::imageSize(const LayoutObject* layoutObject, float multiplier) const |
| -{ |
| - return m_image->imageSize(LayoutObject::shouldRespectImageOrientation(layoutObject), multiplier); |
| +LayoutSize StyleFetchedImage::imageSize(const LayoutObject* layoutObject, float multiplier, const LayoutSize& defaultObjectSize) const |
| +{ |
| + if (m_image->image() && m_image->image()->isSVGImage()) { |
| + FloatSize unzoomedDefaultObjectSize(defaultObjectSize); |
| + unzoomedDefaultObjectSize.scale(1 / multiplier); |
| + LayoutSize concreteObjectSize(toSVGImage(m_image->image())->calculateConcreteObjectSize(unzoomedDefaultObjectSize)); |
| + |
| + // Don't let images that have a width/height >= 1 shrink below 1 when zoomed. |
|
fs
2016/03/03 15:22:53
Maybe we could put this sequence as a helper on St
davve
2016/03/04 06:49:43
Yes, that probably good. Even prior to this, there
|
| + 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 carries (backgrounds, |
| + // border-image, etc.) |
| + const RespectImageOrientationEnum shouldRespectImageOrientation = DoNotRespectImageOrientation; |
|
fs
2016/03/03 15:22:53
Nit: Fold this into the call? (Comment alone seems
davve
2016/03/04 06:49:43
Done.
|
| + |
| + return m_image->imageSize(shouldRespectImageOrientation, multiplier); |
| } |
| bool StyleFetchedImage::imageHasRelativeSize() const |