Commit graph

34282 commits

Author SHA1 Message Date
Andrew Kaster 5d0488ce6f LibWeb: Add closing flag to WorkerGlobalScope
Also implement close a worker AO.

(cherry picked from commit f99c7ad85d150bbe3372edad1a7634263e804eb1)
2024-07-22 21:29:21 -04:00
Andrew Kaster 446f04b575 LibWeb+WebWorker: Add IPC messages to request and communicate shutdown
(cherry picked from commit 27ef9ffa8f76b9bb38bc30ce05a1fdc19b849d91)
2024-07-22 21:29:21 -04:00
Andrew Kaster f2e3d117a2 LibWeb: Initialize HTML::EventLoop with its type
(cherry picked from commit 5d8784318d8240413e555bf2e55bc00d95ea0749)
2024-07-22 21:29:21 -04:00
Edwin Hoksberg fd55229c0e LibWeb: Support percentage values in SVG line element
(cherry picked from commit ac6126e263964a7695167c0ee6a74453957d4c5c)
2024-07-22 19:05:02 -04:00
Edwin Hoksberg 097a50141f LibWeb: Support percentage values in SVG text positioning element
(cherry picked from commit 356bddbdbb774cf86dd77d2a54a6fddccf82767e)
2024-07-22 19:05:02 -04:00
mobounya f820114bc6 LibWeb: Update update_for_history_step_application
Update 'update_for_history_step_application' to meet some of the specs
introduced in https://github.com/whatwg/html/pull/9856 and in
https://github.com/whatwg/html/pull/9990

(cherry picked from commit 2497f43989af3efa695d0d33de59001cb87bacb6)
2024-07-22 18:58:29 -04:00
Tim Ledbetter 098a2ad2e9 LibWeb/SVG: Ensure SVG transform has an inverse before using it
This avoids a crash that occurred when calling `getBBox()` on an SVG
element that had a transform with no inverse.

Found by Domato.

(cherry picked from commit d417b7568360f20487e4182e52872b82c8fbbf60)
2024-07-22 18:27:26 -04:00
Tim Ledbetter 9b524d043f LibWeb: Don't crash when SVG viewbox has a width of 0
Previously, `SVGSVGBox` would have a natural aspect ratio of 0 if it
had a viewbox with zero width. This led to a division by zero, causing
a crash.

Found by Domato.

(cherry picked from commit 4cdafea36334bcff8c4bbb083076ae55b599177c)
2024-07-22 18:27:26 -04:00
Tim Ledbetter 949ca71b31 LibWeb: Clamp paintable box maximum scroll offset to 0
Previously calling `PaintableBox::set_scroll_offset()` with a
PaintableBox whose content size was larger than its scrollble overflow
rect would cause a crash.

Found by Domato.

(cherry picked from commit 604f6040a180ac409cf338045c8709a171d920d5)
2024-07-22 18:27:26 -04:00
circl 78a22f5098 LibWeb: Replace templated retarget function with a regular one
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
The templating is not necessary anywhere and was effectively just a cast

(cherry picked from commit 37f93e4be13890c88f2a34a2669b41297fafa1c8)
2024-07-22 12:42:17 -04:00
Daniel Bertalan a06c27c5b7 LibWeb/DOM: Work around GCC 14 warning on always true is<T>()
GCC 14 emits a warning when an always succeeding `dynamic_cast`'s return
value is compared to NULL inside the `AK::is<T>(U)` template when `T` ==
`U`.

While warning on tautological `is` calls seems useful, it's a bit
awkward when it comes from a function template where the cast may fail
in some instantiation. There is a GCC bug open for it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664

Work around the warning by performing the algorithm on the base type
(`EventTarget`), with a wrapper that casts it to the more specialized
input type.

(cherry picked from commit 31eb0ed938dff11dee7391a4f616f4132aa250c0)
2024-07-22 12:42:17 -04:00
circl e85f10a380 LibWeb: Set document.activeElement using the spec algorithm
(cherry picked from commit 8357f18e9b9920e26fbb563dfa634bd269519171)
2024-07-22 12:42:17 -04:00
circl fec428b988 LibWeb: Move retarget function to its own file
(cherry picked from commit 1aa928210395ba157c868fa303ae531a8ee2d6d8)
2024-07-22 12:42:17 -04:00
Jamie Mansfield 33a8d6c010 LibWeb/HTML: Stub History.scrollRestoration
(cherry picked from commit e4e64c15aa1027754a4ed47504e2ba42d262e927)
2024-07-22 12:23:12 -04:00
Jamie Mansfield 924ff79fdc LibWeb/HTML: Stub HTMLImageElement.{x,y}
(cherry picked from commit 9eede09c3c228da193e015dbaf95f784e9c96b92)
2024-07-22 12:23:12 -04:00
Jamie Mansfield 2692950741 LibWeb/SVG: Stub missing SVGLength attributes
setraises is no longer used by the spec, so I've removed that FIXME :^)

(cherry picked from commit e1317915f476193ad1211e31d2b1d2ece06cd82f)
2024-07-22 12:23:12 -04:00
Jamie Mansfield b5b941d895 LibWeb/SVG: SVGSymbolElement includes SVGFitToViewBox
(cherry picked from commit 6c7089fc9e522b89c9479c618e94c3d43627e22a)
2024-07-22 12:23:12 -04:00
MacDue 423e682323 CatDog: Avoid quickly switching between wake and sleep 2024-07-22 11:50:45 -04:00
MacDue 39b0c8a129 CatDog: Update wake/sleep action text on state change 2024-07-22 11:50:45 -04:00
MacDue edd5f9f6cc CatDog: Fix sleeping animation not playing
Previously, you'd see one frame of the sleeping animation, and then it
would stop. This was because Frame2 = 0x1 and Frame1 = 0x0, so once the
Frame2 bit was set, or-ing with Frame1 would not unset it. Since the
current frame was already tracked separately to the state, we can avoid
setting it in the state, and instead only use it when we fetch the
bitmap, preventing this issue.
2024-07-22 11:50:45 -04:00
Tim Ledbetter 1146284d86 LibWeb: Implement Node.isDefaultNamespace()
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
This method accepts a namespace URI as an argument and returns true if
the given URI is the default namespace on the given node, false
otherwise.

(cherry picked from commit 055c902a375bb34b8c0e31f015c2815fe935c6a9)
2024-07-21 16:55:51 -04:00
Tim Ledbetter e81cb6d41d LibWeb: Implement Node.lookupNamespaceURI()
This method takes a prefix and returns the namespace URI associated
with it on the given node, or null if no namespace is found.

(cherry picked from commit 27d429a85f359b9c87bf9807e4dea33f7092308a)
2024-07-21 16:55:51 -04:00
Jamie Mansfield c266e83c78 LibWeb/SVG: SVGGradientElement includes SVGURIReference
(cherry picked from commit c8e6a95988e39c5afe15191c904a1bfa82974945)
2024-07-21 16:55:11 -04:00
Jamie Mansfield be8a46f0b8 LibWeb/SVG: SVGScriptElement includes SVGURIReference
(cherry picked from commit fbb5bc471d90d2d0880dcba9aeb3574009ff2100)
2024-07-21 16:55:11 -04:00
Jamie Mansfield 38fb02cf4d LibWeb/SVG: SVGAElement includes SVGURIReference
(cherry picked from commit 796de74956b6d2689fb5a48280b7465d60560495)
2024-07-21 16:55:11 -04:00
Jamie Mansfield 2ad1fa17fb LibWeb/SVG: Implement SVGAElement.relList
(cherry picked from commit 6ca4c2beb08a81bc4aaa2571ee8c5b3207d0b3a2)
2024-07-21 16:55:11 -04:00
Jamie Mansfield 3ffd1e7ee7 LibWeb/SVG: Implement reflected attributes in SVGAElement
This change implements the download, ping, rel, hreflang, and type
attributes using the [Reflect] annotation in the IDL file.

(cherry picked from commit 7562f89d4e2b0dd22430962e102a2195186f8458)
2024-07-21 16:55:11 -04:00
Jamie Mansfield 6bdf8a97c8 LibWeb/SVG: Add spec link to SVGAElement
(cherry picked from commit 5bac8e77304528d6752a9550c3d104ea31c34419)
2024-07-21 16:55:11 -04:00
Jamie Mansfield 40eaf964d2 LibWeb/SVG: Implement SVGElement.ownerSVGElement
(cherry picked from commit 6f3c5f5ae9f0ee055c44ace5efab0c443626bb5d)
2024-07-21 16:55:11 -04:00
mobounya 219c40a4ba LibWeb: Conform HTTP-network-or-cache to specs
Implement step 8.10 in '4.5. HTTP-network-or-cache fetch' from the
fetch specs.

(cherry picked from commit 9c93630d02c5e86130bfb45f9d94ba6e5c6c3ba5)
2024-07-21 16:54:54 -04:00
mobounya 1146868f6d LibWeb: Add fetch group from the fetch spec
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.

(cherry picked from commit 9e223f6daeb3969d3997084a973b26daff6b4f7e)
2024-07-21 16:54:54 -04:00
mobounya e4fa0e7f63 LibWeb: Implement fetch record from the fetch spec
Implement fetch record concept from the '2.4. Fetch groups' in
the fetch specs.

(cherry picked from commit 8d38a1326e5a3cfe4ebbb0bf3d12c8307a6fbb3c)
2024-07-21 16:54:54 -04:00
Tim Ledbetter eb3c4f2caa LibWeb: Expose ChildNode methods on the DocumentType IDL interface
(cherry picked from commit bd72ff566959d8a3fc77e9b5f6b47d475453e3e8)
2024-07-21 16:54:29 -04:00
Tim Ledbetter a5d05b4925 LibWeb: Compare node names case insensitively in Node::is_equal_node()
(cherry picked from commit 5a578e8f152c1183b96e3f5c9d9b389f4f22235a)
2024-07-21 16:54:29 -04:00
Tim Ledbetter 21760cbffe LibWeb: Don't consider nodes in different namespaces to be equal
Previously, `Node::is_equal_node()` would return true for nodes in
different namespaces that were otherwise equal.

(cherry picked from commit 7ab7be694d1232f4cdc108a2adc88812fc0a9ca9)
2024-07-21 16:54:29 -04:00
Tim Ledbetter 75d1715f29 LibWeb: Fire a change event on mouseup of number input buttons
This matches the behavior of other browsers.

(cherry picked from commit e9e195418ef32e73e7c7beb97f4653e5868ee4ef)
2024-07-21 16:54:15 -04:00
Tim Ledbetter d91ea8ceb8 LibWeb: Update number input on mousedown of number input buttons
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.

(cherry picked from commit b4b947c60797328d930c8d3de466b8ef292d0ed4)
2024-07-21 16:54:15 -04:00
Tim Ledbetter c9b06f3a90 LibWeb: Fire input event on user interaction with input element buttons
An input event is now fired when the step up or step down button of an
input element of type number is clicked.

This ensures that any associated <output> element is updated when these
buttons are clicked.

(cherry picked from commit 2a980816e756d727261d53450b4b3f48069d5d50)
2024-07-21 16:54:15 -04:00
Tim Ledbetter c219ebc0db LibWeb: Deduplicate the firing of input events in HTMLInputElement
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.

(cherry picked from commit a3d12e569c88d0dae530657e5bddc18699fb9c9b)
2024-07-21 16:54:15 -04:00
Timothy Flynn 582305fdc3 LibJS: Implement Iterator.prototype.constructor according to spec
The spec allows setting a constructor on non built-in Iterator objects.

This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501

(cherry picked from commit fb228a3d850eb5e4b06550823755719a377b41e6)
2024-07-21 14:54:16 -04:00
Timothy Flynn 978d3331fa LibJS: Implement Iterator.prototype [ @@toStringTag ] according to spec
The spec allows setting the prototype on non built-in Iterator objects.

This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501

(cherry picked from commit 734e37442db4419b58228e25702bfe176e52f5e3)
2024-07-21 14:54:16 -04:00
Holger Hans Peter Freyther fbf44c1dca LibWeb: Fix assertion failure on telekom.de
The EntryType has three possible values: Fetching, Failed or
ModuleScript. It is possible that we transition from Fetching to Failed
as in #13.1. Change the assertion to include the failed scenario.

Fixes: https://github.com/LadybirdBrowser/ladybird/issues/661
(cherry picked from commit 319bb6353e0ba64fc5e54b32ddb2b38736cedef9)
2024-07-21 14:21:11 -04:00
Jamie Mansfield 6f58a3ee33 LibWeb: Stub Text.wholeText
(cherry picked from commit 0961d68ebc23185836562c5e1f954c47da213922)
2024-07-21 14:19:52 -04:00
Jamie Mansfield 63cac3088a LibWeb: Implement MouseEvent.initMouseEvent
(cherry picked from commit 807e63faaf6d9cb30ac01514309e532eb3742e96)
2024-07-21 14:19:52 -04:00
Jamie Mansfield 5ed5460553 LibWeb: Implement KeyboardEvent.initKeyboardEvent
(cherry picked from commit 3845d174e313d404c7b59b7d71637873712d4ee1)
2024-07-21 14:19:52 -04:00
Jamie Mansfield 5478695eee LibWeb: Short-circuit UIEvent.initMouseEvent if dispatched
This fixes some bugs on wpt.dom/events/Event-init-while-dispatching.html,
although the test still fails due to [GH-23722].

[GH-23722]: https://github.com/SerenityOS/serenity/issues/23722

(cherry picked from commit aefab1de38948b0d86a6aed33647e995340859e2)
2024-07-21 14:19:52 -04:00
Jamie Mansfield e8688eed3e LibWeb/HTML: Remove FIXMEs from HTMLTrackElement constants
(cherry picked from commit 87880e9b81a2dde1d0ea46c2d43877e502fd0ea0)
2024-07-21 14:19:52 -04:00
Jamie Mansfield 737e6215b6 LibWeb: Implement Performance.toJSON
(cherry picked from commit 66c3388b16f9ba325221572a0395b9be3a08ba0e)
2024-07-21 14:19:52 -04:00
Jamie Mansfield 750161723e LibWeb/DOM: Add FIXMEs for missing functions in Node
(cherry picked from commit 116c1f835df5ace3cedfb5c092d3f77c8db6df0e)
2024-07-21 14:19:52 -04:00
Jamie Mansfield ba2dedd160 LibWeb/DOM: Match order of Node.idl with the spec
This makes it easier to compare with the spec :^)

(cherry picked from commit 62f74f3b7765734eafef35327ee46d7bd97f7550)
2024-07-21 14:19:52 -04:00
Aliaksandr Kalenik 2f6c12cd15 LibWeb: Fix flexible track sizing in GFC
- Change min track sizing function to be "auto" when flex size is
  specified.
- Never check if min track sizing funciton is flexible, because only
  max is allowed to be flexible.
- Address FIXME in automatic_minimum_size to avoid regressions after
  making two fixes mentioned above.

(cherry picked from commit 3270df476dd46b140e1b9de1e8328647744b56ab)
2024-07-21 14:19:12 -04:00
Aliaksandr Kalenik 409e3ae994 LibWeb: Subtract left inset from size_available_for_margins for abspos
Some checks failed
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
Generate man pages / convert_using_pandoc (push) Has been cancelled
Fixes https://github.com/LadybirdBrowser/ladybird/issues/712

(cherry picked from commit 0be57df54dd57d1544eead1c1bc8fe117c0a3450)
2024-07-21 14:13:42 -04:00
Aliaksandr Kalenik c82f41dac8 LibWeb: Change grid item placement to look for area by boundary lines
Areas are disassembled into boundary lines on `build_grid_areas()` step,
so we can always use them to find grid item's position during placement.
This way we support both ways to define area: `grid-template-areas` and
implicitly using `-start` and `-end` boundary line names.

(cherry picked from commit 7a1f3f7ae3af2744e2f99df29baf09153d631b24)
2024-07-21 14:08:37 -04:00
Andreas Kling c6038071a4 LibWeb: Allow splitting surrogate pairs in CharacterData.replaceData()
We're expected to handle this situation gracefully, and certainly not
by falling apart like we were.

Found by Domato.

(cherry picked from commit 33207174a9c1c87657e2ae0875cc85cbf41075f8)
2024-07-21 14:07:57 -04:00
Andreas Kling 1484dbffae LibWeb: Don't try to set selection with anchor/focus in different roots
If the anchor and focus nodes are not within the same document, we can't
use them for a selection range.

Found by Domato.

(cherry picked from commit 416c4788763baa778465d1d004080d322462c0bf)
2024-07-21 14:07:57 -04:00
Andreas Kling 7ddd8bac62 LibWeb: Cap HTML dimension values at 17895700 (same as Firefox)
Instead of allowing arbitrarily large values (which could eventually
overflow an i32), let's just cap them at the same limit as Firefox does.

Found by Domato.

(cherry picked from commit 4e0edd42b95abf8ad707c64414dbe618313ce89e)
2024-07-21 14:07:57 -04:00
Andreas Kling e99c005c80 LibWeb: Propagate exceptions from setAttribute() in DOMStringMap setter
We were incorrectly assuming that setAttribute() could never fail here,
even when passed an invalid name.

Found by Domato.

(cherry picked from commit 093f1dd805f699801079f55d0d490d80b463ccbb)
2024-07-21 14:07:57 -04:00
Andreas Kling d2ae01f8ad LibWeb: Fix StringView OOB access when parsing 3-character legacy color
Found by Domato.

(cherry picked from commit 1c00e5688d3330626f809e758bb63c8348776971)
2024-07-21 14:07:57 -04:00
Sam Atkins 6ab6138fe6 LibWeb/CSS: Make StringStyleValue hold a FlyString
We already have a FlyString of its value from parsing, and most users
also want a FlyString from it, so let's use that instead of converting
backwards and forwards.

The two users that did want a String are:
- Quotes, which make sense as FlyString instead, so I've converted that.
- Animation names, which should probably be FlyString too, but the code
  currently also allows for other kinds of StyleValue, and I don't want
  to dive into this right now to figure out if that's needed or not.

(cherry picked from commit 9fb44cb05777c6d7a8a1950258edadfcee6d4e09)
2024-07-21 14:07:33 -04:00
Sam Atkins 6393e542ab LibWeb/CSS: Remove unused StyleProperties::grid_area()
This does not appear to be correct; the `grid-area` property's value is
quite complicated, and not just a string.

(cherry picked from commit d2f04b9f0415ebfebb1d8f6386ff13f8df053674)
2024-07-21 14:07:33 -04:00
Alec Murphy 09d7a45d73 Calendar: Initial support for iCalendar format
This PR adds basic support for loading iCalendar (.ics) files and
parsing VEVENT properties that are currently supported by Calendar
Events: summary, start and end.
2024-07-21 13:13:47 -04:00
Timothy Flynn 258e9335ef LibJS: Create exception messages as Strings
The JS::Error types all store their exception messages as a String. So
by using ByteString, we hit the StringView constructor, and end up
allocating the same string twice.

(cherry picked from commit c3f8202d0ca7761caaabf0af5f413dc25337801f)
2024-07-21 13:11:01 -04:00
Andreas Kling e1e05d5c6b LibWeb: Make getElementById() always return first match in tree order
We had a const and non-const version of this function, with slightly
different behavior (oops!)

This patch consolidates the implementations and keeps only the correct
behavior in there.

Fixes an issue where comments were not collapsible on Hacker News.

(cherry picked from commit 98f88d49de852e1e524655accb39724f1134a23f)
2024-07-21 12:37:18 -04:00
Andreas Kling fc462c6c65 LibWeb: Use static_cast<HTMLTemplateElement> right after an is<> check
The double verify_cast here was just barely visible in a profile.

(cherry picked from commit 7dacd6be89619d4c4ac7da3b5bb955cd772a2dc6)
2024-07-21 12:37:05 -04:00
Andreas Kling 630aff7a20 LibWeb: Stop creating transient throwaway JS::Handles in HTML parser
These were being immediately stored in JS::GCPtrs (and dutifully visited
by HTMLParser), so creating temporary handles for them was a complete
waste of time.

(cherry picked from commit f9f11dc51d50746ccb1a82cd304fe30901edc347)
2024-07-21 12:37:05 -04:00
Andreas Kling 4ce5aeb312 LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.

None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.

This patch makes the common case faster in two ways:

- We use TextCodec::Decoder::to_utf8() instead of process()
  This way, we do a one-shot fast validation and conversion to UTF-8,
  instead of using the generic code-point-at-a-time callback API.

- We scan for '\r' and '\f' before filtering, and if neither is present,
  we simply use the unfiltered string.

With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.

(cherry picked from commit dba6216caa71796f25831908035cd9eb0fb54715)
2024-07-21 12:37:05 -04:00
Andreas Kling 457de9e99d LibWeb: Use StringBuilder::append_code_point() over append(Utf32View)
When appending a single Unicode code point, we don't have to go through
the trouble of creating a Utf32View wrapper over it.

(cherry picked from commit 7892ee355df95f6414ab5334d8d997c2c0356a45)
2024-07-21 12:37:05 -04:00
Braydn d131f29ba8 LibJS: Implement CreatePerIterationEnvironment for 'for' statements
Implement for CreatePerIterationEnvironment for 'for' loops per the Ecma
Standard. This ensures each iteration of a 'for' loop has its own
lexical environment so that variables declared in the loop are scoped to
the current iteration.

(cherry picked from commit dbc2f7ed48f00234f5f94a30b06b83842d9cf4dd)
2024-07-21 11:31:13 -04:00
Colin Reeder 8908038f96 LibWeb: Add support for indexed setter of HTMLOptionsCollection
(cherry picked from commit 99824eae142b02c7bce84b9e98d10fc6428f31fe)
2024-07-21 11:29:07 -04:00
BenJilks 456a09e8c7 LibWeb: Propagate margin and offset when computing a box's baseline
When traversing the layout tree to find an appropriate box child to
derive the baseline from. Only the child's margin and offset was being
applied. Now we sum each offset on the recursive call.

(cherry picked from commit 3c897e7cf3594f02f559599e1bf28747c9edba13)
2024-07-21 11:28:55 -04:00
Diego Frias e4d3b9060a LibWeb: Implement the :has() pseudo-class
See https://drafts.csswg.org/selectors-4/#relational.

(cherry picked from commit f63a945ba0300551417c740e450957f29c9b73d1)
2024-07-21 11:10:11 -04:00
Liav A. 4aec3f4ef9 Kernel+Userland: Simplify loading of an ELF interpreter path
The LibELF validate_program_headers method tried to do too many things
at once, and as a result, we had an awkward return type from it.

To be able to simplify it, we no longer allow passing a StringBuilder*
but instead we require to pass an Optional<Elf_Phdr> by reference so
it could be filled with actual ELF program header that corresponds to
an INTERP header if such found.

As a result, we ensure that only certain implementations that actually
care about the ELF interpreter path will actually try to load it on
their own and if they fail, they can have better diagnostics for an
invalid INTERP header.

This change also fixes a bug that on which we failed to execute an ELF
program if the INTERP header is located outside the first 4KiB page of
the ELF file, as the kernel previously didn't have support for looking
beyond that for that header.
2024-07-21 15:38:52 +02:00
Liav A. ccf3d29afd Utilities: Introduce the watchfs utility
This utility is meant mainly for debugging purposes, to watch regular
files and directories being modified.
2024-07-21 12:15:44 +02:00
Liav A. fdcfa23e01 Userland+Base: Introduce userspace implementation for running containers
Together with a first JSON file for bringing up a fully functional
BuggieBox container, we allow users to take advantage of the kernel
unsharing features that were introduced in earlier commits.
2024-07-21 11:44:23 +02:00
Liav A. aa01f52592 LibCore: Add System methods to handle the unshare syscall family
These 2 methods will be used later by the userspace implementation that
will handle creation of containers.
2024-07-21 11:44:23 +02:00
Liav A. 4370bbb3ad Kernel+Userland: Introduce the copy_mount syscall
This new syscall will be used by the upcoming runc (run-container)
utility.

In addition to that, this syscall allows userspace to neatly copy RAMFS
instances to other places, which was not possible in the past.
2024-07-21 11:44:23 +02:00
Liav A. 816f2efb4e Userland: Always enter jail mode in Browser and Assistant
These programs are capable of running other programs, so we should
restrict them from potentially running SUID programs, which was never a
functionality we supported for those programs anyway.
2024-07-21 11:44:23 +02:00
Liav A. dd59fe35c7 Kernel+Userland: Reduce jails to be a simple boolean flag
The whole concept of Jails was far more complicated than I actually want
it to be, so let's reduce the complexity of how it works from now on.
Please note that we always leaked the attach count of a Jail object in
the fork syscall if it failed midway.
Instead, we should have attach to the jail just before registering the
new Process, so we don't need to worry about unsuccessful Process
creation.

The reduction of complexity in regard to jails means that instead of
relying on jails to provide PID isolation, we could simplify the whole
idea of them to be a simple SetOnce, and let the ProcessList (now called
ScopedProcessList) to be responsible for this type of isolation.

Therefore, we apply the following changes to do so:
- We make the Jail concept no longer a class of its own. Instead, we
  simplify the idea of being jailed to a simple ProtectedValues boolean
  flag. This means that we no longer check of matching jail pointers
  anywhere in the Kernel code.
  To set a process as jailed, a new prctl option was added to set a
  Kernel SetOnce boolean flag (so it cannot change ever again).
- We provide Process & Thread methods to iterate over process lists.
  A process can either iterate on the global process list, or if it's
  attached to a scoped process list, then only over that list.
  This essentially replaces the need of checking the Jail pointer of a
  process when iterating over process lists.
2024-07-21 11:44:23 +02:00
Liav A. 91c87c5b77 Kernel+Userland: Prepare for considering VFSRootContext when mounting
Expose some initial interfaces in the mount-related syscalls to select
the desired VFSRootContext, by specifying the VFSRootContext index
number.

For now there's still no way to create a different VFSRootContext, so
the only valid IDs are -1 (for currently attached VFSRootContext) or 1
for the first userspace VFSRootContext.
2024-07-21 11:44:23 +02:00
mkblumenau 02157e3eaf LibGUI: Improve how SpinBox handles negative numbers
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
Negative numbers now display correctly in SpinBox.
Previously, they displayed as the negative sign only (no number).
Now the user can also type negative numbers into the SpinBox.
2024-07-19 21:20:52 +01:00
circl 94ce662c0a LibWeb: Restore event characteristics of MouseEvents and WheelEvents
These were accidentally no longer set after
2c396b5378fec5f4470e1e1e950806dff8005f08

(cherry picked from commit f20010c1d3a66aaabd5da5a96c578ad013756f99)
2024-07-16 15:04:06 -04:00
Ali Mohammad Pur 68aa4cbb91 LibWasm: Make Absolute/Negate<SignedIntegral> explicitly work mod 2^N
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
Previously we relied on signed overflow, this commit makes the same
behaviour explicit (avoiding UB in the process).

(cherry picked from commit 8c8310f0bddc874a9f7f07c4158f0abc799357d4)
2024-07-16 17:35:43 +02:00
Diego Frias bc5c549e7f LibWasm: Correctly validate v128_load*_lane instructions
(cherry picked from commit 8a0ef17d9a9621ab4bd52dc402c0fbd57944d42c)
2024-07-16 17:35:43 +02:00
Diego Frias a2bb6e1cfc LibWasm: Implement rest of SIMD load/store instructions
Also implement `v128.any_true`.

(cherry picked from commit f5326f1747b9559993cb6f89841de2fc54c10387)
2024-07-16 17:35:43 +02:00
Enver Balalic 34b3015c16 LibWasm: Implement most of iNxM SIMD operations
With this we pass an additional ~2100 tests.
We are left with 7106 WASM fails :).

There's still some test cases in the iNxM tests that fail with
this PR, but they are somewhat weird.

(cherry picked from commit b4acd4fb0b7f4105c7ef673ccc00904114c3c468)

Co-authored-by: Diego Frias <styx5242@gmail.com>
2024-07-16 17:35:43 +02:00
Diego b896f27a45 LibWasm: Fix sign issues in SIMD cmp ops
(cherry picked from commit 1e1dcd89438c5b0b8ad34682de4f1c7c62cbacb9)
2024-07-16 17:35:43 +02:00
Diego Frias 9ae48f6a49 LibWasm: Make SIMD float min/max operations binary ops
They previously acted like comparison operators, which was not correct.

(cherry picked from commit d6acda2047dec0a0ba6eda50039feff816c3e82b)
2024-07-16 17:35:43 +02:00
Diego c3af74f0a2 LibWasm: Validate stack correctly in v128_store*_lane instructions
Previously the validator put a `v128` on the stack, which is not what
the spec defines.

(cherry picked from commit 0d38572d8bd2a276be1b6066b62efd376ddbd4d6)
2024-07-16 17:35:43 +02:00
Diego 59628b5eeb LibWasm: Make memory.grow grow the memory's type
After a `memory.grow`, the type of the memory instance should be
updated so potential memory imports on the boundary are unlinkable.

(cherry picked from commit cdb6e834a1c0eaa6e62a9018026a599916332ab3)
2024-07-16 17:35:43 +02:00
Diego e5a842c78e LibWasm: Fix loop arity for single-type blocktypes
Single-type blocktypes previously gave loop labels an arity of 1, even
though they're shorthand for `[] -> [T]`.

(cherry picked from commit ad6a80144c23f9ccdeeccb123a9de85396524040)
2024-07-16 17:35:43 +02:00
Diego 7df774c473 LibWasm: Implement SIMD bitwise operations
(cherry picked from commit 2ab676860e56216cf0560dac1aafd4e5656ec586)
2024-07-16 17:35:43 +02:00
MacDue cf88838001 LibC: Call pthread key destructors before global destructors
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
Since be2bf05 the ThreadEventQueue is now destroyed via a phread key
destructor, which leads to many other objects being destroyed. A bunch
of these destructors reference globals, but exit() calls destructors
on globals before phread destructors, this bad state leads to the hangs
seen in #24694.

Fixes #24694
2024-07-15 18:50:55 -04:00
Kenneth Myhra 0d9429e383 LibWeb: Implement min option for ReadableStreamBYOBReader.read()
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
When the min option is given the read will only be fulfilled when there
are min or more elements available in the readable byte stream.

When the min option is not given the default value for min is 1.

(cherry picked from commit 907dc84c1e8c3c236ade581f46dabdb144915c1d)
2024-07-15 09:05:07 -04:00
Nico Weber ceb956c170 animation: Add a switch for controlling the webp color cache size 2024-07-15 08:47:34 -04:00
Nico Weber e9329eefe6 LibGfx/WebPWriter: Add support for writing color cache symbols
Lossless WebP allows having a 1-bit to 11-bit addressed
"color cache", where pixels are inserted into a content-addressed
cache of size `1 << color_cache_bits`. Pixels in the color
cache can be addressed using their index. This can be used
to refer to literal pixels using a single color_cache_bits
large symbol, instead of up to 4 symbols for GBRA.

We default to always using a color cache with 6 bits, unless
the input image already uses only a single channel already
(either as-is, or if we write a color indexing transform).

Due to this change, the size of the first prefix group
changes from being known at compile time (256 + 24)
to being known at runtime (256 + 24 + color_cache_size).
Change a few Array<>s to Vector<>s to make this work.

    sunset_retro.png (876K):
        1.6M -> 1.4M, 29.1 ms ± 0.9 ms -> 31.7 ms ± 0.9 ms

From 83% larger than the input file to 60% larger (12.5% smaller),
for a 9% slowdown.

The two gifs I usually test with don't change: Files using the
color _index_ transform (i.e. that have < 256 colors) don't
use the color _cache_ in our encoder.
2024-07-15 08:47:34 -04:00
Luke Warlow e8bcd3842d LibWeb: Implement support for scrollbar-gutter
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
This property is now correctly parsed.

Ladybird always uses overlay scrollbars so this property does nothing.

(cherry picked from commit 662317726549cd2dde4c7902b99f0b83397a3396)
2024-07-14 20:44:46 -04:00
Andreas Kling c75b68c5a4 LibWeb: Add null check in Document::ancestor_navigables()
The spec doesn't explicitly forbid calling this when the document
doesn't have a node navigable, so let's handle that situation gracefully
by just returning an empty list of ancestors.

I hit this VERIFY somewhere on the web, but I don't know how to
reproduce it.
2024-07-14 20:37:22 -04:00
circl c7de605e4b LibWeb/ResourceLoader: Report file: errors as "network errors"
This triggers the generated error page which is more informative.

(cherry picked from commit 91e3ef6dbf411edb6497342ac89817c8487ce6d8)
2024-07-14 19:57:14 -04:00
circl b15cbceec6 LibWeb/ResourceLoader: Call error callback if resource: load fails
(cherry picked from commit e35b055192cf611519204389fc91917b91233d95)
2024-07-14 19:57:14 -04:00
circl 8998afc9c3 LibWeb/Fetch: Pass error from ResourceLoader into network_error
(cherry picked from commit 4e6eb35520def1b1488af6a800b03c007e56b9dd)
2024-07-14 19:57:14 -04:00
circl 5a5c6afd2d LibWeb: Pass network error message to generated error page
(cherry picked from commit b83e82c32cf82d2b9d21271322a4a9161357f081)
2024-07-14 19:57:14 -04:00
Diego Frias 4c0fcb7ae3 LibWebView: Trim whitespace when sanitizing file paths
Previously, the presence of surrounding whitespace would give file paths
the `https` schema instead of the `file` schema, making navigation
unsuccessful.

(cherry picked from commit ff7ca5c48c316e07b1bf631b2d7ed14c358dfa42)
2024-07-14 19:34:49 -04:00
Bastiaan van der Plaat 6ab28fd568 LibWeb/CSS: Serialize transform scale percentage values as numbers
(cherry picked from commit c81a640f3ed424b11830fbe9777f1a267240577f)
2024-07-14 19:34:39 -04:00
BenJilks 2e95c03ca6 LibWeb: Change flex remaining space distribution to include gap
Some checks are pending
CI / Lagom (NO_FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / Lagom (NO_FUZZ, macos-14, macOS) (push) Waiting to run
CI / Lagom (FUZZ, ubuntu-22.04, Linux) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (x86_64, NORMAL_DEBUG, ubuntu-22.04, Clang) (push) Waiting to run
CI / SerenityOS (x86_64, ALL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
CI / SerenityOS (aarch64, NORMAL_DEBUG, ubuntu-22.04, GNU) (push) Waiting to run
Discord notifications / notify_discord (push) Waiting to run
Social media notifications / notify_mastodon (push) Waiting to run
Social media notifications / notify_twitter (push) Waiting to run
Build Wasm Modules / build (push) Waiting to run
The remaining space is in addition to, not of in place of the
main gap.

(cherry picked from commit 47aee289d87add9784a2d722cb529774cdfb54e2)
2024-07-14 18:12:55 -04:00
Jamie Mansfield 0d09539fd2 LibWeb: Add FIXMEs for missing SVGGeometryElement attributes
(cherry picked from commit 772d64aca25719d8790ce324ea2ce7fd59d3203c)
2024-07-14 18:12:26 -04:00
Jamie Mansfield 05d90afa65 LibWeb: Add FIXMEs for missing SVGElement attributes
(cherry picked from commit c9f3a7ddbfaedd957c5bd5a50616d4ac7532d154)
2024-07-14 18:12:26 -04:00
Jamie Mansfield c14af45628 LibWeb: Implement SVGElement.className
(cherry picked from commit 9d1ea4c7e013629d432a4c3559a5919462fd4c71)
2024-07-14 18:12:26 -04:00
Jamie Mansfield b96e9c130b LibWeb: SVGElement includes GlobalEventHandlers
This fixes many tests on
wpt/html/webappapis/scripting/events/event-handler-all-global-events.html

(cherry picked from commit 59f74b909ba161a143fb4cd5cbaf6dcf6734d240)
2024-07-14 18:12:26 -04:00
Jamie Mansfield 8ce8639ed8 LibWeb: Implement MessageEvent.initMessageEvent
This fixes wpt/html/webappapis/scripting/events/messageevent-constructor.https.html

(cherry picked from commit ffb3a28684b1b4c028af93aa6d7d9194f002d503)
2024-07-14 18:12:26 -04:00
Tim Ledbetter 4b00926a66 LibWeb: Update Range::set_base_and_extent() to the latest spec text
This allows it to work with content inside shadow roots.

(cherry picked from commit 34741d09c6e69bd7cd8450668facd552cd69d21b)
2024-07-14 16:46:23 -04:00
Tim Ledbetter 35ce74aa9b LibWeb: Don't update selection if start and end node roots differ
This allows selection to work within shadow roots and prevents the
selection being cleared if the mouse moves outside of the current
document or shadow root.

(cherry picked from commit e5d1261640a71a672c5cd19910f5f6288e65ed04)
2024-07-14 16:46:23 -04:00
Colin Reeder bf0a7667a0 LibWeb: Handle inline-start and inline-end as float values
Should resolve #449 for LTR languages at least

(cherry picked from commit d427344f39581cd7789280949eb6d102b39218a3)
2024-07-14 16:45:48 -04:00
Jamie Mansfield 6e9f9b5efc LibWeb: Implement EmbedderPolicy struct
(cherry picked from commit 190a41971569ad90c26662d7e7e850a61c55c8dd)
2024-07-14 16:45:35 -04:00
Tim Ledbetter fe5ccd3e0c LibWeb: Add styling for disabled button elements
(cherry picked from commit c92222dcae6bf641fc7da4fb568b0bb640ceb7e4)
2024-07-14 16:45:21 -04:00
Tim Ledbetter 7d71a5483c LibWeb: Don't dispatch click events to disabled FormAssociatedElements
Disabled FormAssociatedElements also no longer receive focus when
clicked.

(cherry picked from commit e18501f67fb0361a10392bc626e6c43f26f1e9cc)
2024-07-14 16:45:21 -04:00
Timothy Flynn 3f8b94b131 LibJS: Update specification steps for the Set Methods proposal
It is now Stage 4 and has been merged into the main ECMA-262 spec:
https://github.com/tc39/ecma262/commit/a78d504

(cherry picked from commit 2dbd71d54ba20b3700d3f98001a1cf0ec4adbe25)
2024-07-14 16:45:08 -04:00
Timothy Flynn 0bbf42bca7 LibJS: Introduce the CanonicalizeKeyedCollectionKey AO
This is an editorial change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/30257dd

(cherry picked from commit 55b4ef79157f299e68163824d8d03dfab31dd3d6)
2024-07-14 16:45:08 -04:00
Jamie Mansfield 1d2fa89d9f LibWeb: Implement HTMLMediaElement.textTracks
(cherry picked from commit 65be928d4e18108146645e177b586a3d9117aebc)
2024-07-14 14:01:30 -04:00
Jamie Mansfield a09b52e40f LibWeb/HTML: Implement TextTrackList IDL interface
(cherry picked from commit ecad28657a0941c99870bdb72f3a6f09b6db6ee3)
2024-07-14 14:01:30 -04:00
Jamie Mansfield 894567cb44 LibWeb: Implement TextTrack.id
(cherry picked from commit ba8e77df1690e9ce00c4903b65adbc19fbda25ed)
2024-07-14 14:01:30 -04:00
Jamie Mansfield c8cd40fa21 LibWeb: Allow TrackEvent track to be a TextTrack
Fixes two FIXMEs :^)

(cherry picked from commit ab91a616b8e8bdd32c195adb2f081ba07fba2ac4)
2024-07-14 14:01:30 -04:00
simonkrauter 5838244afc LibWeb: Use correct default value for <input type=range>
Previously the input element was displayed with value 0, when no value
was set in the HTML. Now it uses `value_sanitization_algorithm()`, which
will calculate the default value.
In `value_sanitization_algorithm()` there was a logical mistake/typo.
The comment from the spec says "unless the maximum is less than the
minimum".
The added layout test would fail without the code changes.
Fixes #520

(cherry picked from commit 191531b7b18d2edf97dc7bf88a9c19903eeae2d5)
2024-07-14 14:01:21 -04:00
Tim Ledbetter 497fc7476d LibWeb: Remove m_src_is_set field from HTMLScriptElement
Now that we pass an `old_value` parameter to `attribute_changed` it is
no longer necessary to store the current attribute state in
`HTMLScriptElement`.

(cherry picked from commit aa4e18fca50b261eabd5672a3f1163b4ac7ef50b)
2024-07-14 14:01:11 -04:00
Tim Ledbetter df796fef1a LibWeb: Pass the old attribute value to Element::attribute_changed()
(cherry picked from commit a552bda8d96d3c8a16f02dca5d1b37483dd5a634)
2024-07-14 14:01:11 -04:00
Kenneth Myhra 55b214ba95 LibWeb: Align transform_stream_error_writable_and_unblock_write w/ spec
This aligns AO transform_stream_error_writable_and_unblock_write() with
the spec.

No functional change is introduced by this amendment.

(cherry picked from commit 24bed027b2db59935da185d3bd490718ccb37baa)
2024-07-14 14:00:45 -04:00
Andreas Kling 5e481950f8 LibJS: Make GetById and GetByValue avoid get_identifier() in common case
We now defer looking up the various identifiers by IdentifierTableIndex
until the last moment. This allows us to avoid the retrieval in common
cases like when a property access is cached.

Knocks a ~12% item off the profile on https://ventrella.com/Clusters/

(cherry picked from commit 509c10d14db0f2e2ce2b89f307d9dd360b855eb5,
amended to mark the two `throw_null_or_undefined_property_get` functions
static, as -Wmissing-declarations pointed out on CI)
2024-07-14 14:00:35 -04:00
Andreas Kling eba2a5b0f9 LibJS: Move CommonImplementations.h into Interpreter.cpp
Now that the Interpreter is the only user of these functions, we might
as well keep them in Interpreter.cpp which makes CLion less confused.

(cherry picked from commit ae0cfe4f2d260bfd804364c17f28494e3e8964c9)
2024-07-14 14:00:35 -04:00
simonkrauter 7b353a3a55 LibWeb: Define width for -webkit-slider-runnable-track
Fixes LadybirdBrowser/ladybird#512

(cherry picked from commit b5e80db2259448bc0b3dc48d88f53e8d1880987e)
2024-07-14 06:57:50 -04:00
Tim Ledbetter 1506f72219 LibWeb: Populate filename in WindowOrWorkerGlobalScope.reportError()
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.

(cherry picked from commit 34b987366449313c96a73ec1d70e88e60f2c4510)
2024-07-14 06:57:29 -04:00
Jamie Mansfield 9d7267ba76 LibWeb: Add missing edge visit for TextTrack in HTMLTrackElement
(cherry picked from commit 0a3082ef05e8e7a963d3a208acd6efee0ff5c848)
2024-07-14 06:57:14 -04:00
Jamie Mansfield 0a1146c67a LibWeb/HTML: Stub TextTrack IDL interface
(cherry picked from commit 67e3ac8916d7354c8485b4bbe9c4162392e0e99c)
2024-07-14 06:57:14 -04:00
rmg-x 435bbb53f8 LibWeb: Ensure normal line-height on HTMLInputElement
Previously, setting CSS `line-height: 0` on an `input` element would
result in no text being displayed.

Other browsers handle this by setting the minimum height to the
"normal" value for single line inputs.

(cherry picked from commit 629068c2a7eb02db37ffb4fe8d536306ee71e156)
2024-07-14 06:56:56 -04:00
rmg-x 7507357496 LibWeb: Add method HTMLInputElement::is_single_line()
(cherry picked from commit b36a78a798bf9cac60ff13e003b0a1c94a716817)
2024-07-14 06:56:56 -04:00
rmg-x c30d2197bc LibWeb: Remove StyleProperties::compute_line_height(Layout::Node)
This method was unused and a FIXME remained for combining it with
another, similar method.

(cherry picked from commit df7f7268db5edb37b735f30586d774544537e342)
2024-07-14 06:56:56 -04:00
simonkrauter 8884386b4e LibWeb: Harmonize look of range input element
Previously the entire slider track was colored.
Now only the lower part of the slider track (left side of the thumb) is
colored.
Chrome and Firefox do the same.

(cherry picked from commit 7766909415312b971252f8c7750b0a1873fd5ba0)
2024-07-14 06:56:43 -04:00
⭐caitp⭐ bf6d966a30 LibWeb: Pass event_init to base class constructor in FocusEvent
This fixes some WPT failures caused by the "view" parameter not being
initialized from the property bag.

(cherry picked from commit 932a7d4d819fac9d0acfe4184574488dd69f94ec)
2024-07-14 06:56:30 -04:00
⭐caitp⭐ 6bc28e1f0b LibWeb: Remove set_event_characteristics()
These methods were overriding properties specified by the EventInit
property bags in the constructor for WheelEvent and MouseEvent.

They appear to be legacy code and no longer relevant, as they would have
been used for ensuring natively dispatched events had the correct
properties --- This is now done in separate create methods, such as
MouseEvent::create_from_platform_event.

This fixes a couple WPT failures (e.g. in
/dom/events/Event-subclasses-constructors.html)

(cherry picked from commit 2c396b5378fec5f4470e1e1e950806dff8005f08)
2024-07-14 06:56:16 -04:00
Tim Ledbetter fe03f6b6a7 LibWeb: Implement Node.normalize()
This method puts the given node and all of its sub-tree into a
normalized form. A normalized sub-tree has no empty text nodes and no
adjacent text nodes.

(cherry picked from commit 0a0651f34ea927a0ca44dc5d2c7786f3dcf8da25)
2024-07-14 06:55:54 -04:00
BenJilks aec3ab77ef LibWeb: When solving abspos lengths, use min max constrained height
Solving using the unconstrained height, when solving for bottom, would
either leave a gap over overflow its container.

(cherry picked from commit bee42160c5e2cdb949e6057f029391ee7e0fa9fa)
2024-07-13 22:52:34 -04:00
Maciej 1e41585416 LibWeb: Implement HTML DragEvent class
This just defines the class, drag events aren't actually fired yet.

(cherry picked from commit 65d8d205ee5d7ef356da58f8238e610949773683)
2024-07-13 22:52:06 -04:00
Andreas Kling 17c1a20f9b LibWeb: Don't fire resize event until document actually resizes once
The first time Document learns its viewport size, we now suppress firing
of the resize event.

This fixes an issue on multiple websites that were not expecting resize
events to fire so early in the loading process.

(cherry picked from commit 4e7558c88b7a993686bb3dc173731e677efe5e26)
2024-07-13 22:03:32 -04:00
Andreas Kling 4aeaea515b LibJS: Cache environment index for global declarative bindings
This allows global `let` and `const` variable accesses to be cached
by the GetGlobal instruction, and works even when the access is in a
different translation unit from the declaration.

Knocks a ~10% item off the profile on https://ventrella.com/Clusters/

(cherry picked from commit 9448c957c136e62b374a0f8998d1d51906e59fb5)
2024-07-13 22:03:22 -04:00
Caitlin Potter a263b007ff LibWeb: Legacy Platform Objects don't force [[Configurable]]
Per https://github.com/whatwg/webidl/commit/3fb6ab4dbc6a42517c84acf0909,
this step in the spec didn't reflect the reality in mainstream browsers.
This change fixes a failure in WPT/dom/collections/

(cherry picked from commit fac82119dff6f8063490698934ddd4243970eea3)
2024-07-13 21:53:20 -04:00
Maciej 6673dcc960 LibWeb: Prepare script when src is set the first time
From https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:
When a script element el that is not parser-inserted experiences one
of the events listed in the following list, the user agent must
immediately prepare the script element el:
- [...]
- The script element is connected and has a src attribute set where
  previously the element had no such attribute.

(cherry picked from commit d890be6e0f7db08ab39ba546cb3421b50b687cda)
2024-07-13 21:52:51 -04:00
Luke Warlow 85b5be0a20 LibWeb: Implement :modal pseudo class
Adds the :modal pseudo class which matches dialogs opened with
showModal().

(cherry picked from commit 63a5ff70e5f3bee10839415885a158e304719fec)
2024-07-13 21:52:41 -04:00
Gingeh d532331f34 LibWeb/CSS: Support hwb, oklab and oklch color functions
(cherry picked from commit e8d32bab58d9ffb183ee71ee6516d49556db136b,
manually amended to fix the two diags mentioned in
https://github.com/LadybirdBrowser/ladybird/pull/385#issuecomment-2227126447
)
2024-07-13 21:43:38 -04:00
Gingeh 052ff6e141 LibWeb/CSS: Split parse_rgb_or_hsl_color into separate functions
(cherry picked from commit 490a36bab18873db632496e594152b68cd2b8ca3)
2024-07-13 21:43:38 -04:00
Tim Ledbetter fdac183bff LibWeb: Invalidate input element style on focus change
The style of input and textarea elements is now invalidated when focus
is changed to a new element. This ensures any `:focus` selectors are
applied correctly.

(cherry picked from commit 572324d47b99bcfbc5db5ff6aef0d6c4eb15ce4c)
2024-07-13 21:41:18 -04:00
simonkrauter 74408dae20 LibWeb: Use system colors for input type range and progress as default
Instead of using fixed arbitrary colors for the background of the bar,
AccentColor and Background are now used.

(cherry picked from commit 062a266574a24fe13f2a77401b97f833c3cdd099)
2024-07-13 21:40:59 -04:00
Natsuki Ikeguchi fceb6e021f LibWeb: Add initial implementation of global.reportError()
(cherry picked from commit ccb3a2f7add22105a92ca997b67bbe02ec65b535)
2024-07-13 21:40:50 -04:00