summaryrefslogtreecommitdiff
path: root/Tests/LibWeb
AgeCommit message (Collapse)Author
2023-06-05Tests/LibWeb: Add some text tests for 'parsing a legacy color value'Shannon Booth
I was not aware of this framework back when implementing this back in bc54560e5942c9ff4b9049c034ad09a9f8446fb6. Add in some basic tests for this now that we are compliant with the specification.
2023-06-04LibWeb: Account for negative margins when calculating float intrusionAndreas Kling
If a box has a negative margin-left, it may have a negative effective offset within its parent BFC root coordinate system. We can account for this when calculating the amount of left-side float intrusion by flooring the X offset at 0.
2023-06-02LibWeb: Support font-size: calc()Andreas Kling
Now that we have a way to resolve calc() lengths without a layout node, we can finally support calc() values in font-size. This wasn't possible before because font-related properties have to be resolved eagerly in StyleComputer due to font-relative CSS length units depending on the computed font being known.
2023-06-02LibWeb: Fix crashing when grid track size is calc() with percentageAliaksandr Kalenik
Use contains_percentage() that works for calc() values instead of is_percentage(). This fixes issue when tracks with calc() that has percentages where considered as "fixed" tracks with resolvable size which led to incorrectly resolved infinite final track sizes.
2023-06-02LibWeb: Bounds-check parsed CSS typesSam Atkins
This reintroduces bounds-checking for the CSS `<angle>`, `<frequency>`, `<integer>`, `<length>`, `<number>`, `<percentage>`, `<resolution>`, and `<time>` types. I regressed this around 6b8f4841145a53553c0007a6ff4feefec98a426a when changing how we parsed StyleValues. This is an improvement from before though, since we now allow the bounds of a dimension type to have units. Added a test to make sure we don't regress this again. :^)
2023-06-02LibWeb: Support flex items with calc() main size containing percentagesAndreas Kling
If a flex item's main size is a CSS calc() value that resolves to a length and contains a percentage, we can only resolve it when we have the corresponding reference size for the containing block.
2023-06-02LibWeb: Avoid text-aligning content that is too long for its line boxFalseHonesty
Previously, we would always respect the `text-align` property, even if the text being aligned was too long for its line box and would be clipped. This led to seeing the clipped middle/end of strings when we should instead always see the beginning of the text.
2023-06-01LibWeb: Round lengths to 3 decimals after resolving from percentageAndreas Kling
This is a hack to emulate the behavior of other engines that use fixed-point math. By rounding to 3 decimals, we retain a fair amount of detail, while still allowing overshooting 100% without breaking lines. This is both gross and slow, but it fixes real sites. Notably, the popular Bootstrap library uses overshooting percentages in their 12-column grid system. This hack can be removed when CSSPixels is made a fixed-point type.
2023-06-01LibWeb: Allow infinitely long flex lines when sizing under max-contentAndreas Kling
If the flex container is being sized under a max-content main size constraint, there is effectively infinite space available for flex items. Thus, flex lines should be allowed to be infinitely long. This is a little awkward, because the spec doesn't mention specifics about how to resolve flexible lengths during intrninsic sizing. I've marked the spec deviations with big "AD-HOC" comments.
2023-06-01LibWeb: Measure the overflow for all scroll containersAndreas Kling
Instead of just measuring the layout viewport, we now measure overflow in every box that is a scroll container. This has the side effect of no longer creating paintables for layout boxes that didn't participate in layout. (For example, empty/anonymous boxes that were ignored by flex itemization.) Such boxes are now marked as "(not painted)" in the layout tree dumps, as they have no paintable to dump geometry from.
2023-06-01LibWeb: Support `line-height: calc(...)` values that resolve to numberAndreas Kling
This is used on GitHub and many other websites.
2023-06-01LibWeb: Add support for parsing place-content shorthand CSS propertyFalseHonesty
2023-06-01Tests/LibWeb: Import my test rebaselining scriptAndreas Kling
This is not a beautiful program, but it does allow you to regenerate the baseline expectation for a given layout or text test with a single command. :^)
2023-05-31LibWeb: Change calc node representation from float to doublestelar7
2023-05-30LibWeb/Tests: Add missing newline in inset-shorthand-property.txtSimon Wanner
2023-05-30LibWeb: Make 'optional BufferSource' IDL arguments actually optionalAli Mohammad Pur
Previously this was compiled to require an object despite the IDL file specifying 'optional'. This commit makes IDLGenerator respect this modifier, and fixes the only affected instance.
2023-05-30LibWeb: Set margin, padding and border for replaced boxesAndi Gallo
Separating the paths for replaced and non-replaced floating boxes lost the logic for margin, padding and border which was done by compute_width_for_floating_box. Set them the same way as we do for block-level replaced elements, per the specification.
2023-05-30LibWeb: Add support for parsing 'inset' shorthand CSS propertyFalseHonesty
2023-05-29LibWeb: Output names of inner table boxes in layout dumpAliaksandr Kalenik
Since there are no table-specific boxes anymore it would be nice to output their types additionally in layout dump so we can tell table boxes from "regular" boxes.
2023-05-29LibWeb: Remove Layout::TableCellBoxAliaksandr Kalenik
Special box types for inner table boxes might conflict with special types for <button>, <input> or <label>.
2023-05-29LibWeb: Remove Layout::TableRowBoxAliaksandr Kalenik
Special box types for inner table boxes might conflict with special types for <button>, <input> or <label>.
2023-05-29LibWeb: Remove Layout::TableRowGroupBoxAliaksandr Kalenik
Special box types for inner table boxes might conflict with special types for <button>, <input> or <label>.
2023-05-29LibWeb: Support `min-content` for `width`, `min-width` and `max-width`Andreas Kling
We're gonna need to handle this in many more places, this patch only adds it to calculate_inner_width().
2023-05-29LibWeb: Support `max-content` for `width`, `min-width` and `max-width`Andreas Kling
We're gonna need to handle this in many more places, this patch only adds it to calculate_inner_width().
2023-05-29LibWeb: Remove Layout::TableBoxAliaksandr Kalenik
Solves conflict in layout tree "type system" when elements <label> (or <button>) can't have `display: table` because Box can't be Layout::Label (or Layout::ButtonBox) and Layout::TableBox at the same time.
2023-05-28Tests/LibWeb: Use the include.js helper in "basic.html"Andreas Kling
2023-05-28LibWeb: Wrap child text sequences of grid container in anonymous blocksAliaksandr Kalenik
From spec https://drafts.csswg.org/css-grid/#grid-items: "Each in-flow child of a grid container becomes a grid item, and each child text sequence is wrapped in an anonymous block container grid item." Fixes the problem that text sequences inside grid containers are ignored and not displayed.
2023-05-28LibWeb: Treat unresolvable percentages as auto to resolve sizes in GFCAliaksandr Kalenik
Fixes the bug that currently we always consider tracks with percentage size as ones with "fixed" length even when available size is not definite. With this change tracks with percentage size when available size is not definite will be considered as "intrinsic" sized.
2023-05-28LibWeb: Support reverse flex layout with space-around/space-betweenAndreas Kling
We were not taking reverse flex directions into account when choosing the initial offset for flex item placement if justify-content were either space-around or space-between.
2023-05-28LibWeb: Skip children based on media when updating the source setAndi Gallo
If child has a media attribute and its value does not match the environment, continue to the next child.
2023-05-27LibWeb: Make resolved serialization of CSS `display` prefer short formAndreas Kling
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/ :^)
2023-05-27LibWeb: Unit tests for min/max-inline-sizeKarthik Karanth
2023-05-27Ladybird+Tests/LibWeb: Add very basic text-only test harnessAndreas Kling
This allows us to create "text tests" in addition to "layout tests". Text tests work the same as layout tests, but dump the document content as text and exit upon receiving the window "load" event.
2023-05-27LibWeb: Accept fit-content as a value for min-width and max-widthAndreas Kling
This starts working immediately in BFC thanks to calculate_inner_width being used for width constraints. :^)
2023-05-27LibWeb: Support fit-content width for block-level boxesAndreas Kling
2023-05-27LibWeb: Support grid items with fit-content width :^)Andreas Kling
2023-05-27LibWeb: Add basic parsing of grid shorthand CSS propertyAliaksandr Kalenik
Introduces incomplete parsing of grid shorthand property. Only <grid-template> part of syntax is supported for now but it is enough to significantly improve rendering of websites that use this shorthand to define grid :)
2023-05-26LibWeb: Fix width calculation for floating replaced elementsAndi Gallo
The path for floating, replaced elements must not fall through to the path taken for floating, non-replaced elements. The former works like inline replaced elements, while the latter uses a completely different algorithm which doesn't account for intrinsic ratio. Falling through overrides the correct value computed by the former. Fixes #19061.
2023-05-26LibWeb: Reset margin collapsing state only if box indeed add clearanceAliaksandr Kalenik
This fixes the issue when margin collapsing state was always reset if a box has clear property not equal to none even if it does not actually introduce clearance.
2023-05-26LibWeb: Consume sign in `SVG::parse_elliptical_arg_argument`Cameron Youell
This was crashing on google.com with the linux chrome user agent, interestingly it seems like this behavior may have been accidental as only two of the three `parse_number()` were changed in f7dbcb6
2023-05-26LibWeb: Get reference height from closest non-anonymous ancestorAndi Gallo
Ignore anonymous block boxes when resolving percentage weights that would refer to them, per the CSS 2 visual formatting model specification. This fixes the case when we create an anonymous block between an image which uses a percentage height relative to a parent which specifies a definite height. Fixes #19052.
2023-05-25LibWeb: Make input element placeholders look betterAndreas Kling
We now create a flex container inside the input element's UA shadow tree and add the placeholder and non-placeholder text as flex items (wrapped in elements whose style we can manipulate). This fixes the visual glitch where the placeholder would appear below the bounding box of the input element. It also allows us to align the text vertically inside the input element (like we're supposed to). In order to achieve this, I had to make two small architectural changes to layout tree building: - Elements can now report that they represent a given pseudo element. This allows us to instantiate the ::placeholder pseudo element as an actual DOM element inside the input element's UA shadow tree. - We no longer create a separate layout node for the shadow root itself. Instead, children of the shadow root are treated as if they were children of the DOM element itself for the purpose of layout tree building.
2023-05-25LibWeb: Make `value_id_from_string()` return OptionalSam Atkins
2023-05-24LibWeb: Sum horizontal margins to calculate space used by floatsAliaksandr Kalenik
This fixes the issue where max margin is used to find offset of floating box although horizonal margins do not collapse so they need to be summed instead.
2023-05-24LibWeb: Remove `Gfx::Rect<float>` workarounds from BFCJelle Raaijmakers
No longer is the last horizontal line of pixels ignored during layout. This used to be a bug in `Gfx::Rect<float>` that was fixed in f391ccfe53e18395842d0d6b743d08d23b9108e5.
2023-05-24LibWeb: Make CSSPixels and Length use 64-bit (double) floating pointAndreas Kling
This fixes a plethora of rounding problems on many websites. In the future, we may want to replace this with fixed-point arithmetic (bug #18566) for performance (and consistency with other engines), but in the meantime this makes the web look a bit better. :^) There's a lot more things that could be converted to doubles, which would reduce the amount of casting necessary in this patch. We can do that incrementally, however.
2023-05-24LibWeb: Rebaseline a layout test after 10ceacf5fb6ef8cea7c90958470515d5b386c50bAndreas Kling
2023-05-24LibWeb: Resolve CSS variables if present in SVG presentation attributesAndreas Kling
SVG presentation attributes are parsed as CSS values, so we also need to handle CSS variable expansion when handling them. This (roughly) matches the behavior of other engines. It's also used on the web, for example on https://stripe.com/ :^)
2023-05-22LibWeb: Make sure collapsed margins are not ignored if box creates FCAliaksandr Kalenik
Fixes a bug that if box creates new formatting context then all already collapsed margins are ignored and only margin_top is used.
2023-05-22LibWeb: Propagate children_are_inline in wrap_in_anonymousAndi Gallo
This fixes a crash in box_baseline, due to cells created for display: table expecting a box child and getting the inline node wrapper instead. Fixes #18972.