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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2294683002: Simplify contain constraint calculation (Closed)
Patch Set: Rebase and slight re-structure. Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 2fd380d0b724bd518fdede39aa50def15ba1b65d..dab32f0b9a70945421fb4f4685bd33ed4419de8b 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -212,20 +212,10 @@ FloatSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const
// rectangle that has the object's intrinsic aspect ratio and additionally has neither
// width nor height larger than the constraint rectangle's width and height, respectively."
float solutionWidth = resolveWidthForRatio(defaultObjectSize.height(), intrinsicSizingInfo.aspectRatio);
- float solutionHeight = resolveHeightForRatio(defaultObjectSize.width(), intrinsicSizingInfo.aspectRatio);
- if (solutionWidth <= defaultObjectSize.width()) {
- if (solutionHeight <= defaultObjectSize.height()) {
- float areaOne = solutionWidth * defaultObjectSize.height();
- float areaTwo = defaultObjectSize.width() * solutionHeight;
- if (areaOne < areaTwo)
- return FloatSize(defaultObjectSize.width(), solutionHeight);
- return FloatSize(solutionWidth, defaultObjectSize.height());
- }
-
+ if (solutionWidth <= defaultObjectSize.width())
return FloatSize(solutionWidth, defaultObjectSize.height());
- }
- ASSERT(solutionHeight <= defaultObjectSize.height());
+ float solutionHeight = resolveHeightForRatio(defaultObjectSize.width(), intrinsicSizingInfo.aspectRatio);
return FloatSize(defaultObjectSize.width(), solutionHeight);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698