houdini explaining css
play

Houdini - Explaining CSS Ian Kilpatrick - Google Software Engineer - PowerPoint PPT Presentation

Houdini - Explaining CSS Ian Kilpatrick - Google Software Engineer Twitter: @bfgeek Standards Track Wait for Write Browsers Propose Idea Browser Use Feature! Specification Implement Adoption Standards Track Wait for Write Browsers


  1. Houdini - Explaining CSS Ian Kilpatrick - Google Software Engineer Twitter: @bfgeek

  2. Standards Track Wait for Write Browsers Propose Idea Browser Use Feature! Specification Implement Adoption

  3. Standards Track Wait for Write Browsers Propose Idea Browser Use Feature! Specification Implement Adoption

  4. Standards Track Wait for Write Browsers Propose Idea Browser Use Feature! Specification Implement Adoption

  5. Polyfill Track Implement Use Feature! Feature

  6. (Rendering Pipeline) DOM CSS User Script Style Layout Paint Style Composite Layout

  7. DOM CSS User Script Style Layout Paint Style Composite Layout

  8. DOM CSS User Script Style Layout Paint Style Composite Layout

  9. DOM CSS User Script Style Layout Paint Style Composite Layout

  10. DOM CSS User Script Style Layout Paint Style Composite Layout

  11. DOM CSS User Script Style Layout Paint Style Composite Layout

  12. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); }

  13. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); }

  14. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); }

  15. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); }

  16. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); }

  17. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); --my-scale: ‘foo’; }

  18. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); --my-scale: ‘foo’; }

  19. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); --my-scale: ‘foo’; }

  20. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); transition: --my-scale 4s; }

  21. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); transition: --my-scale 4s; }

  22. :root { --my-scale: 1; } .className { --my-scale: 2; transform: scale(var(--my-scale)); transition: --my-scale 4s; }

  23. document.registerProperty({ name: ‘--my-scale’, syntax: ‘<number>’, inherits: false, initial: ‘1’, });

  24. document.registerProperty({ name: ‘--my-scale’, syntax: ‘<number>’, inherits: false, initial: ‘1’, });

  25. document.registerProperty({ name: ‘--my-scale’, syntax: ‘<number>’, inherits: false, initial: ‘1’, });

  26. .className { --my-scale: 2; --my-scale: ‘foo’; transform: scale(var(--my-scale)); transition: --my-scale 4s; }

  27. DOM CSS User Script Style Layout Paint Style Composite Layout

  28. DOM CSS User Script Style Layout Paint Style Composite Layout

  29. DOM CSS User Script Style Layout Paint Style Composite Layout

  30. DOM Tree Layout Layout/Fragment Tree Computed Style

  31. DOM Tree Layout Layout/Fragment Tree Computed Style

  32. DOM Tree Layout Layout/Fragment Tree Computed Style

  33. DOM Tree Layout Layout/Fragment Tree Computed Style

  34. // style.css .className { display: layout(‘relative’); } // layout.js registerLayout(‘relative’, class { static inputProperties = [‘--above’, ‘--below’, /* etc */ ]; minInlineSize() { /* stuff */ return minSize; } maxInlineSize() { /* stuff */ return maxSize; } layout(constraints, children, styleMap) { /* layout alg. */ } });

  35. // style.css .className { display: layout(‘relative’); } // layout.js registerLayout(‘relative’, class { static inputProperties = [‘--above’, ‘--below’, /* etc */ ]; minInlineSize() { /* stuff */ return minSize; } maxInlineSize() { /* stuff */ return maxSize; } layout(constraints, children, styleMap) { /* layout alg. */ } });

  36. // style.css .className { display: layout(‘relative’); } // layout.js registerLayout(‘relative’, class { static inputProperties = [‘--above’, ‘--below’, /* etc */ ]; minInlineSize() { /* stuff */ return minSize; } maxInlineSize() { /* stuff */ return maxSize; } layout(constraints, children, styleMap) { /* layout alg. */ } });

  37. // style.css .className { display: layout(‘relative’); } // layout.js registerLayout(‘relative’, class { static inputProperties = [‘--above’, ‘--below’, /* etc */ ]; minInlineSize() { /* stuff */ return minSize; } maxInlineSize() { /* stuff */ return maxSize; } layout(constraints, children, styleMap) { /* layout alg. */ } });

  38. DOM CSS User Script Style Layout Paint Style Composite Layout

  39. DOM CSS User Script Style Layout Paint Style Composite Layout

  40. Layout Information Paint Pixels! Computed Style

  41. Layout Information Paint Pixels! Computed Style

  42. Layout Information Paint Pixels! Computed Style

  43. Layout Information Paint Pixels! Computed Style

  44. // style.css .className { background-image: paint(circle); --circle-color: red; transition: --circle-color 1s; } // paint.js registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; overflow(styleMap) { /* stuff */ return overflow; } paint(ctx, geom, styleMap) { /* stuff */ } });

  45. // style.css .className { background-image: paint(circle); --circle-color: red; transition: --circle-color 1s; } // paint.js registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; overflow(styleMap) { /* stuff */ return overflow; } paint(ctx, geom, styleMap) { /* stuff */ } });

  46. // style.css .className { background-image: paint(circle); --circle-color: red; transition: --circle-color 1s; } // paint.js registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; overflow(styleMap) { /* stuff */ return overflow; } paint(ctx, geom, styleMap) { /* stuff */ } });

  47. // style.css .className { background-image: paint(circle); --circle-color: red; transition: --circle-color 1s; } // paint.js registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; overflow(styleMap) { /* stuff */ return overflow; } paint(ctx, geom, styleMap) { /* stuff */ } });

  48. // style.css .className { background-image: paint(circle); --circle-color: red; transition: --circle-color 1s; } // paint.js registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; overflow(styleMap) { /* stuff */ return overflow; } paint(ctx, geom, styleMap) { /* stuff */ } });

  49. registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; paint(ctx, geom, styleMap) { var color = styleMap.get('--circle-color'); ctx.fillStyle = color; var x = geom.width / 2; var y = geom.height / 2; var radius = Math.min(x, y); ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI, false); ctx.fill(); } });

  50. registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; paint(ctx, geom, styleMap) { var color = styleMap.get('--circle-color'); ctx.fillStyle = color; var x = geom.width / 2; var y = geom.height / 2; var radius = Math.min(x, y); ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI, false); ctx.fill(); } });

  51. registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; paint(ctx, geom, styleMap) { var color = styleMap.get('--circle-color'); ctx.fillStyle = color; var x = geom.width / 2; var y = geom.height / 2; var radius = Math.min(x, y); ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI, false); ctx.fill(); } });

  52. registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; paint(ctx, geom, styleMap) { var color = styleMap.get('--circle-color'); ctx.fillStyle = color; var x = geom.width / 2; var y = geom.height / 2; var radius = Math.min(x, y); ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI, false); ctx.fill(); } });

  53. registerPaint(‘circle’, class { static inputProperties = [‘--circle-color’]; paint(ctx, geom, styleMap) { var color = styleMap.get('--circle-color'); ctx.fillStyle = color; var x = geom.width / 2; var y = geom.height / 2; var radius = Math.min(x, y); ctx.beginPath(); ctx.arc(x, y, radius, 0, 2 * Math.PI, false); ctx.fill(); } });

  54. DOM CSS User Script Style Layout Paint Style Composite Layout

  55. DOM CSS User Script Style Layout Paint Style Composite Layout

  56. DOM CSS User Script Style Layout Paint Style Composite Layout

  57. DEMOS!

  58. Questions?

  59. Specs: drafts.css-houdini.org Github: github.com/w3c/css-houdini- drafts

Recommend


More recommend