Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCanvases elements have extraneous padding #10726
Comments
|
Those "margins" are actually the space intended for the font's descenders. In both Chrome, these canvases are touching: <style>
canvas {
border: 1px solid black;
margin: 0;
padding: 0;
}
</style>
<canvas width="32" height="32"></canvas><br><canvas width="32" height="32"></canvas>But these canvases have a "margin" between them: <style>
canvas {
border: 1px solid black;
margin: 0;
padding: 0;
}
</style>
<canvas width="32" height="32"></canvas>no descenders<br><canvas width="32" height="32"></canvas>In Servo, the space between them is identical. |
|
The culprit code is |
Do not put any descenders in unless there's actually text. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy --faster` does not report any errors - [X] These changes fix #10726 (github issue number if applicable). - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11275) <!-- Reviewable:end -->
Do not put any descenders in unless there's actually text. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy --faster` does not report any errors - [X] These changes fix #10726 (github issue number if applicable). - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11275) <!-- Reviewable:end -->
Do not put any descenders in unless there's actually text. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy --faster` does not report any errors - [X] These changes fix #10726 (github issue number if applicable). - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11275) <!-- Reviewable:end -->
|
Firefox matches Servo's current behavior when a That's why I couldn't find anything in the base CSS spec to justify the behavior; it's in the Quirks Mode spec! That's also why I found tests that seemed to rely on the behavior that this issue reports as a bug; because the tests are running with DOCTYPEs! :headdesk: |
<!DOCTYPE html>
<style>
canvas {
border: 1px solid black;
margin: 0;
padding: 0;
}
span {
width: 32px;
height: 32px;
display: inline-block;
border: 1px solid black;
}
</style>
<canvas width="32" height="32"></canvas><br><canvas width="32" height="32"></canvas>
<div></div>
<span></span><br><span></span> |
|
The original minimal reproducer still works -- didn't try the others. |






Firefox:


Servo: