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

Unified Diff: third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp

Issue 1704493002: Use Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-image-updateconcretesize
Patch Set: Move test here from dependency CL. 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/style/StyleGeneratedImage.cpp
diff --git a/third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp b/third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp
index 68aaf42452030ce5042bf12836c825ba598c0c92..86d9d35772c7d2ea510a59371a9cb64b0f8ff9da 100644
--- a/third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp
+++ b/third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp
@@ -46,27 +46,33 @@ PassRefPtrWillBeRawPtr<CSSValue> StyleGeneratedImage::computedCSSValue() const
return m_imageGeneratorValue->valueWithURLsMadeAbsolute();
}
+void StyleGeneratedImage::updateConcreteObjectSize(const LayoutSize& defaultObjectSize)
+{
+ if (!m_fixedSize)
+ m_defaultObjectSize = defaultObjectSize;
+}
+
LayoutSize StyleGeneratedImage::imageSize(const LayoutObject* layoutObject, float multiplier) const
{
- if (m_fixedSize) {
- LayoutSize fixedSize(m_imageGeneratorValue->fixedSize(layoutObject));
- if (multiplier == 1.0f)
- return fixedSize;
+ if (!m_fixedSize)
+ return m_defaultObjectSize;
- LayoutUnit width(fixedSize.width() * multiplier);
- LayoutUnit height(fixedSize.height() * multiplier);
+ ASSERT(m_defaultObjectSize.isEmpty());
+ LayoutSize fixedSize(m_imageGeneratorValue->fixedSize(layoutObject));
+ if (multiplier == 1.0f)
+ return fixedSize;
- // Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
- if (fixedSize.width() > LayoutUnit())
- width = max(LayoutUnit(1), width);
+ LayoutUnit width(fixedSize.width() * multiplier);
+ LayoutUnit height(fixedSize.height() * multiplier);
- if (fixedSize.height() > LayoutUnit())
- height = max(LayoutUnit(1), height);
+ // Don't let images that have a width/height >= 1 shrink below 1 when zoomed.
+ if (fixedSize.width() > LayoutUnit())
+ width = max(LayoutUnit(1), width);
- return LayoutSize(width, height);
- }
+ if (fixedSize.height() > LayoutUnit())
+ height = max(LayoutUnit(1), height);
- return LayoutSize();
+ return LayoutSize(width, height);
}
void StyleGeneratedImage::computeIntrinsicDimensions(const LayoutObject* layoutObject, FloatSize& intrinsicSize, FloatSize& intrinsicRatio)
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleGeneratedImage.h ('k') | third_party/WebKit/Source/core/style/StyleImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698