Grid: display:grid non è più un blocco travestito
`display: grid` veniva mappato su Display::Block. Una pagina costruita a griglie non dava errore: finiva in colonna unica. Era l'unico punto in cui il motore mentiva, invece di dichiarare un limite. Cosa c'è ora: - Display::Grid e Traccia (Px/Pct/Fr/Auto) in style.rs - grid-template-columns/-rows con px, %, fr, auto, minmax(a, b), repeat(n, ...) - gap/row-gap/column-gap già c'erano dal flex, riusati - posizionamento automatico in ordine di documento, grid-column/row: span N - righe implicite alte come il contenuto, righe dichiarate in px o percentuale - due passate obbligate: l'altezza di una riga dipende dagli elementi che ci stanno dentro, e quegli elementi hanno bisogno della loro larghezza definitiva - stretch: un elemento con altezza automatica riempie la riga (align-items: normal vale come stretch). È il motivo per cui si usa il grid: schede affiancate della stessa altezza. La prima stesura non lo faceva, e si vedeva — la scheda con meno testo restava più bassa - 7 casi reftest (92-98): colonne fisse, gap, fr, righe automatiche, repeat, stretch di riga, align-items: start Fuori ambito dichiarato, non ignorato: posizionamento esplicito (`2 / 4`), aree e linee con nome, grid-auto-flow: column, justify-items, ridistribuzione delle altezze su più righe con span, auto-fill/auto-fit (valgono una traccia sola). Due trappole verificate: - `strings` su un binario Rust non è una prova: Rust fonde i letterali, quindi `grid-template-columns` compare troncato (`grid-template-co`) e una ricerca testuale dice "manca" anche quando c'è. Mi era già successo con ALPN. - Per provare che una funzione esiste davvero nel build aarch64 si compila il bin di renderizzazione per il target e lo si esegue con qemu: `cargo build --release --target aarch64-unknown-linux-gnu --bin render` poi `qemu-aarch64-static -L /usr/aarch64-linux-gnu target/aarch64-.../render ...`. Geometrie identiche all'host sono la prova; i simboli no (vengono inlinati).
This commit is contained in:
1 parent
6a14853d0d
commit
e138e01974
14 files changed
+700
-8
No files matched your search
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "92-grid-due-colonne",
|
||||
"doc": "griglia di due colonne fisse 100 e 200 in 300px: la seconda parte a 108.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:100px 200px;width:300px\"><div style=\"height:40px;background:#ff0000\"></div><div style=\"height:40px;background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
300,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
108,
|
||||
8,
|
||||
200,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "93-grid-gap",
|
||||
"doc": "colonne 100+100 con column-gap 20: la seconda colonna parte a 128, e la griglia misura 220.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:100px 100px;column-gap:20px;width:220px\"><div style=\"height:30px;background:#ff0000\"></div><div style=\"height:30px;background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
220,
|
||||
30
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
128,
|
||||
8,
|
||||
100,
|
||||
30
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "94-grid-fr",
|
||||
"doc": "1fr 2fr in 300px senza gap: 100 e 200 px.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:1fr 2fr;width:300px\"><div style=\"height:40px;background:#ff0000\"></div><div style=\"height:40px;background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
108,
|
||||
8,
|
||||
200,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "95-grid-righe-automatiche",
|
||||
"doc": "una colonna, due righe da 30 e 50 con row-gap 10: la seconda riga parte a 48 e la griglia è alta 90.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:100px;row-gap:10px;width:100px\"><div style=\"height:30px;background:#ff0000\"></div><div style=\"height:50px;background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
90
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
30
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
8,
|
||||
48,
|
||||
100,
|
||||
50
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "96-grid-repeat",
|
||||
"doc": "repeat(3, 1fr) in 300px: tre colonne da 100.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:repeat(3, 1fr);width:300px\"><div style=\"height:20px;background:#ff0000\"></div><div style=\"height:20px;background:#00ff00\"></div><div style=\"height:20px;background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
20
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
108,
|
||||
8,
|
||||
100,
|
||||
20
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:2",
|
||||
"rect": [
|
||||
208,
|
||||
8,
|
||||
100,
|
||||
20
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "97-grid-stretch-riga",
|
||||
"doc": "un elemento di griglia con altezza automatica riempie la riga: la seconda cella, vuota, è alta come la prima (40).",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:100px 100px;width:200px\"><div style=\"background:#ff0000\"><div style=\"height:40px\"></div></div><div style=\"background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
200,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
108,
|
||||
8,
|
||||
100,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "98-grid-align-start",
|
||||
"doc": "con align-items:start gli elementi non si allungano: il secondo resta alto zero.",
|
||||
"html": "<div style=\"display:grid;grid-template-columns:100px 100px;width:200px;align-items:start\"><div style=\"background:#ff0000\"><div style=\"height:40px\"></div></div><div style=\"background:#0000ff\"></div></div>",
|
||||
"css": "",
|
||||
"viewport": [
|
||||
600,
|
||||
400
|
||||
],
|
||||
"probes": [],
|
||||
"boxes": [
|
||||
{
|
||||
"path": "html>body>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
200,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:0",
|
||||
"rect": [
|
||||
8,
|
||||
8,
|
||||
100,
|
||||
40
|
||||
],
|
||||
"tol": 0.8
|
||||
},
|
||||
{
|
||||
"path": "html>body>div:0>div:1",
|
||||
"rect": [
|
||||
108,
|
||||
8,
|
||||
100,
|
||||
0
|
||||
],
|
||||
"tol": 1.0
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user