-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement non-zero dimension attribute parsing
Fixes #8445 The only attributes I found that we have implemented that uses non-zero dimenion attributes: * `width` for `<td>` and `<th>` (table cells) * `width` for `<table>` I updated these implementations to use the new non-zero dimension attribute parsing and added associated regression tests.
- Loading branch information
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
html/rendering/non-replaced-elements/tables/table-cell-width-ref.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,37 @@ | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
|
||
.row { | ||
clear: both; | ||
} | ||
|
||
.row div { | ||
float: left; | ||
} | ||
|
||
.red { | ||
background-color: red; | ||
} | ||
</style> | ||
|
||
<div class="row"> | ||
<div class="red" style="width: 200px">a</div> | ||
<div style="width: 200px">a</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="red" style="width: 200px">a</div> | ||
<div style="width: 200px">a</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="red" style="width: 100px">a</div> | ||
<div style="width: 300px">a</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="red" style="width: 100px">a</div> | ||
<div style="width: 300px">a</div> | ||
</div> |
54 changes: 54 additions & 0 deletions
54
html/rendering/non-replaced-elements/tables/table-cell-width.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,54 @@ | ||
<link rel="match" href="table-cell-width-ref.html"> | ||
<style> | ||
body { | ||
margin: 0; | ||
} | ||
|
||
table { | ||
width: 400px; | ||
border-collapse: collapse; | ||
} | ||
|
||
th { | ||
font-weight: normal; | ||
text-align: left; | ||
} | ||
|
||
td, th { | ||
padding: 0; | ||
} | ||
|
||
td:first-child, th:first-child { | ||
background-color: red; | ||
} | ||
</style> | ||
|
||
<!-- width=0 should be treated as 'auto' --> | ||
<table> | ||
<tr> | ||
<th width=0>a</th> | ||
<th>a</th> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td width=0>a</td> | ||
<td>a</td> | ||
</tr> | ||
</table> | ||
|
||
<!-- test valid width attribute value--> | ||
<table> | ||
<tr> | ||
<th width=100>a</th> | ||
<th>a</th> | ||
</tr> | ||
</table> | ||
|
||
<table> | ||
<tr> | ||
<td width=100>a</td> | ||
<td>a</td> | ||
</tr> | ||
</table> |
13 changes: 13 additions & 0 deletions
13
html/rendering/non-replaced-elements/tables/table-width-ref.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,13 @@ | ||
<style> | ||
p { | ||
padding: 0; | ||
margin: 0; | ||
} | ||
</style> | ||
|
||
<p>a b</p> | ||
|
||
<hr> | ||
|
||
<p>a</p> | ||
<p>b</p> |
30 changes: 30 additions & 0 deletions
30
html/rendering/non-replaced-elements/tables/table-width.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,30 @@ | ||
<link rel="match" href="table-width-ref.html"> | ||
|
||
<style> | ||
table { | ||
border-collapse: collapse; | ||
} | ||
|
||
td { | ||
padding: 0; | ||
} | ||
</style> | ||
|
||
<!-- width=0 should be treated as 'auto' --> | ||
<table width=0> | ||
<tr> | ||
<td> | ||
a b | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<hr> | ||
|
||
<table width=1> | ||
<tr> | ||
<td> | ||
a b | ||
</td> | ||
</tr> | ||
</table> |