Commit Graph

28481 Commits

Author SHA1 Message Date
Andrew Kaster
2a24dda44d LibWeb: Implement NavigateEvent AOs that are called during event firing
The potentially scroll/focus and finish AOs are called by the inner
navigate event firing algorithm. Implement them beforehand to make the
diff look pretty :^).
2023-09-23 18:57:31 +02:00
Andrew Kaster
e05a6f6aa2 LibWeb: Add getter to NavigationDestination to get its URL as an AK::URL
Other parts of LibWeb are going to want to mess with the URL object, not
its serialzied representation. So let's add a backdoor getter.
2023-09-23 18:57:31 +02:00
Andrew Kaster
a5e05c5082 LibWeb/WebIDL: Implement the wait for all AO
This abstract operation takes a list of IDL promises and chains them
together with .then() until all are completed or rejected.
2023-09-23 18:57:31 +02:00
Andrew Kaster
b07badb832 LibWeb: Make the can have its url rewritten AO publicly accessible
We'll need this from the Navigation API
2023-09-23 18:57:31 +02:00
Sam Atkins
f98659dd76 LibWeb: Remove UA style sheet rules from <symbol> presentational hints 2023-09-23 16:27:14 +02:00
Sam Atkins
ae4b8d86df LibWeb: Include standard SVG user agent style sheet
For now, part of this is commented-out. Our current implementations of
`<mask>` and `<symbol>` rely on creating layout nodes, so they can't be
`display: none`.
2023-09-23 16:27:14 +02:00
Andreas Kling
a6131634f1 LibWeb: Add fast_is<T>() for HTMLSlotElement
2.4x speed-up on StyleBench :^)
2023-09-23 13:04:38 +02:00
Shannon Booth
07b332e17c LibWeb: Add IDL definition for SVGScriptElement
It does not currently handle any of the actual scripting, but this
should at least allow us to create an instance of the element.

The test being added here isn't actually testing much, but before the
previous commit we used to crash parsing the page due to a TODO().
2023-09-23 11:41:57 +02:00
Shannon Booth
60c32f39a1 LibWeb: Do not crash when parsing a SVG script element
Just leave a FIXME dbgln message instead. This works around a crash seen
in html5test.com.
2023-09-23 11:41:57 +02:00
Shannon Booth
6de9d2820f LibWeb: Add spec comments to 'process the rules for foreign content' 2023-09-23 11:41:57 +02:00
Andrew Kaster
5949e3c3e8 LibWeb: Implement named property access AOs on Window
These allow accessing embeds, forms, images and objects with a given
name attribute, and any element with a given id attribute, as top level
properties on the global object.

It also allows accessing NavigableContainers by target name as top level
properties on the global object.

The current implementation feels very expensive. It's likely that
these values will need smarter caching in the future.
2023-09-22 19:55:59 -06:00
Andrew Kaster
247f12d7b0 LibWeb: Insert WindowProperties object into Window's prototype chain
And implement WindowProperties, the "named properties object" for Window
according to the spec.

This involves moving an AO out of LegacyPlatformObject and into a common
place that the WindowProperties class can access.

This doesn't implement the AOs on Window that actually name lookup for
the unenumerable named properties on the window yet, just the
scaffolding.
2023-09-22 19:55:59 -06:00
Andrew Kaster
64899dba44 LibWeb: Implement document-tree child navigable target name property set
This AO allows accessing child navigables by their name as named
properties on the WindowProxy object.
2023-09-22 19:55:59 -06:00
Andrew Kaster
7e277797ad LibWeb: Add about base url to the various AOs that construct documents
And some assorted cleanup along the way. The browsing context and
document AOs in particular need re-alignment with the spec.
2023-09-22 19:45:11 -06:00
Andrew Kaster
dc0f7c4c54 LibWeb: Align NavigationParams and the creation AOs to the spec
And remove assorted spec FIXMEs along the way. Also align
populate_session_history_entry_document to the spec, with a bonus spec
bug to be filed.

This involves creating a new NonFetchSchemeNavigationParams spec, and
having the associated AOs take a Variant rather than Optional to
accomodate the fact that this extra struct could be returned by the
algorithm. We don't actually *do* anything with these params, but the
scaffolding is there now, with less TODOs.
2023-09-22 19:45:11 -06:00
Andrew Kaster
f296382e1a LibWeb: Implement inform the navigation api about aborting navigation
This also requires implementing the abort the ongoing navigation AO on
Navigation, which will be used from other NavigateEvent AOs.
2023-09-22 19:45:11 -06:00
Andrew Kaster
25ffe6becb LibWeb: Correct spelling of UserNavigationTiming enum
With luck we can Naviagate these typo-filled waters.
2023-09-22 19:45:11 -06:00
Aliaksandr Kalenik
06d05b3c55 LibWeb: Boxes that establish FFC or GFC should avoid overlapping floats
Before, we only ensured that boxes establishing BFC did not overlap
with floats because that is what CSS 2.2 specification says. However,
we should also apply the same for boxes establishing FFC or GFC as this
aligns with the behavior of other browsers.

Fixes https://github.com/SerenityOS/serenity/issues/21095
2023-09-22 16:48:28 +02:00
Andreas Kling
3d5cd23393 LibJS: Remove unused Instruction::is_terminator() 2023-09-21 16:19:13 +02:00
Andreas Kling
3ccac0cf6e LibJS: Remove unused realm parameter from run_and_return_frame() 2023-09-21 16:19:13 +02:00
Andreas Kling
d6e959686d LibJS: Remove automatic ExecutionContext creation in BC interpreter
This was a remnant from the AST/BC hybrid interpreter times. We've had
a VERIFY in here for weeks now that would catch anything depending on
this behavior, and nothing has hit it, so let's remove the unnecessary
code (but leave the VERIFY) :^)
2023-09-21 16:19:13 +02:00
Shannon Booth
30ab198b40 LibJS: Create const variables in ForIn/OfBodyEvaluation in strict mode
Our implementation of environment.CreateImmutableBinding(name, true)
in this AO was not correctly initializing const variables in strict
mode. This would mean that constant declarations in for loop bodies
would not throw if they were modified.

To fix this, add a new parameter to CreateVariable to set strict mode.
Also remove the vm.is_strict mode check here, as it doesn't look like
anywhere in the spec will change strict mode depending on whether the
script itself is running in script mode or not.

This fixes two of our test-js tests, no change to test262.
2023-09-21 16:19:05 +02:00
Shannon Booth
e67dd54878 LibJS: Add spec comments to ScopeNode::block_declaration_instantiation 2023-09-21 16:19:05 +02:00
Tim Ledbetter
3aa49f268c Userland: Make Window::set_main_widget() non-fallible 2023-09-21 10:20:23 +02:00
Liav A
c9297126db SystemServer: Use correct unix device numbers for null, full and random
This fixes regression made in 446200d6f3
2023-09-20 13:27:09 -06:00
Sam Atkins
0634d11318 LibWeb: Stop adding extra whitespace when serializing CSS Functions
Otherwise `attr(|name, "fallback")` becomes `attr(| name ,  "fallback")`

The test here is slightly aspirational. There are other rules for
serialization we don't follow (like stripping whitespace entirely from
many places) so these are marked with FIXMEs.
2023-09-20 18:29:37 +02:00
Andreas Kling
f31b39ca18 LibWeb: Remove unused BrowsingContext::for_each_child() 2023-09-20 18:29:17 +02:00
Andreas Kling
413cc1774e LibWeb: Remove unused BrowsingContext::scroll_offset_did_change() 2023-09-20 18:29:17 +02:00
Andreas Kling
93e4a0de16 LibWeb: Move has_a_rendering_opportunity() to Navigable 2023-09-20 18:29:17 +02:00
Andreas Kling
a02d42dea2 LibWeb: Remove two unused BrowsingContext member variables 2023-09-20 18:29:17 +02:00
Andreas Kling
8e669c14c8 LibWeb: Remove unused BrowsingContext::document_family*() 2023-09-20 18:29:17 +02:00
Andreas Kling
38cb15ff49 LibWeb: Move system visibility state to TraversableNavigable
This no longer belongs in BrowsingContext.
2023-09-20 18:29:17 +02:00
Andreas Kling
046ae7fe86 LibWeb: Remove unused BrowsingContext::scroll_to_anchor() 2023-09-20 18:29:17 +02:00
Andreas Kling
94236c2532 LibWeb: Remove unused "frame nesting" tracking from BrowsingContext 2023-09-20 18:29:17 +02:00
Andreas Kling
51caa14381 LibWeb: Remove FrameLoader
This class is no longer used, now that we've moved to navigables.
2023-09-20 18:29:17 +02:00
Aliaksandr Kalenik
693d602b2f LibWeb: Fix infinite loop in GFC growth limit distribution
This change is bd85e1b30b ported from
base size to growth limit distribution.

Fixes https://github.com/SerenityOS/serenity/issues/21056
2023-09-20 18:28:11 +02:00
Sam Atkins
9b4ddff6a9 LibWeb: Replace FontStyleValue with ShorthandStyleValue
Also, actually include font-variant since we were already parsing it but
throwing it away.
2023-09-20 12:17:16 +01:00
Sam Atkins
34591549b1 LibWeb: Replace BorderRadiusShorthandStyleValue with ShorthandStyleValue 2023-09-20 12:17:16 +01:00
Sam Atkins
34e0899ab0 LibWeb: Replace BackgroundStyleValue with ShorthandStyleValue
The `to_string()` for this is modified a little from the original,
because we have to calculate what the layer-count is then, instead of
having it already calculated.
2023-09-20 12:17:16 +01:00
Sam Atkins
1ae515c0b7 LibWeb: Replace FlexFlowStyleValue with ShorthandStyleValue 2023-09-20 12:17:16 +01:00
Sam Atkins
aa45b3dfe3 LibWeb: Replace FlexStyleValue with ShorthandStyleValue
We still need the custom parsing and to_string() logic, but nothing
else. :^)
2023-09-20 12:17:16 +01:00
Sam Atkins
a72788b889 LibWeb: Return after expanding ShorthandStyleValues
We don't want to carry on doing things after we've handled these.
2023-09-20 12:17:16 +01:00
Sam Atkins
d20254f1bc LibWeb: Rename CompositeStyleValue -> ShorthandStyleValue
It's a shorthand, so let's call it that. :^)
2023-09-20 12:17:16 +01:00
Aliaksandr Kalenik
4ff4ac11b9 LibJS: Remove alreadyDeclared check in FunctionDeclarationInstantiation
We don't need to check if a function parameter is already declared
while creating bindings for them because we deduplicate their names by
storing them in a hash table in one of the previous steps.

This change makes React-Redux-TodoMVC test in Speedometer run 2%
faster.
2023-09-19 16:58:25 +02:00
Shannon Booth
b603e860af LibWeb: Port CharacterData from DeprecatedString to String
The existing implementation has some pre-existing issues where it is
incorrectly assumes that byte offsets are given through the IDL instead
of UTF-16 code units. While making these changes, leave some FIXMEs for
that.
2023-09-19 10:54:07 +02:00
Shannon Booth
3b12a13f17 LibWeb: Add String variants of functions in ChildNode
This is required in porting over CharacterData from DeprecatedString to
String.

Unfortunately, as with ParentNode, we cannot yet remove the
DeprecatedString variants of these functions as the Element interface
includes ChildNode and has not yet been ported over from
DeprecatedString.
2023-09-19 10:54:07 +02:00
MacDue
909bcfe9a4 LibWeb: Resolve and paint simple SVG masks
This allows applying SVG <mask>s to elements. It is only implemented for
the simplest (and default) case:

	- mask-type = luminance
 	- maskContentUnits = maskContentUnits
 	- maskUnits = objectBoundingBox
	- Default masking area

It should be possible to extend to cover more cases. Though the layout
for maskContentUnits = objectBoundingBox will be tricky to figure out.
2023-09-19 10:46:05 +02:00
MacDue
650180811e LibWeb: Flesh out SVGMaskElement a bit
- Add method to resolve the masking area (based on the target element
  size)
- Parse the maskUnits and maskContentUnits attributes
2023-09-19 10:46:05 +02:00
MacDue
0af8d81f48 LibWeb: Layout SVG <mask> elements (but don't paint them)
This allows SVG mask elements to have layout computed, but not connected
to the main paint tree. They should only be reachable if (and painted)
if referenced by the "mask" attribute of another element.

This is controlled by the forms_unconnected_subtree() function on the
paintable, which (if it returns true) prevents the paintable from being
added as a child to what would be its parent.
2023-09-19 10:46:05 +02:00
MacDue
c5b50ec2f4 LibWeb: Create paintables for nodes whose parents don't have paintables
A Paintable is not created for an SVG <defs> element (nor should it),
but it can contain SVG <mask> elements that need a paintable.

This change forces those paintables to be created (without a parent).
The masks are then only painted by being referenced from another
element.
2023-09-19 10:46:05 +02:00