summaryrefslogtreecommitdiff
path: root/Tests/LibWeb
AgeCommit message (Collapse)Author
2023-05-22LibWeb: Support grid-auto-columns and grid-auto-rows properties in GFCAliaksandr Kalenik
Implements assignment of sizes specified in grid-auto-columns/rows for implicitly created tracks.
2023-05-21LibWeb: Implement table rowspanAndi Gallo
Adjust computing the table height and positioning of cells to account for the rowspan property. Fixes #18952.
2023-05-21LibWeb: Don't crash on percentage values for CSS stroke-widthAndreas Kling
Fixes a crash when loading https://vercel.com/
2023-05-21LibWeb: Implement more of spanning tracks sizing in GFCAliaksandr Kalenik
Implements more parts of sizing algorithm for tracks with spanning items to archive parity with implementation for sizing of tracks with non-spanning items.
2023-05-21LibWeb: Include SVG-as-image isolated contexts in layout/DOM tree dumpsAndreas Kling
This allows us to see the inside of SVG-as-image in layout tests. :^)
2023-05-21LibWeb: Add a very basic test for SVG-as-imageAndreas Kling
This mainly just checks that we load the file and learn the correct intrinsic aspect ratio from the external SVG.
2023-05-20LibWeb: Support <svg> elements with `display: block`Andreas Kling
There are a couple of things that went into this: - We now calculate the intrinsic width/height and aspect ratio of <svg> elements based on the spec algorithm instead of our previous ad-hoc guesswork solution. - Replaced elements with automatic size and intrinsic aspect ratio but no intrinsic dimensions are now sized with the stretch-fit width formula. - We take care to assign both used width and used height to <svg> elements before running their SVG formatting contexts. This ensures that the inside SVG content is laid out with knowledge of its viewport geometry. - We avoid infinite recursion in tentative_height_for_replaced_element() by using the already-calculated used width instead of calling the function that calculates the used width (since that may call us right back again).
2023-05-19LibWeb: Fix null dereference on SVG element with bogus fill URLAndreas Kling
Fixes a crash seen on YouTube channel pages.
2023-05-19LibWeb: Make sure that margins don't collapse across a nested BFCAndreas Kling
In order to fix this, I also had to reorganize the code so that we create an independent formatting context even for block-level boxes that don't have any children. This accidentally improves a table layout test as well (for empty tables).
2023-05-19LibWeb: Resolve grid item fixed size paddings in GFCAliaksandr Kalenik
Adds support for grid items with fixed size paddings. Supporting percentage paddings will probably require to do second pass of tracks layout: second pass is needed to recalculate tracks sizes when final items sizes are known when percentage paddings are already resolved.
2023-05-18LibWeb: Use grid item used width as available width during track sizingAliaksandr Kalenik
This change addresses the incorrect assumption that the available width inside a grid item is equal to the width of the track it belongs to. For instance, if a grid item has a width of 200px, the available width inside that item is also 200px regardless of its column(s) base size. To solve this issue, it was necessary to move the final resolution of grid items to occur immediately after the final column track sizes are determined. By doing so, it becomes possible to obtain correct available width inside grid items while resolving the row track sizes.
2023-05-17LibWeb: Resolve CSS custom properties on pseudo elementsAndreas Kling
The resolved property sets are stored with the element in a per-pseudo-element array (same as for pseudo element layout nodes). Longer term, we should stop storing this with elements entirely and make it temporary state in StyleComputer somehow, so we don't waste memory keeping all the resolved properties around. This makes various gradients show up on https://shopify.com/ :^)
2023-05-17LibWeb: Consider span > 1 while getting available space for items in GFCAliaksandr Kalenik
2023-05-17LibWeb: Remove borders from TemporaryTrack in GFCAliaksandr Kalenik
This change makes grid items be responsible for their borders instead of grid tracks which can not have borders itself. There are changes in layout tests but those are improvements :)
2023-05-17LibWeb: Use auto minimimum size while resolving flexible tracks in GFCAliaksandr Kalenik
2023-05-17LibWeb: Skip non-spanning items sizing if there are no such itemsAliaksandr Kalenik
Otherwise base_size and growth_limit for tracks that do not have any spanning items will be overriden with wrong values.
2023-05-17LibWeb: Implement more of "Expand Flexible Tracks" in GFCAliaksandr Kalenik
Implements "Otherwise, if the free space is an indefinite length:" from the spec.
2023-05-17LibWeb: Support flex-basis: calc(...)Andreas Kling
1. Propagate calc() values from StyleProperties to ComputedValues. 2. Actually resolve calc() values when determining the used flex basis. This makes the "support" section on https://shopify.com/ show up correctly as a 2x2 grid (instead of 1x4). :^)
2023-05-17LibWeb: Fix off-by-one in CSS calc() "negate" operationAndreas Kling
When negating a number, we should subtract it from 0, not 1. :^)
2023-05-16LibWeb: Make text justification work between floatsAndreas Kling
While inline content between floating elements was broken correctly, text justification was still using the original amount of available space (without accounting for floats) when justifying fragments.
2023-05-16LibWeb: Rewrite calculation of available space between floatsAndreas Kling
This code now works in terms of *intrusion* by left and right side floats into a given box whose insides we're trying to layout. Previously, it worked in terms of space occupied by floats in the root box of the BFC they participated in. That created a bunch of edge cases since the code asking about the information wasn't operating in root coordinate space, but in the coordinate space of some arbitrarily nested block descendant of the root. This finally allows horizontal margins in the containing block chain to affect floats and nested content correctly, and it also allows us to remove a bogus workaround in InlineFormattingContext.
2023-05-16LibWeb: Fix for absolutely positioned elements with specified heightAndi Gallo
Use inner height since the paintable adds padding back. Fixes #18842.
2023-05-16LibWeb: Reset item_incurred_increase before distributing space in GFCAliaksandr Kalenik
item_incurred_increase should be reset before every next distirbution because otherwise it will accumulate increases from previous distributions which is not supposed to happen.
2023-05-15LibWeb: Basic support for CSS `text-indent: <length-percentage>`Andreas Kling
Note that this simple form of text-indent only affects the first line of formatted content in each block. Percentages are resolved against the width of the block.
2023-05-14LibWeb: Start implementing sizing for tracks with span > 1 items in GFCAliaksandr Kalenik
Partially implements: - Increase sizes to accommodate spanning items crossing content-sized tracks - Increase sizes to accommodate spanning items crossing flexible tracks from https://www.w3.org/TR/css-grid-2/#algo-content
2023-05-14LibWeb: Remove dead code in resolve_intrinsic_track_sizes() in GFCAliaksandr Kalenik
Removes partially implemented algorithm for distributing extra space from spanning item: https://www.w3.org/TR/css-grid-2/#extra-space This algorithm should not be part of resolving track sizing on its own but instead be a subfunction of step 3: https://www.w3.org/TR/css-grid-2/#track-size-max-content-min There are changes in layout tests but those are not regressions.
2023-05-13LibWeb: Flesh out basic support of min-width/height for grid itemsAliaksandr Kalenik
This change brings calculate_minimum_contribution() for grid items and supporting functions.
2023-05-13LibWeb: Return grid container width from automatic_content_width in GFCAliaksandr Kalenik
automatic_content_width() should return grid container width that is supposed to be set by determine_intrinsic_size_of_grid_container().
2023-05-13LibWeb: Implement grid container intrinsic sizes calculationAliaksandr Kalenik
When a width/height constraint is applied to GFC it should set its own width/height to the sum of track sizes according to the spec. Changes in layout tests are improvement over what we had before.
2023-05-11LibWeb: Resolve grid items preferred width in GFCAliaksandr Kalenik
Previously, the width and height of grid items were set to match the size of the grid area they belonged to. With this change, if a grid item has preferred width or height specified to not "auto" value it will be resolved using grid area as containing block and used instead.
2023-05-11LibWeb: Parse calc() function in grid sizesAliaksandr Kalenik
Adds missing part of grid size parsing function to handle calc().
2023-05-10LibWeb: Fix percentage min/max sizes on flex items with intrinsic ratioAndreas Kling
We were resolving percentage values against the containing block size in the wrong axis.
2023-05-10LibWeb: Don't resolve CSS property values for unconnected elementsAndreas Kling
While it's possible to getComputedStyle() on an unconnected element, the resulting object is not supposed to have any values, since we can't resolve style without a document root anyway. This fixes a crash on https://bandcamp.com
2023-05-10LibWeb: Adjust flex item main size through aspect ratio if neededAndreas Kling
If there are min or max size constraints in the cross axis for a flex item that has a desired aspect ratio, we may need to adjust the main size *after* applying the cross size constraints. All the steps to achieving this aren't mentioned in the spec, but it seems that all other browsers behave this way, so we should too.
2023-05-10LibWeb: Implement more of "Resolve Intrinsic Track Sizes" in GFCAliaksandr Kalenik
Implements some parts of "Resolve Intrinsic Track Sizes" algorithm from spec to make it more spec compliant.
2023-05-09LibWeb: Improve handling of min/max constraint violations on imagesAndreas Kling
Instead of bailing after resolving one violated constraint, we have to continue down the list of remaining constraints. We now also call the constraint solver for all replaced elements with "auto" for both width and height. Co-authored-by: 0GreenClover0 <clovers02123@gmail.com>
2023-05-09LibWeb: Initial offset in reverse flex layout moved to opposite sideEmil Militzer
This change moves the initial offset for justify-content: center to the opposite side if the flex layout is in the reverse direction.
2023-05-09LibWeb: Align `GridFormattingContext::run_track_sizing()` with the specAliaksandr Kalenik
1. Stop using -1 to indicate infinity value of growth limit. Just use INFINITY for that. 2. More complete implementation of "Expand Flexible Tracks" step. 3. Return AvailableSize from get_free_space: spec says that this function can return indefinite size and it is ok.
2023-05-09Tests/LibWeb: Split input/grid/minmax.html into smaller testsAliaksandr Kalenik
2023-05-09Tests/LibWeb: Split input/grid/gap.html into smaller testsAliaksandr Kalenik
The file gap.html, which previously had multiple grid tests, has now been divided into smaller files, each containing only one grid test. It is going to make it easier to identify what inputs have been affected by changes in layout code.
2023-05-09Tests/LibWeb: Split input/grid/template-areas.html into smaller testsAliaksandr Kalenik
The file template-areas.html, which previously had multiple grid tests, has now been divided into smaller files, each containing only one grid test. It is going to make it easier to identify what inputs have been affected by changes in layout code. Also this change removes parts of template-areas.html that we can't layout correctly yet.
2023-05-08LibWeb: Stop changing width of block-level flex containers during layoutAndreas Kling
If the parent BFC can come up with a nice stretch-fit width for the flex container, it will have already done so *before* even entering flex layout. There's no need to do it again, midway through the flex layout algorithm. This wasn't just unnecessary, but we were also doing it incorrectly and not taking margins into account when calculating the amount of available space for stretch-fit. This led to oversized flex containers in the presence of negative margins. Fixes #18614
2023-05-08LibWeb: Use layout-test-mode for layout testsmartinfalisse
Also do some test changes to test it out :^)
2023-05-07LibWeb: Set width in `compute_width_for_table_wrapper()`Aliaksandr Kalenik
Width of table wrapper need to be set to to calculate width of table box inside. Otherwise TFC will set wrong width assuming width of containing block is 0.
2023-05-07LibWeb: Enforce min/max height constraints on abspos replaced boxesAndreas Kling
Fixes #18658
2023-05-06LibWeb: Consolidate track sizing code for rows and columns in GFCAliaksandr Kalenik
Although the algorithm for sizing tracks (rows or columns) is defined once for both dimensions in the specification (https://www.w3.org/TR/css-grid-2/#algo-track-sizing), we have implemented it twice separately for sizing rows and columns. In addition to code duplication, another issue is that these implementations of the same algorithm have already diverged in some places, and this divergence is likely to become even worse as our implementation evolves. This change unifies code for both dimension into one method that runs track sizing. While this change brings a bit of collateral damange (border.html and minmax.html got changes in layout snaphots) it ultimately brings more benefits because now we can evolve layout for both rows and colums without duplicating the code :)
2023-05-05LibWeb: Zero out margins if width is not 'auto' in BFC's compute_width0GreenClover0
Reverse the condition to satisfy the spec comment. Probably a typo. A 3 year old typo! :^)
2023-05-05LibWeb: Remove early resolve to auto while calculating border-box widthAliaksandr Kalenik
`Length::resolved(Node&)` transforms infinite values to "auto". Following transformations: Infinite (Length) -> "auto" -> 0 (px) cause border-box width to be resolved in zero when it should be inf px. Removing `Length::resolved(Node&)` makes it work right: Infinite (Length) -> Infinite (px) Fixes #18649
2023-05-05LibWeb: Remove setting length to 0px if it is not definiteAliaksandr Kalenik
If available width (or height) is max-content and width (or height) value is 100% it should be resolved in infinite px, not 0 px. Fixes #18639
2023-05-04LibWeb: Narrow width of boxes that create BFC to avoid overlap of floatAliaksandr Kalenik
https://www.w3.org/TR/CSS22/visuren.html#floats says that when a box establishes BFC it should not overlap with floats. The way to avoid overlaps is up to implementor. This change implements avoiding overlap by narrowing width of a box because it seems like what other engines do (in the scenarios I tested).