mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:47:35 +00:00

VALUES-4 defines the internal representation of `calc()` as a tree of calculation nodes. ( https://www.w3.org/TR/css-values-4/#calc-internal ) VALUES-3 lacked any definition here, so we had our own ad-hoc implementation based around the spec grammar. This commit replaces that with CalculationNodes representing each possible node in the tree. There are no intended functional changes, though we do now support nested calc() which previously did not work. For example: `width: calc( 42 * calc(3 + 7) );` I have added an example of this to our test page. A couple of the layout tests that used `calc()` now return values that are 0.5px different from before. There's no visual difference, so I have updated the tests to use the new results.
102 lines
6.2 KiB
Text
102 lines
6.2 KiB
Text
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|
BlockContainer <html> at (0,0) content-size 800x166.8125 children: not-inline
|
|
BlockContainer <body> at (8,8) content-size 784x150.8125 children: not-inline
|
|
Box <div.grid-container> at (8,8) content-size 784x44.9375 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (8,8) content-size 367.140625x17.46875 children: inline
|
|
line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [8,8 6.34375x17.46875]
|
|
"1"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (425.140625,8) content-size 367x17.46875 children: inline
|
|
line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [425.140625,8 8.8125x17.46875]
|
|
"2"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (8,35.46875) content-size 367.140625x17.46875 children: inline
|
|
line 0 width: 9.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [8,35.46875 9.09375x17.46875]
|
|
"3"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (425.140625,35.46875) content-size 367x17.46875 children: inline
|
|
line 0 width: 7.75, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [425.140625,35.46875 7.75x17.46875]
|
|
"4"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,8) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,52.9375) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
Box <div.grid-container> at (8,52.9375) content-size 784x50.9375 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,52.9375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (435.934356,52.9375) content-size 357.300018x17.46875 children: inline
|
|
line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [435.934356,52.9375 6.34375x17.46875]
|
|
"1"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,52.9375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (8,86.40625) content-size 358.534362x17.46875 children: inline
|
|
line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [8,86.40625 8.8125x17.46875]
|
|
"2"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,52.9375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,103.875) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
Box <div.grid-container> at (8,103.875) content-size 784x17.46875 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,103.875) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (408,103.875) content-size 384x17.46875 children: inline
|
|
line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [408,103.875 6.34375x17.46875]
|
|
"1"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,103.875) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,121.34375) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
Box <div.grid-container> at (8,121.34375) content-size 784x20 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,121.34375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item> at (408,121.34375) content-size 384x20 children: inline
|
|
line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 1, rect: [408,121.34375 6.34375x17.46875]
|
|
"1"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,121.34375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,141.34375) content-size 784x0 children: inline
|
|
TextNode <#text>
|
|
TextNode <#text>
|
|
Box <div.grid-container.with-border> at (8,141.34375) content-size 784x17.46875 children: not-inline
|
|
BlockContainer <(anonymous)> at (8,141.34375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item.with-border> at (8,141.34375) content-size 387x17.46875 children: inline
|
|
line 0 width: 104.875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 14, rect: [8,141.34375 104.875x17.46875]
|
|
"left side text"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,141.34375) content-size 0x0 children: inline
|
|
TextNode <#text>
|
|
BlockContainer <div.grid-item.with-border> at (405,141.34375) content-size 387x17.46875 children: inline
|
|
line 0 width: 363.203125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
|
frag 0 from TextNode start: 0, length: 47, rect: [405,141.34375 363.203125x17.46875]
|
|
"right side text right side text right side text"
|
|
TextNode <#text>
|
|
BlockContainer <(anonymous)> at (8,141.34375) content-size 0x0 children: inline
|
|
TextNode <#text>
|