-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This work moves sizing of replaced objects form externally in each replaced object implementation to internally in the core code. This should reduce duplication and mean all sizing properties are available on each replaced object type. For example, now images have min-width and min-height as well as a border-box implementation. This work is published initially in a new branch because while there are good tests for images we need to test the new sizing code for all the other replaced object options such as SVG, PDF, custom, etc.
- Loading branch information
Showing
9 changed files
with
218 additions
and
80 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
+12.5 KB
...tmltopdf-examples/src/main/resources/visualtest/expected/replaced-img-in-table-cell-2.pdf
Binary file not shown.
Binary file added
BIN
+14.5 KB
openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-sizing-img.pdf
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-img-in-table-cell-2.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,22 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 200px 200px; | ||
margin: 0; | ||
} | ||
body { | ||
margin: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<table> | ||
<tr><td style="border: 1px solid green;"><img src="../../demos/images/flyingsaucer.png" style="max-width: 50px;" /></td></tr> | ||
</table> | ||
|
||
<table> | ||
<tr><td style="border: 1px solid green;width: 150px;"><img src="../../demos/images/flyingsaucer.png" style="max-width: 30%;" /></td></tr> | ||
</table> | ||
</body> | ||
</html> |
43 changes: 43 additions & 0 deletions
43
openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-sizing-img.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,43 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 500px 1500px; | ||
margin: 0; | ||
} | ||
body { | ||
margin: 0; | ||
} | ||
img { | ||
display: block; | ||
border: 2px solid red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<!-- width only --> | ||
<img style="width: 200px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- height only --> | ||
<img style="height: 200px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- min-width --> | ||
<img style="width: 50px; min-width: 200px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- min-height --> | ||
<img style="height: 40px; min-height: 250px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- max-width --> | ||
<img style="width: 1000px; max-width: 70px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- max-height --> | ||
<img style="height: 1000px; max-height: 40px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- border-box --> | ||
<img style="padding: 50px; border: 10px solid red; box-sizing: border-box; width: 200px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
<!-- content-box --> | ||
<img style="padding: 50px; border: 10px solid red; box-sizing: content-box; width: 200px;" src="../../demos/images/flyingsaucer.png" /> | ||
|
||
</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
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
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
Oops, something went wrong.