-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#417 Keep aspect ratio of image with width/height and max values.
This differs from browsers which will warp the aspect ratio in such circumstances (tested with Chrome/Safari). However, nearly all uses need the aspect ratio preserved. We can revisit this if we implement the object-fit property. Thanks a lot to @swarl who provided code which inspired the test and fix for this issue, as well as reporting the problem.
- Loading branch information
Showing
4 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+90.1 KB
...rc/main/resources/visualtest/expected/issue-417-replaced-sizing-width-height-with-max.pdf
Binary file not shown.
20 changes: 20 additions & 0 deletions
20
...s/src/main/resources/visualtest/html/issue-417-replaced-sizing-width-height-with-max.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 300px 500px; | ||
margin: 0; | ||
} | ||
body { | ||
max-width: 300px; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<img src="../../demos/images/portrait-shuttle.jpg" | ||
width="640" height="975" | ||
style="max-width: 300px; max-height: 300px;"/> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7c4a95a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. Thank you @danfickle
Would be nice if there would be a release any soon.