Commit graph

331 commits

Author SHA1 Message Date
Ali Mohammad Pur e90752cc21 LibWeb: Add preliminary support for CSS animations
This partially implements CSS-Animations-1 (though there are references
to CSS-Animations-2).
Current limitations:
- Multi-selector keyframes are not supported.
- Most animation properties are ignored.
- Timing functions are not applied.
- Non-absolute values are not interpolated unless the target is also of
  the same non-absolute type (e.g. 10% -> 25%, but not 10% -> 20px).
- The JavaScript interface is left as an exercise for the next poor soul
  looking at this code.

With those said, this commit implements:
- Interpolation for most common types
- Proper keyframe resolution (including the synthetic from-keyframe
  containing the initial state)
- Properly driven animations, and proper style invalidation

Co-Authored-By: Andreas Kling <kling@serenityos.org>
2023-05-29 05:35:41 +02:00
MacDue ac104f7845 Base: Use fill-opacity and stroke-opacity in SVG example 2023-05-20 08:52:19 +02:00
MacDue 1d91a56242 Base: Use stop-opacity in SVG gradients example 2023-05-20 08:52:19 +02:00
Timothy Flynn 2b269cf425 Base: Add a test page to load a video element with <source> children
This verifies we cycle through the source children until we land on one
with a video we can play.
2023-05-13 15:51:44 +02:00
Andreas Kling 15211cd753 Userland: Show "Ladybird" instead of "Browser" in titles, menus, etc
While the binary is still called "Browser" for now, let's make it clear
that we're converging on a single name for this application.
2023-05-09 06:12:09 +02:00
MacDue 390ade3cf4 Base: Add some SVG <radialGradient> examples 2023-05-04 16:50:01 +02:00
MacDue 77a5f40736 Base: Fix incorrectly closed tag in welcome.html 2023-04-29 05:42:57 +02:00
MacDue 8ff6239d4f Base: Add SVG gradients test page 2023-04-28 09:42:28 +02:00
Jelle Raaijmakers 6601ff9d65 LibSQL: Redesign heap storage to support arbitrary amounts of data
Previously, `Heap` would store serialized data in blocks of 1024 bytes
regardless of the actual length. Data longer than 1024 bytes was
silently truncated causing database corruption.

This changes the heap storage to prefix every block with two new fields:
the total data size in bytes, and the next block to retrieve if the data
is longer than what can be stored inside a single block. By chaining
blocks together, we can store arbitrary amounts of data without needing
to change anything of the logic in the rest of LibSQL.

As part of these changes, the "free list" is also removed from the heap
awaiting an actual implementation: it was never used.

Note that this bumps the database version from 3 to 4, and as such
invalidates (deletes) any database opened with LibSQL that is not
version 4.
2023-04-23 18:08:17 -04:00
Timothy Flynn 59a1a3f463 Base: Add options to the video test page to change its attributes
This is to allow testing autoplay, poster images, etc. without having to
stash local changes to the page. This also changes the URLs used on the
page to be relative to the page itself, to allow the page to load both
on Serenity and Lagom.
2023-04-21 07:54:36 +02:00
Timothy Flynn 229cc67fee LibWeb: Implement HTMLMediaElement's autoplay attribute 2023-04-18 16:30:02 +02:00
MacDue 71ed1e3e50 Base: Add SVG preserveAspectRatio demo page 2023-04-17 07:32:31 +02:00
Srikavin Ramkumar 04198a29a8 Base: Fix typo in cursor test page 2023-04-14 09:57:49 +02:00
Sam Atkins d0f80b40b2 LibWeb: Reimplement CalculatedStyleValue as a calculation node tree
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.
2023-04-13 09:53:47 +02:00
MacDue 8aecd8c7ac Base: Add SVG transform test page 2023-04-12 07:40:22 +02:00
Timothy Flynn f109bb36a2 Base: Add the ended attribute to the video test page 2023-04-11 19:27:55 +02:00
Timothy Flynn 59848086ba Base: Add the current playback position to the video test page 2023-04-11 19:27:55 +02:00
MacDue 67aceb6c67 Base: Add canvas clip path test page 2023-04-09 18:42:45 +02:00
Timothy Flynn 90e1d4f545 Base: Add playback state data to the video test page 2023-04-08 22:04:14 +02:00
Timothy Flynn 60100c1389 Base: Add a simple test page to load a video and display some metadata 2023-04-07 16:02:22 +02:00
Kenneth Myhra c9ee1ad5ae LibWeb: Add multipart/form-data demo to formdata.html 2023-04-05 09:43:52 +01:00
MacDue 0abd469d24 Base: Add background-position-x/y test page 2023-04-03 07:10:33 +02:00
MacDue d38392d416 Base: Use radio button groups on accent-color demo page 2023-03-26 15:09:57 +02:00
MacDue bcfe275563 Base: Add two more radio buttons to HTML input test page
You can't really test radio buttons with just one button.
2023-03-26 15:09:57 +02:00
MacDue 5ba7449342 Base: Add radio buttons to the accent-color demo page 2023-03-24 09:57:48 +00:00
MacDue 4b3c38e111 Base: Add accent-color demo page
Currently this just has checkboxes, though I intend to add support
for more things later :^)
2023-03-23 08:27:51 +00:00
Tom 52e45fb6fa LibWeb+Base: Fix row-height bug in Grid when there is a column gap
This fixes a bug in the CSS Grid when there is a column and/or row gap,
as previously it would take the index of the incorrect column when
finding the `AvailableSize`.

There is a mild complication in the GridFormattingContext as the
OccupationGrid does not take into account the gap columns and rows that
later appear in the `Vector<TemporaryTrack>` columns and rows. The
PositionedBoxes are kind of a connection between the two, and so it's
now more explicit whether you would like to refer to a column by its
position taking into the gap columns/rows or not.
2023-03-10 18:20:27 +01:00
Kenneth Myhra beba05471c Base: Use string interpolation for all log outputs in formdata.html 2023-03-08 18:57:36 +00:00
Kenneth Myhra e5a396ce28 Base: Show of iterating over FormData.{keys(),values(),entries()} 2023-03-08 18:57:36 +00:00
Kenneth Myhra 2f20f16292 Base: Add a test using FormData and FormDataEvent 2023-02-12 00:18:09 +00:00
MacDue bcc4e5ee0b Base: Add a test page for canvas patterns 2023-02-03 20:36:21 +01:00
MacDue 8272cfc9f3 Base: Add a radial gradient with transparent end stops canvas demo 2023-01-23 10:03:54 +00:00
MacDue 9b35e3d95b Base: Add test page for canvas gradients 2023-01-22 18:15:52 +01:00
martinfalisse 173cc5e6e0 Base: Add tests for grid-template-areas and min/max-content 2023-01-21 14:35:00 +01:00
Liav A 71f275b5ad Tests/LibGfx: Add tests for compressed TGA images 2023-01-15 12:43:03 +01:00
Liav A 6bf2460231 Tests/LibGfx: Add tests for top-left and bottom-left TGA images 2023-01-15 12:43:03 +01:00
Sam Atkins 33b6ac0306 Base: Add some unlisted test pages to welcome.html 2023-01-05 18:54:33 +00:00
martinfalisse ba5e0607fd Base: Add test page for table 2023-01-03 20:02:47 +01:00
Aliaksandr Kalenik 8259ff12bd LibWeb: Margin bottom collapsing between parent and last child 2022-12-30 14:21:19 +01:00
Aliaksandr Kalenik 7088a87f49 LibWeb: Margin top collapsing between parent and first child
Implement collapsing of a box margin-top and first in-flow
child margin-top by saving function that updates y position
of containing block inside BlockMarginState and then for
every child until "non-collapsed through" child is reached
y position of containing block is updated by calling
update_box_waiting_fox_final_y_position_callback.
2022-12-30 14:21:19 +01:00
Tom bb062e50b0 LibWeb: Don't expand grid for {row,column} spans
Fixes a bug where when you had spans that that were bigger than the
grid, would create enough tracks to accomodate them. When a fixed
position is given, there should be at a minimum a row/column available
for the track. The span will be truncated if there is no space for it
later.
2022-12-28 15:04:58 +01:00
Tom 9d5049230c LibWeb: Clamp {row,column} spans if outside of grid
A bug was found where grid items were being drawn outside of the grid if
the item had a large span and the grid was defined as having gaps
between the rows/columns.

This was caused by an erroneous calculation of the
{row,column}_{start,span} properties.
2022-12-26 16:02:48 +01:00
MacDue cdf6e568f6 Base: Add some repeating-radial-gradient() HTML examples 2022-12-03 09:06:51 -05:00
Timothy Flynn 4a30446999 LibWeb: Support displaying HTMLInputElement placeholder values
This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
2022-12-01 11:18:11 -05:00
MacDue cdbb2cc917 Base: Add some radial-gradient() HTML examples 2022-11-30 14:24:04 +00:00
martinfalisse f351418a1e LibWeb: Include tests for grid track spans
Include tests for grid track spans when given for automatically-placed
grid tracks in the grid-*-end properties.
2022-11-29 19:27:31 +01:00
martinfalisse 0c577b4b3b Base: Add test for multiple line names in CSS Grid 2022-11-21 21:48:25 +00:00
Timothy Flynn 894bddf62c Base: Add a simple test page for window.prompt
The window prototypes alert, confirm, and prompt must "pause" execution
until a response is received from the user. This test page is meant to
ensure that a timeout queued before a prompt is not executed until after
that prompt is closed.
2022-11-16 17:23:56 +00:00
martinfalisse 70559e9d14 Base: Add test for grid-gap and auto-fit 2022-11-16 00:53:00 +01:00
MacDue d5cf403f70 Base: Add some repeating-conic-gradient() test cases 2022-11-07 13:13:22 +00:00
martinfalisse 0586730a92 Base: Add tests for grid gap 2022-11-07 10:06:07 +01:00
martinfalisse 13ac078202 Base: Add test for sizing children of grid 2022-11-06 13:23:33 +01:00
MacDue d66b219453 Base: Add some extra conic-gradient() test cases
This adds a test of a conic-gradient() with just a center position
and no starting angle.

This also adds a gradient that gives each quadrant a different color,
this is very sensitive to the center position being correct.
2022-11-06 01:42:55 +00:00
Andreas Kling 7809cc6557 LibWeb: Use preferred flex item sizes as min/max-content contribution
When a flex item has a specific preferred size, that size should be its
contribution to the containers intrinsic sizes.

This fixes an issue on Patreon where the logo would cover the entire
viewport since the SVG had a large intrinsic size but the flex item
containing it had a small specified size in CSS.
2022-11-05 11:42:19 +01:00
Timothy Flynn 9564f04fa6 Base: Add a disabled button to the button.html test page 2022-11-03 19:15:43 +00:00
MacDue d6334dcab1 Base: Add some conic-gradient() HTML examples 2022-11-01 23:07:05 +00:00
martinfalisse 937fcfc75c LibWeb+Base: Use line names for positioning grid items
When there are grid tracks with line names, use these to resolve
line-names passed to positioned grid items.
2022-11-01 11:19:41 +01:00
Smrtnyk ae950816b5 Base: Add SameSite cookie test cases 2022-10-22 18:17:01 +02:00
martinfalisse 8653903bee Base: Update display grid test page
Update the tests after adding minmax(), auto-fill and auto-fit
functionality to the LibWeb implementation of the CSS Grid.
2022-10-15 16:04:01 +02:00
Pavel db23e2d546 Base: Add test page for exceptions
Created a simple page where you can check
that the exceptions appear in the JS console.
2022-10-15 01:25:12 +02:00
martinfalisse f538dc2fae LibWeb+Base: Add grid repeat() functionality
Add ability to use values passed to grid-template-columns and
grid-template-rows for CSS Grid layout within a repeat() function.

E.g. grid-template-columns: repeat(2, 50px); means to have two columns
of 50px width each.
2022-10-09 12:40:18 +01:00
martinfalisse e537035cc6 LibWeb+Base: Deal with column-spans greater than implicit grid
When the indicated column-span is greater than the implicit grid (like
in cases when the grid has the default size of 1x1, and the column is
supposed to span any number greater than that), then previously were
crashing.
2022-10-08 17:26:41 +02:00
MacDue 5a832c0326 Base: Add example backdrop-filter using saturate() 2022-10-07 13:08:24 +01:00
martinfalisse 84290ed7c8 Base+LibWeb: Make sure grid positions don't cause out of bounds
Add some tests to the test page to make sure that different combinations
of GridTrackPlacement don't cause out of bounds issues.
2022-10-06 21:16:01 +02:00
martinfalisse 56f50c9cde Base+LibWeb: Deal with zero-positioned grid items
If a grid item has as its position value a 0 then it should be
invalidated.
2022-10-06 21:16:01 +02:00
martinfalisse 9051a56554 Base+LibWeb: Stub out negative spans
Ensure that when a grid item is passed with a span and a fixed end
position, that if the resulting start of this item is less than 0 then
it won't throw. This is a temporary measure until the correct
functionality is implemented.
2022-10-06 21:16:01 +02:00
martinfalisse 236795e931 LibWeb+Base: Re-implement grid track span
Implement span correctly when indicated in the grid-column-start,
grid-row-start, etc. CSS properties. Previously it had been implemented
as if span was something that went alongside the position property, but
actually it seems like if you do 'span 3' in the grid-column-start
property, for example, this means it literally spans 3 blocks, and the
3 has nothing to do with position.
2022-10-06 21:16:01 +02:00
MacDue 2a9128efe3 Base: Add example backdrop-filter using hue-rotate() 2022-10-02 21:17:41 +02:00
Luke Wilde 082abf9998 Base: Add rotateX, rotateY, rotateZ and matrix3d examples for transform 2022-10-01 14:07:47 +02:00
MacDue c0eda77928 Base: Add paint effects with opacity/transforms HTML test cases 2022-09-25 18:37:31 +02:00
Andreas Kling d43ef27761 LibWeb: Only include containing blocks in coordinate space translation
Layout box offset coordinates are always relative to their containing
block. Therefore, the functions that convert between coordinate spaces
should only visit containing blocks and apply their offsets, not *every*
box in the parent chain.

This fixes an issue where some floating boxes were unexpectedly far away
from their containing block.
2022-09-22 16:54:12 +02:00
Andreas Kling 389f47f6fe LibWeb: Check both top and bottom of float position when looking for fit
We have to check that there's enough space at both the top and bottom of
the float's margin box, otherwise we risk overlapping existing content.
2022-09-22 16:54:12 +02:00
davidot 4912b22e3b LibWeb+WebContent: Setup the js console client earlier
This allows us to print messages in inline scripts. Also add an example
of this in the welcome page to test this.
2022-09-21 17:34:32 +01:00
Jan Metzger 931458c337 LibWeb: Update visibility when Node was invisible before 2022-09-21 10:47:41 +01:00
Andreas Kling 412b2313f3 LibWeb: Improve inline flow around floating boxes
This patch combines a number of techniques to make inline content flow
more correctly around floats:

- During inline layout, BFC now lets LineBuilder decide the Y coordinate
  when inserting a new float. LineBuilder has more information about the
  currently accumulated line, and can make better breaking decisions.

- When inserting a float on one side, and the top of the newly inserted
  float is below the bottommost float on the opposite side, we now reset
  the opposite side back to the start of that edge. This improves
  breaking behavior between opposite-side floats.

- After inserting a float during inline layout, we now recalculate the
  available space on the line, but don't adjust X offsets of already
  existing fragments. This is handled by update_last_line() anyway,
  so it was pointless busywork.

- When measuring whether a line can fit at a given Y coordinate, we now
  consider both the top and bottom Y values of the line. This fixes an
  issue where the bottom part of a line would bleed over other content
  (since we had only checked that the top Y coordinate of that line
  would fit.)

There are some pretty brain-dead algorithms in here that we need to make
smarter, but I didn't want to complicate this any further so I've left
FIXMEs about them instead.
2022-09-16 15:15:50 +02:00
MacDue cfa9b44894 Base: Add a backdrop-filter demo web page 2022-09-16 10:50:48 +01:00
electrikmilk b0f9ad0000 Base: Add existing @font-face test to welcome page
This adds the existing `@font-face` test page to the welcome page.
2022-09-14 10:50:33 +01:00
Brian Gianforcaro d0a1775369 Everywhere: Fix a variety of typos
Spelling fixes found by `codespell`.
2022-09-14 04:46:49 +00:00
martinfalisse ca3d479f6f Base: Add more tests for display: grid 2022-09-14 00:09:14 +02:00
Andreas Kling 514fa83708 LibWeb: Improve float: right behavior
- Use the border box of the floated element when testing if something
  needs to flow around it.
- Take the floated element's containing block size into account (instead
  of the BFC root) when calculating available space on a line where a
  right-side float intrudes.
2022-09-07 17:47:33 +02:00
davidot ba5bcb67a5 LibWeb: Implement the HostEnsureCanAddPrivateElement JS hook
Also added a local test for ensuring this behavior since it is unique to
browsers. Since we don't actually use WindowProxy anywhere yet we just
test on location for now.
2022-08-27 20:33:27 +01:00
martinfalisse a7f5b6b15b Base: Add display grid test page 2022-08-25 13:47:48 +02:00
MacDue be9d3f9aa4 Base: Add an example linear-gradient with double-position color stops 2022-08-23 01:02:49 +02:00
MacDue d26203ff90 Base: Add some repeating-linear-gradient() examples 2022-08-18 15:58:05 +02:00
Sam Atkins 9075dea3a8 Base: Add a test page for Path2D
Neither of the tests here actually passes properly right now. It's a
little more aspirational...

In the first one, the circle draws in the wrong place due apparently to
existing bugs in `CanvasRenderingContext2D::ellipse()`.

In the second, I just haven't yet implemented creating a Path2D from an
SVG path string, because that's going to take a fair bit of untangling
first.
2022-08-14 11:30:40 +02:00
martinfalisse eef0edae7a Base: Clean up Clip test page after absolutely positioned divs fix
Clean up the Clip test page after adding the logic necessary so that
absolutely positioned divs are correctly positioned.
2022-08-14 11:22:52 +02:00
MacDue c5d1cf7a5a Base: Add some more linear-gradient() transition hint demos
This adds a demo of making a 'rainbow' with hard edges using
transition hints, along with an animated demo of moving the
transition hint.
2022-08-12 12:24:15 +02:00
MacDue 4f83b70c7f Base: Remove modifications from fancy progress bar demo
This restores the demo to being the same as on css-tricks.com.
2022-08-12 12:24:15 +02:00
MacDue 613feb1854 Base: Replace linear-gradient() pattern demo with cooler one
The previous demo didn't work that well, not due to any LibWeb
issue (same in other browsers), it just was a broken demo.

This demo shows the neat tricks you can do with linear-gradient()s
much better.
2022-08-08 21:56:08 -04:00
MacDue ff6f56ef7a Base: Add linear-gradient + background-size demo 2022-08-08 22:39:06 +02:00
MacDue 4b9c0aac7a Base: Add linear-gradient list-marker demo 2022-08-08 22:39:06 +02:00
MacDue da79883b60 Base: Add the styled progress bar demo from css-tricks.com
See: https://css-tricks.com/html5-progress-element/ this is a neat
demo of a pure CSS progress bar that makes use of linear-gradients,
background-repeat, and background-size. All of which now work :^)
2022-08-08 22:39:06 +02:00
Tom 4d1ceaaa43 Base: Add test page for CSS clip property 2022-08-07 22:40:11 +02:00
MacDue 6dd854faec Base: Add an example -webkit-linear-gradient() 2022-08-07 20:47:31 +02:00
MacDue 43ebe5ca75 Base: Add some more border-radius test cases
* A border-radius + a border on a <img> tag
   - The border-radius on the <img> should shrink to line up with
     the border.
* A border-radius + a border on a div with overflow: hidden
   - The clipping border-radius should shrink (same as the image).
2022-07-26 23:56:29 +01:00
MacDue a75d5e1b77 Base: Remove some unnecessary styling from progressbar.html
The button color here now just creates issues on dark themes,
and the margin on the progress bar does nothing.
2022-07-24 13:31:01 +01:00
MacDue bc29161bac Base: Add some more progress bar demos
This adds an example of a progress bar with just `appearance none`,
and one with `appearance none` and some custom styling.
2022-07-23 01:45:49 +02:00
MacDue c12c9eed38 Base: Add some more border-radius test cases
This adds a test for overflow: hidden + border-radius clipping
child positioned elements, and child backgrounds.
2022-07-19 15:00:59 +02:00
MacDue 4978f388c2 Base: Add some more fun gradient demos
Adds tests for:
- Multi-stop gradient at arbitrary angles (CPU brr)
- Default/calculated color stops
- to <corner>
- Pre-multiplied alpha mixing
2022-07-18 10:10:22 +01:00
MacDue 452dc544bc Base: Add simple gradients test page 2022-07-17 20:11:38 +01:00