Index: third_party/WebKit/Source/core/style/StyleImage.cpp |
diff --git a/third_party/WebKit/Source/core/style/StyleImage.cpp b/third_party/WebKit/Source/core/style/StyleImage.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1eb077d970f790b71b89b016229ae3c89a0df795 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/style/StyleImage.cpp |
@@ -0,0 +1,26 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/style/StyleImage.h" |
+ |
+#include "core/svg/graphics/SVGImage.h" |
+#include "core/svg/graphics/SVGImageForContainer.h" |
+ |
+namespace blink { |
+ |
+LayoutSize StyleImage::imageSizeForSVGImage(SVGImage* svgImage, float multiplier, const LayoutSize& defaultObjectSize) const |
+{ |
+ FloatSize unzoomedDefaultObjectSize(defaultObjectSize); |
+ unzoomedDefaultObjectSize.scale(1 / multiplier); |
+ LayoutSize concreteObjectSize(svgImage->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; |
+} |
+ |
+} // namespace blink |