mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Make resolved serialization of CSS display prefer short form
Although we translate e.g `block` to `block flow` for internal use in the engine, CSS-DISPLAY-3 tells us to use the short form in serializations for compatibility reasons. This adds 9 points to our score on https://html5test.com/ :^)
This commit is contained in:
parent
8defd55349
commit
a98f5c7251
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/awesomekling
Commit: a98f5c7251
Pull-request: https://github.com/SerenityOS/serenity/pull/19086
4 changed files with 90 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
none => none
|
||||
block => block
|
||||
flow-root => flow-root
|
||||
inline => inline
|
||||
inline-block => inline-block
|
||||
run-in => run-in
|
||||
list-item => list-item
|
||||
flex => flex
|
||||
inline-flex => inline-flex
|
||||
grid => grid
|
||||
inline-grid => inline-grid
|
||||
ruby => ruby
|
||||
table => table
|
||||
inline-table => inline-table
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const e = document.createElement("div");
|
||||
document.body.appendChild(e);
|
||||
function checkDisplay(display) {
|
||||
e.style.display = display;
|
||||
const computedStyle = getComputedStyle(e);
|
||||
const serialized = computedStyle.display;
|
||||
println(display + " => " + serialized);
|
||||
}
|
||||
for (display of [
|
||||
"none",
|
||||
"block",
|
||||
"flow-root",
|
||||
"inline",
|
||||
"inline-block",
|
||||
"run-in",
|
||||
"list-item",
|
||||
"flex",
|
||||
"inline-flex",
|
||||
"grid",
|
||||
"inline-grid",
|
||||
"ruby",
|
||||
"table",
|
||||
"inline-table",
|
||||
]) {
|
||||
checkDisplay(display);
|
||||
}
|
||||
e.remove();
|
||||
});
|
||||
</script>
|
||||
15
Tests/LibWeb/Text/input/include.js
Normal file
15
Tests/LibWeb/Text/input/include.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
var __outputElement = null;
|
||||
|
||||
function println(s) {
|
||||
__outputElement.appendChild(document.createTextNode(s + "\n"));
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
__outputElement = document.createElement("pre");
|
||||
__outputElement.setAttribute("id", "out");
|
||||
document.body.appendChild(__outputElement);
|
||||
});
|
||||
|
||||
function test(f) {
|
||||
document.addEventListener("DOMContentLoaded", f);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue