-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#143 Implement support for box-sizing:border-box
Includes support for min/max height/width properties and test cases. Limitations: + Not implemented for replaced elements such as images/MathML, etc. + Not taken into account during the table layout algorithm.
- Loading branch information
Showing
14 changed files
with
337 additions
and
11 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
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
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
Binary file added
BIN
+6.06 KB
openhtmltopdf-examples/src/main/resources/visualtest/expected/sizing-height.pdf
Binary file not shown.
Binary file added
BIN
+5.38 KB
openhtmltopdf-examples/src/main/resources/visualtest/expected/sizing-width-border-box.pdf
Binary file not shown.
Binary file added
BIN
+5.28 KB
openhtmltopdf-examples/src/main/resources/visualtest/expected/sizing-width-content-box.pdf
Binary file not shown.
69 changes: 69 additions & 0 deletions
69
openhtmltopdf-examples/src/main/resources/visualtest/html/sizing-height.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,69 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 100px 1000px; | ||
margin: 0; | ||
} | ||
body { | ||
margin: 10px; | ||
} | ||
div.cont { | ||
border: 1px solid red; | ||
height: 31px; | ||
margin-top: 10px; | ||
} | ||
.h1 { | ||
border: 1px solid green; | ||
box-sizing: content-box; | ||
} | ||
.h2 { | ||
border: 1px solid blue; | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<!-- height only --> | ||
<div class="cont"><div class="h1" style="height: 30px;"></div></div> | ||
|
||
<!-- height/padding/border --> | ||
<div class="cont"><div class="h1" style="height: 10px;padding-top: 10px; border-top-width: 10px;"></div></div> | ||
|
||
<!-- height/padding/margin --> | ||
<div class="cont"><div class="h1" style="height: 10px;padding-bottom: 10px; margin-top: 10px;"></div></div> | ||
|
||
<!-- min-height overrides height --> | ||
<div class="cont"><div class="h1" style="height: 10px;min-height: 30px;"></div></div> | ||
|
||
<!-- max-height overrides height --> | ||
<div class="cont"><div class="h1" style="height: 50px;max-height: 30px;"></div></div> | ||
|
||
<!-- min-height overrides height and max-height --> | ||
<div class="cont"><div class="h1" style="height: 10px;min-height: 30px;max-height: 10px;"></div></div> | ||
|
||
|
||
|
||
|
||
<!-- height only --> | ||
<div class="cont"><div class="h2" style="height: 32px;"></div></div> | ||
|
||
<!-- height/padding/border --> | ||
<div class="cont"><div class="h2" style="height: 32px;padding-top: 10px; border-top-width: 10px;"></div></div> | ||
|
||
<!-- height/padding/margin --> | ||
<div class="cont"><div class="h2" style="height: 22px;padding-bottom: 10px; margin-top: 10px;"></div></div> | ||
|
||
<!-- min-height overrides height --> | ||
<div class="cont"><div class="h2" style="height: 10px;min-height: 32px;"></div></div> | ||
|
||
<!-- max-height overrides height --> | ||
<div class="cont"><div class="h2" style="height: 50px;max-height: 32px;"></div></div> | ||
|
||
<!-- min-height overrides height and max-height --> | ||
<div class="cont"><div class="h2" style="height: 10px;min-height: 32px;max-height: 10px;"></div></div> | ||
|
||
|
||
|
||
</body> | ||
</html> |
76 changes: 76 additions & 0 deletions
76
openhtmltopdf-examples/src/main/resources/visualtest/html/sizing-width-border-box.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,76 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 800px 1000px; | ||
margin: 0; | ||
} | ||
body { | ||
margin: 10px; | ||
} | ||
div { | ||
border: 1px solid red; | ||
box-sizing: border-box; | ||
} | ||
.w { | ||
margin: 0; | ||
margin-top: 10px; | ||
padding: 0; | ||
height: 30px; | ||
border-color: green; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div style="width: 601px;"> | ||
<!-- Width plus margin-right --> | ||
<div class="w" style="width: 600px; margin-right: 100px;"></div> | ||
|
||
<!-- Width plus margin-left --> | ||
<div class="w" style="width: 600px; margin-left: 100px;"></div> | ||
|
||
<!-- Width includes padding-right --> | ||
<div class="w" style="width: 600px; padding-right: 100px;"></div> | ||
|
||
<!-- Width includes padding-left --> | ||
<div class="w" style="width: 600px; padding-left: 100px;"></div> | ||
|
||
<!-- Min-width overrides width --> | ||
<div class="w" style="width: 50%; min-width: 600px; padding: 100px;"></div> | ||
|
||
<!-- Max-width overrides width --> | ||
<div class="w" style="width: 150%; max-width: 600px; padding-left: 100px;"></div> | ||
|
||
<!-- Max-width overrides default block width of auto --> | ||
<div class="w" style="max-width: 500px; padding-left: 100px;"></div> | ||
|
||
<!-- Min-width wins over width and max-width --> | ||
<div class="w" style="max-width: 300px; min-width: 600px; width: 300px;"></div> | ||
|
||
<!-- Width overlap on right --> | ||
<div class="w" style="width: 700px;"></div> | ||
|
||
<!-- Min-width overlap on right --> | ||
<div class="w" style="min-width: 700px;"></div> | ||
|
||
<!-- Border-right included --> | ||
<div class="w" style="width: 600px; border-right-width: 100px;"></div> | ||
|
||
<!-- Border-right inside due to width being auto --> | ||
<div class="w" style="border-right-width: 100px;"></div> | ||
|
||
<!-- Margin-right inside due to width being auto --> | ||
<div class="w" style="margin-right: 100px;"></div> | ||
|
||
<!-- Padding-right inside due to width being auto --> | ||
<div class="w" style="padding-right: 100px;"><div style="height: 100%;"></div></div> | ||
|
||
<!-- Border/padding included in width --> | ||
<div class="w" style="width: 600px; padding-right: 50px; border-right-width: 50px;"><div style="height: 100%;"></div></div> | ||
|
||
<!-- Margin plus Border/padding/width --> | ||
<div class="w" style="width: 600px; margin-left: 100px; padding-right: 20px; border-right-width: 50px;"><div style="height: 100%;"></div></div> | ||
|
||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.