Commit Graph

28484 Commits

Author SHA1 Message Date
Tim Ledbetter
dc71ac4d2f LibGUI: Remove TabWidget::try_add_tab() 2023-09-16 11:06:50 +02:00
Tim Ledbetter
ffda0785c0 Applications: Make creation of tabs non-fallible 2023-09-16 11:06:50 +02:00
Tim Ledbetter
3c9dee5d5a GameOfLife: Use the same play/pause action in the menu and toolbar
This prevents the menu and toolbar action state getting out of sync,
which could happen previously. The menu item also now shows the
appropriate icon rather than a checkbox.
2023-09-16 11:06:33 +02:00
Tim Ledbetter
ccab5ddf9b LibGUI+Applications: Use String in make_about_action() 2023-09-16 11:05:49 +02:00
Andrew Kaster
bd131c0bf8 LibWeb: Use "Android" as the OS string on Android 2023-09-15 14:18:52 -06:00
Andrew Kaster
0c5a546dca AK: Send dbgln/outln/warnln to the NDK logger on Android
The embedding application is responsible for setting the android log
tag. If it doesn't a default of "Serenity" will be used for any Lagom
code.
2023-09-15 14:18:52 -06:00
Bastiaan van der Plaat
e267f8e68f LibWeb: Add modifier keys to MouseEvent 2023-09-15 22:12:56 +02:00
Bastiaan van der Plaat
836a7b00dd Ladybird+LibWeb: Add MouseEvent screenX and screenY support 2023-09-15 22:12:56 +02:00
Bastiaan van der Plaat
e584189b8f LibWeb: Reorder MouseEvent items to follow spec more 2023-09-15 22:12:56 +02:00
Kemal Zebari
824c54acaf LibWeb/URL: Add strip_trailing_spaces_from_an_opaque_path()
Also remove 2 FIXMEs by including this function.
2023-09-15 11:15:43 -06:00
Kemal Zebari
ce549eb92a LibWeb/URL: Don't have URL::pathname() perform percent decode
Since the spec expects us to use AK::URL::serialize_path() without
doing any percent decoding.
2023-09-15 11:15:43 -06:00
Liav A
50429d3b22 LibC+Kernel: Move GPU-related API methods to a LibC header file
The Kernel/API directory in general shouldn't include userspace code,
but structure definitions that both are shared between the Kernel and
userspace.

All users of the ioctl API obviously use LibC so LibC is the most common
and shared library for the affected programs.
2023-09-15 11:05:25 -06:00
Liav A
8fe74c7d57 LibC+Kernel: Move device-files related methods to a LibC header file
The Kernel/API directory in general shouldn't include userspace code,
but structure definitions that both are shared between the Kernel and
userspace.

LibC is the most appropriate place for these methods as they're already
included in the sys/sysmacros.h file to create a set of convenient
macros for these methods.
2023-09-15 11:05:25 -06:00
Timothy Flynn
139c575cc9 LibUnicode: Update to Unicode version 15.1.0
https://unicode.org/versions/Unicode15.1.0/

This update includes a new set of code point properties, Indic Conjunct
Break. These may have the values Consonant, Linker, or Extend. These are
used in text segmentation to prevent breaking on some extended grapheme
cluster sequences.
2023-09-15 18:30:26 +02:00
Andrew Kaster
ae15b68b79 LibWeb: Call page_did_start_loading from navigate()
This fixes a crash in Browser on Serenity
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
6522fa8933 LibWeb: Use DocumentLoadEventDelayer to delay load event in Navigable
Use a delayer object that actually delays load event for child
navigables instead of boolean flag that does nothing.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
b398d6a35c LibWeb: Determine origin while populating navigation params from srcdoc
Address the FIXMEs by implementing the missing parts of the procedure
from the specification.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
7ad2dd2693 LibWeb: Exit navigation process if navigation id has changed
Change of navigation id means that it has been aborted, and we should
return early.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
b7c93cae7f LibWeb: Set document content type in load_document()
Fixes regression in `load_document()` compared to FrameLoader.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
c437f16cc1 LibWeb: Early return navigation process if navigable has been destroyed
If a navigable has been destroyed during a navigation process, we
should early return from it. The introduced checks are not in
the spec because, as explained in
https://github.com/whatwg/html/issues/9690 the spec is not written
with such a level of detail.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
c20123378d LibWeb: Add unloading of child navigables in "apply the history step"
Implements missing step from the spec.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
2445205e9d LibWeb: Align session history step application code with latest spec
Replaces direct "apply the history step" calls with new functions from
the spec:
- "update for navigable creation/destruction"
- "apply the push/replace history step"
- "apply the reload history step"
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
d3d2e56a68 LibWeb: Call set_ongoing_navigation() on navigable instead of this
This fixes incorrectly implemented spec when `set_ongoing_navigation()`
is called on `this` (=traversable) instead of `navigable` variable.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
799b465fac LibWeb: Compare urls excluding fragments in Navigable::navigate() 2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
fbc95440a4 LibWeb: Only return initialized navigables from child_navigables()
Fixes a crash in `get_session_history_entries()` that happens when
it attempts to find entries for a navigable that hasn't been fully
initialized and therefore doesn't have a nested history entry yet.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
15d265da65 LibWeb: Fix "stack-use-after-return" in navigate_to_a_fragmement()
Callback running on the session history queue should capture necessary
pointers by value instead of reference, because navigate_to_a_fragment
stack will have been destroyed by the time it will be executed.
2023-09-15 18:27:17 +02:00
Andreas Kling
23569f8690 LibWeb: Allow fractional font sizes in CSS
Fixes an issue where relative font sizes would "snap" to integer sizes
in an unpleasant-looking way while resizing on some websites.
2023-09-15 18:26:37 +02:00
Ali Mohammad Pur
4d71f4edc4 LibRegex: Don't add the Repeat instruction size to its jump target
This was causing the calculated jump target to become invalid, leading
to possibly invalid optimisations and (more likely) crashes.
Fixes #21047.
2023-09-15 18:07:23 +03:30
Andreas Kling
9220c68408 LibJS: Avoid pointless HashTable copying during GC mark phase
for_each_cell_among_possible_pointers() was taking HashTable by value
instead of by const reference for no reason.

The copying was soaking up ~4% of CPU time while loading https://x.com/
2023-09-15 12:12:54 +02:00
Luke Wilde
56f0b10d14 LibWeb: Fix setTimeout() when there's no active script
Implements https://github.com/whatwg/html/pull/9712
Fixes https://github.com/SerenityOS/serenity/issues/20970
2023-09-15 08:53:21 +02:00
Luke Wilde
9335524f15 LibWeb: Default ScriptFetchOptions parser metadata to NotParserInserted
See: https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options
2023-09-15 08:53:21 +02:00
Aliaksandr Kalenik
6f8be44c0e LibWeb+WebContent+headless-browser: Support async text tests
Previously, we used `on_load_finish` to determine when the text test
was completed. This method did not allow testing of async functions
because there was no way to indicate that the runner should wait for
the async call to end.

This change introduces a function in the `internals` object that is
intended to be called when the text test execution is completed. The
text test runner will now ignore `on_load_finish` which means a test
will timeout if this new function is never called.

`test(f)` function in `include.js` has been modified to automatically
terminate a test once `load` event is fired on `window`.
new `asyncTest(f)` function has been introduces. `f` receives function
that will terminate a test as a first argument.

Every test is expected to call either `test()` or `asyncTest()` to
complete. If not, it will remain hanging until a timeout occurs.
2023-09-15 08:52:25 +02:00
Tim Ledbetter
c74f7e5f2a Userland: Don't use String::from_utf8() for literal strings 2023-09-15 08:44:52 +02:00
Zaggy1024
4cc3c41269 LibWeb: Allow calculated values for background-size dimensions
This fixes the sizing of the arrow icons displayed to the left of
parent sections on a table of contents on Wikipedia articles, which
are sized using the equation `calc(max(0.75em, 12px))`. Now, the icon
will not expand past the edges of the box they are within, avoiding
clipping the edges of the arrows.
2023-09-15 08:40:10 +02:00
Bastiaan van der Plaat
222cc29c5c LibWeb: Add XMLHttpRequest Document response type 2023-09-14 22:58:42 +02:00
Nicolas Ramz
b8f8b22aa5 LibGfx/ILBM: Add support for uncompressed files 2023-09-14 21:00:54 +01:00
Andreas Kling
80a78c4deb LibWeb: Don't generate ::before/::after for BR elements
We shouldn't be putting generated pseudo elements inside elements that
can't have children in the first place.

This patch fixes two issues:
- We stop generating pseudo elements for layout nodes that can't have
  children anyway.
- We mark Layout::BreakNode as not being able to have children.
2023-09-14 21:46:28 +02:00
Andreas Kling
a7c1af08ca LibJS: Store bytecode instruction length in instruction itself
Instead of running a big switch statement on the opcode when checking
how long an instruction is, we now simply store that in a member
variable at construction time for instant access.

This yields a 10.2% speed-up on Kraken/ai-astar :^)
2023-09-14 16:11:14 +02:00
Shannon Booth
d7c1cc0276 LibWeb: Fix missing 'get an output encoding' step in HTMLFormElement
This could mean that the picked encoding was not being set to UTF-8 if
the documents encoding was 'replacement', 'utf-16le' or 'utf-16be'.
2023-09-14 06:49:57 -04:00
implicitfield
63d09f6daf Browser+Ladybird: Let the list of user agent strings be shared 2023-09-13 19:33:07 -04:00
Bastiaan van der Plaat
d63fb8fa61 Maps: Add show SerenityOS users feature 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat
dfb54083ee Maps: Add markers to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat
599a37aa0c Maps: Add panels to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat
048e8d7744 Maps: Add toolbar and frame border to map widget 2023-09-13 21:41:37 +02:00
Bastiaan van der Plaat
b5f91e3365 Maps: Remember last window position and size 2023-09-13 21:41:37 +02:00
Aliaksandr Kalenik
84139a10d2 LibWeb: Implement navigation to javascript: URLs for navigables
Implements following algorithms from the specification:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik
09013583f2 LibWeb: Add Navigable::set_ongoing_navigation() 2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik
aa0d254fa3 LibWeb: Start fleshing out "URL and history update steps" 2023-09-13 21:35:52 +02:00
Sam Atkins
6bf107fc16 LibWeb: Implement the :open and :closed pseudo-classes
These apply to any elements that have some kind of open/closed state.
The spec suggests `<details>`, `<dialog>`, and `<select>`, so that's
what I've supported here. Only `<details>` is fleshed out right now,
but once the others are, these pseudo-classes should work
automatically. :^)
2023-09-13 19:55:22 +02:00
Sam Atkins
29bb0f0ae6 LibWeb: Stub out an "open" state on <select> elements
The CSS Selectors-4 spec suggests that `:open` and `:closed` should
apply to `<select>` elements, so let's add a way of storing and
exposing that state. We don't yet actually generate any layout for
`<select>` elements, so they will always report that they are closed.
2023-09-13 19:55:22 +02:00
Timothy Flynn
b1632c58bf LibWeb: Create a shadow tree for details elements with manual slots
The spec requires that details elements be assigned a shadow tree with
two slots. The first slot is assigned the first summary child element of
the details element. The second slot is assigned all other children.
2023-09-13 13:45:47 +02:00
Timothy Flynn
bdf2323b3f LibWeb: Perform layout of a slot's assigned nodes 2023-09-13 13:45:47 +02:00
Timothy Flynn
e4d3a9aa68 LibWeb: Ensure DOM events on slottables are properly propagated
Most events on a slottable are composed, meaning they propagate from the
slottable and through its shadow tree before bubbling up to the parent
of the slottable.
2023-09-13 13:45:47 +02:00
Timothy Flynn
d67d93f870 LibWeb: Handle reassigning slottables on node insertion and removal 2023-09-13 13:45:47 +02:00
Timothy Flynn
683ce8e615 LibWeb: Implement (most of) the assigned slot/slottable lookup APIs
This implements looking up a slottable's assigned slot, and a slot's
list of assigned slottables. For the latter, only unflattened lookups
are implemented so far.
2023-09-13 13:45:47 +02:00
Timothy Flynn
b602ee7ddd LibWeb: Implement automatic slottable assignment
This implements automatic slottable assignment by way of hooking into
the element attribute change steps. When the `name` attribute of a slot
or the `slot` attribute of a slottable changes, assignment is performed.
2023-09-13 13:45:47 +02:00
Timothy Flynn
e9da74ebe0 LibWeb: Implement manual slottable assignment
This implements manual slottable assignment by way of HTMLSlotElement's
`assign` API. This includes all of the slottable-related AOs needed to
perform the assignment.
2023-09-13 13:45:47 +02:00
Timothy Flynn
7870f10aa8 LibWeb: Introduce the slot concept for HTML slot elements
A slot is an HTMLSlotElement. It may have any number of slottable nodes
assigned to it.
2023-09-13 13:45:47 +02:00
Timothy Flynn
45b36bd08a LibWeb: Introduce the slottable concept for DOM elements and text nodes
A slottable is either a DOM element or a DOM text node. They may be
assigned to slots (HTMLSlotElement) either automatically or manually.
Automatic assignment occurs by matching a slot's `name` attribute to
a slottable's `slot` attribute. Manual assignment occurs by using the
slot's (not yet implemented) `assign` API.

This commit does not perform the above assignments. It just sets up the
slottable concept via IDL and hooks the slottable mixin into the element
and text nodes.
2023-09-13 13:45:47 +02:00
Timothy Flynn
b85a252753 LibWeb: Implement the attribute-change-steps extension
This is similar to the run activation behavior in that elements may
define these steps themselves. HTMLSlotElement is one such element. The
existing (ad-hoc) Element::attribute_changed() method is not sufficient
there as the steps require knowledge of the attribute's old value and
its namespace, which this extension provides.

Unlike the run activation behavior, we store these steps in a list. An
element may end up defining multiple attribute change steps. For example
all DOM elements must define steps to handle the "slot" attribute, and
HTMLSlotElement must define steps to handle the "name" attribute.
2023-09-13 13:45:47 +02:00
Timothy Flynn
54b5a431a3 LibWeb: Implement element slot-related attributes and settings
This implements the element's slot attribute itself, and setting the
slot assignment on the element's shadow root.
2023-09-13 13:45:47 +02:00
Timothy Flynn
4e32f0d39f LibWeb: Remove virtual specifier from Element::set/remove_attribute()
Only HTMLDetailsElement was overriding these methods, which has been
updated to use Element::attribute_changed() instead.
2023-09-13 13:45:47 +02:00
Timothy Flynn
8bb5652835 LibWeb: Implement HTMLDetailsElement's open attribute closer to the spec
The spec now has a "toggle task tracker" to coalesce rapid changes to
this attribute. It also now has an explicit ToggleEvent to encapsulate
the old and new state of the element.

This further handles the attribute being added/removed using a override
of Element::attribute_changed(), rather than being the only element to
instead override Element::set/remove__attribute().
2023-09-13 13:45:47 +02:00
Timothy Flynn
153ae93f9c LibWeb: Implement ToggleEvent for HTMLDetailsElement 2023-09-13 13:45:47 +02:00
Timothy Flynn
f598a357ad LibWeb: Assign a unique ID to each HTML task
And return that ID when queueing an element task. This is required for
some task tracking - specifically, the HTML ToggleTaskTracker struct.
2023-09-13 13:45:47 +02:00
Andrew Kaster
5ae9b2fdaf LibWeb: Add {de}serialization steps for TypedArrayBuffers and DataViews 2023-09-13 08:49:09 +02:00
Andrew Kaster
bddf3fbf2d LibWeb: Make StructuredSerialize/Deserialize friendlier to recursion
Make the internal calls take objects by reference, and take writable
spans into data rather than const& to the underlying vector type.
2023-09-13 08:49:09 +02:00
Sam Atkins
e0fe77d012 LibWeb+headless-browser: Replace ref-test manifest with link tags
Each ref test now links to its reference page with a link tag, in the
same format as WPT:

`<link rel="match" href="reference-page.html" />`

The reference pages have all been moved into a separate `reference/` dir
so that we can just treat every file in `ref/` as a test. There's no
filter to only look at .html files, because we also have a .svg file in
there, and there may be other formats we want to use too. But it's not
too hard to add one if we need it.
2023-09-13 08:48:19 +02:00
Sam Atkins
f3add3dd72 WebContent: Add "load-reference-page" debug request
This attempts to load the URL of the first `<link rel="match" href=""/>`
it finds. If that tag is missing, we load an error page to make sure
the ref-test fails. (And to provide some feedback if someone looks at
the screenshot somehow.) Wrong URLs will instead end up loading the
default 404 error page.
2023-09-13 08:48:19 +02:00
Sam Atkins
7ba686dcb3 LibWeb: Run on_load_start/finish callbacks when loading HTML directly
I need this for the upcoming "load-reference-page" debug request. But it
generally seems like the correct thing to do. :^)
2023-09-13 08:48:19 +02:00
Sam Atkins
cb8c4cd2e6 WebContent: Return once debug_request is handled
The request can only be one string, so once we've matched it, stop
checking all the other possible values. :^)
2023-09-13 08:48:19 +02:00
Tim Ledbetter
9a6927c575 GameOfLife: Ensure BoardWidget can always contain the board
Previously, when there were more rows or columns than the BoardWidget
could contain, nothing was displayed. The BoardWidget minimum size is
now set whenever the number of rows or columns changes.
2023-09-13 07:45:49 +01:00
Tim Ledbetter
871f5ba431 2048: Disable the undo and redo actions when unavailable
This change also ensures that the redo stack is cleared when a move is
made, so that it isn't possible to redo a previous move after having
made a new one.
2023-09-13 07:27:01 +02:00
Shannon Booth
c3e6077cfc LibWeb: Make Document::{visibility,read}_state return a StringView
Also using the visibility state enum to change strcmp to a simple
enum state check :^)
2023-09-13 07:26:35 +02:00
Shannon Booth
49eb3bfb1d LibWeb: Make Document::run_the_document_write_steps take a StringView
Which flows on down into HTMLTokenizer::insert_input_at_insertion_point.
2023-09-13 07:26:35 +02:00
Shannon Booth
827170f6e6 LibWeb: Take a StringView in Document::get_elements_by_class_name
We only ever use the view of the DeprecatedFlyString anyway, so let's
just use a StringView.
2023-09-13 07:26:35 +02:00
Shannon Booth
ec39a5a41a LibWeb: Const qualify Document::number_of_things_delaying_the_load_event 2023-09-13 07:26:35 +02:00
Shannon Booth
e42bda5f19 LibWeb: Make Document::open functions take a StringView
One of these functions doesn't make any use of the arguments at all, and
the other defers to an open helper which already takes a StringView.
2023-09-13 07:26:35 +02:00
Shannon Booth
8ad05fff4a LibWeb: Make Document::set_cookie take a StringView
Enabled by also making the same change to ParsedCookie::parse_cookie :^)
2023-09-13 07:26:35 +02:00
Andrew Kaster
642802d339 LibWeb: Add {de}serialization steps for ArrayBuffers 2023-09-12 22:14:39 +02:00
Andrew Kaster
a527f55768 LibWeb: Create StructuredSerialize helpers for Bytes
Call them from the helpers for strings. We'll have other object classes
soon that need to serialize ByteBuffers, so let's take advantage of the
encoding scheme we are already using for Strings.
2023-09-12 22:14:39 +02:00
Andrew Kaster
56d0a0ac0f LibJS: Make CreateDataByteBlock AO publicly available
At the same time, make CopyDataBlockBytes const-correct.
2023-09-12 22:14:39 +02:00
Andrew Kaster
267074cd81 LibWeb: Add {de}serialization steps for RegExpObjects
We skip serializing any of the internal state of the Regex<ECMA262>
object, because that state is all computable from the input pattern
and flags. If it turns out that this is really, really slow, we can add
some optimizations to serialize more of the regex parse result.
2023-09-12 22:14:39 +02:00
Andrew Kaster
3a74bd2509 LibWeb: Don't try to deserialize past length of strings
If we serialize a string followed by some other object, the deserialize
helper would just happily keep appending bytes to the string until the
end of the serialization buffer. Avoid doing that by checking the string
length for figuring out when the string actually ends.
2023-09-12 22:14:39 +02:00
Aliaksandr Kalenik
63939445b1 LibWeb: Use fit-content width if button's computed width is "auto"
Implements following line from the spec:
"If the computed value of 'inline-size' is 'auto', then the used value
is the fit-content inline size."
2023-09-12 17:26:30 +02:00
Aliaksandr Kalenik
7eee3f6952 LibWeb: Add mutable_computed_values() for NodeWithStyle
This fixes the issue that we previously had to use a gross static_cast
whenever we wanted to mutate computed values outside of the Node
methods.
2023-09-12 17:26:30 +02:00
Andreas Kling
44b2735b9e LibJS: Make line-and-column resolution fast for large minified JS
Instead of caching start-of-line offsets, we now cache byte offsets
at regular intervals. This fixes an issue where we had terrible
performance on large minified JS, since that often means one very,
VERY long line (with no line endings to cache).

My machine was spending ~35ms per stack frame when throwing errors
on some heavy minified websites, and after this patch, we now spend
<1ms per stack frame.
2023-09-12 17:21:42 +02:00
Sam Atkins
ff02de4ad0 LibWeb: Serialize StringStyleValue with quotes
In order to access the string's contents, use the new
`StringStyleValue::string_value()` method.

I think I found all the existing places that relied on
`StringStyleValue::to_string()` returning an unquoted string, but it's
hard to know for sure until things break.
2023-09-12 14:29:21 +01:00
Sam Atkins
77ae510319 LibWeb: Parse each unquoted font-family name as a single CustomIdentSV
Previously we made StringStyleValues from these, but once we start
actually quoting StringStyleValues when serializing them, this will
break the font-family serialization.
2023-09-12 14:29:21 +01:00
Aliaksandr Kalenik
d1e542999c LibWeb: Ensure preceding offset is non-negative in float_box()
When calculating the edge offset of the next floating item based on the
offset of the preceding floating item, we need to ensure that the
preceding offset is always > 0. This isn't explicitly written in the
spec, but all other popular engines do that.

Fixes https://github.com/SerenityOS/serenity/issues/21023
2023-09-12 12:11:53 +02:00
Aliaksandr Kalenik
81ddad3fcf LibWeb: Allow block level boxes to be floated and have clearance
Before, we completely ignored clearance for block-level boxes if they
were floated. This was incorrect because it is valid for a block-level
box to be floated and still have clearance. However, unlike clearance
on normal flow boxes, clearance on floating boxes does not affect the
y-position of subsequent normal flow boxes. Instead, it pushes the
box's position to the very beginning of an edge.

Work towards https://github.com/SerenityOS/serenity/issues/21023
2023-09-12 12:11:53 +02:00
Sam Atkins
489f9c3151 LibWeb: Implement text-transform: math-auto
This is a simple mapping of some code-points to others.

I was going to use a ref test for this, but without knowing that the
font contains the code-points (which SerenitySans does not) we'd be
comparing a series of replacement characters to a series of replacement
characters, which doesn't tell you if they're the right code-points
underneath.
2023-09-11 17:03:22 +01:00
Sam Atkins
ce775ea701 LibWeb: Use a switch to handle TextTransform values
This makes it more obvious that we're missing some of these. (And makes
it easier to find this code when searching for a specific value.)
2023-09-11 17:03:22 +01:00
Sam Atkins
f7209fb9d4 LibWeb: Implement font-size: math
This is a MathML extension, basically a big hack to make parts of
equations smaller, such as sub/superscripts. The important thing is, it
works. :^)
2023-09-11 17:03:22 +01:00
Sam Atkins
6476dea898 LibWeb: Implement the math-depth CSS property
This one is a bit fun because it can be `add(<integer>)` or `auto-add`,
but children have to inherit the computed value not the specified one.
We also have to compute it before computing the font-size, because of
`font-size: math` which will be implemented later.
2023-09-11 17:03:22 +01:00
Sam Atkins
53f3ed026a LibWeb: Mark CalculatedStyleValue::resolve_integer() as const 2023-09-11 17:03:22 +01:00
Sam Atkins
6045143d39 LibWeb: Parse the math-shift and math-style CSS properties
Currently these have no effect, but they're simple, and `math-style`
influences `math-depth` which is coming next.
2023-09-11 17:03:22 +01:00
Sam Atkins
2ef5658f31 LibWeb: Add ComponentValue::is_function(name) and is_ident(name) helpers 2023-09-11 17:03:22 +01:00
Sam Atkins
f3124c492b LibWeb: Add display: math
This is a `<display-inside>` keyword added by the MathML spec, and has
the rough meaning of "display in the default way". It enables the
standard layout rules for each MathML element (and is ignored for
anything that isn't a MathML element).

I believe we'll need an actual MathML formatting context to do the
layout correctly, but we can at least support a couple of elements that
behave the same as HTML ones.
2023-09-11 17:03:22 +01:00
Sam Atkins
125d161b3f LibWeb: Move <display-foo> definitions into Enums.json
This eliminates a fair bit of boilerplate.
2023-09-11 17:03:22 +01:00
Sam Atkins
3b0980c89f LibWeb: Stop allowing invalid tokens in display values
Previously we were overly generous in what we accepted for `display`.
For example, we accepted:
- Multiple outside or inside identifiers
- Unrecognized identifiers
- Non-identifier tokens

Now, we reject all these cases. This makes us stop accepting the
`display: block math;` declaration in `MathML/Default.css`, and so the
one layout test we have containing MathML elements has changed to
reflect that.
2023-09-11 17:03:22 +01:00
Aliaksandr Kalenik
40dea272d2 LibWeb: Add boxes for before/after pseudos post button layout tweak
When a button should use flex for alignment and also has ::before
and/or ::after, we previously did the following:
1. Prepended/appended the button's children with boxes for
   pseudo-elements.
2. Replaced the button's direct children with a flex container that
   contains its children.
As a result, the generated boxes for ::before/::after ended up as
children of the generated flex item, instead of being direct children
of the button layout box as they were supposed to be.

This change reverses these steps, ensuring that boxes for
pseudo-elements are generated only after modifications inside the
button layout are completed.
2023-09-11 15:19:56 +02:00
Aliaksandr Kalenik
0160d921e9 LibWeb: Set children of button layout box to be non-inline
When modifying the button layout during tree building to use flex for
vertical alignment, let's explicitly set the button box's children to
be non-inline. It doesn't make sense to layout the button as an IFC
when its only child is a flex container.
2023-09-11 15:19:56 +02:00
Shannon Booth
b738929195 LibDiff: Fix wrong index used when prepending context lines
`i` is used as the index for 'old lines' in diff generation, not 'new
lines'. Using the wrong index would mean that for certain diffs the
prefixed context information would have wrong content, and could even
result in a crash.

Fix this, and add a test for an input which was previously crashing.
2023-09-11 12:10:50 +01:00
Shannon Booth
4adbf1d041 LibWeb: Port DocumentFragment from DeprecatedString to String 2023-09-11 12:07:36 +01:00
Shannon Booth
bfc0773285 LibWeb: Add String versions for some functions in ParentNode
These functions are required in the porting of the DocumentFragment
interface from DeprecatedString to String. Unfortunately since
ParentNode is used by Document, we can't fully remove the deprecated
versions of these functions yet.
2023-09-11 12:07:36 +01:00
Shannon Booth
3e0849eb4f LibWeb: Add FlyString variants of get_element_by_id
Unfortunately we can't port these functions entirely over to FlyString
from DeprecatedString as Document includes NonElementParentNode and has
not yet been ported over to new AK string. In the mean time, this should
help up in porting over NonElementParentNode itself.
2023-09-11 12:07:36 +01:00
Shannon Booth
b2f3aa1c76 LibWeb: Use length() getter in CharacterData algorithms
Closer matching spec text, as well as pre-existing use in
CharacterData::substring_data. This helps in porting of this file over
to new String which has no length member function.
2023-09-11 12:07:36 +01:00
Sam Atkins
2cb816ad69 LibWeb: Alphabetize property names in Properties.json
And add a check to make sure it stays that way!
2023-09-11 10:42:00 +01:00
Sam Atkins
9f4e057085 LibWeb: Fall back to computed values in ResolvedCSSStyleDeclaration
We only need special-case code to handle two kinds of properties:
- Those with special rules, many of which are listed here:
  https://www.w3.org/TR/cssom-1/#resolved-values
- Shorthands, because we only store longhand values.

In other cases, we can fall back to the computed values that we already
have, and these will be correct. So, we can remove them from here. :^)
2023-09-11 10:42:00 +01:00
Sam Atkins
088cddaca1 LibWeb: Serialize Display values as a "short display" where possible 2023-09-11 10:42:00 +01:00
Jelle Raaijmakers
ec416563a8 Maps: Zoom on doubleclick 2023-09-10 22:45:42 +02:00
Jelle Raaijmakers
0f330a4dcf Maps: Scale cached tiles from lower and higher zoom levels
When zooming in or out, if a tile is not yet cached, Maps now also
checks the lower and higher zoom levels for cached tiles and composites
a preview tile that is shown until the actual tile is loaded in.
2023-09-10 22:45:42 +02:00
Jelle Raaijmakers
cf898f08ab Maps: Limit parallel downloading of tiles
Previously we would bombard RequestServer with as many requests as it
would take, but when frantically zooming in and out, we would run out of
fd's causing the Maps application to hang.

This implements a tile download queue and limits the amount of parallel
downloads to 8. This fixes the hangs accompanied by this debug console
message:

    Peer endpoint error: recvfd: Too many open files (errno=24)

It does not fix other sporadic hangs caused by requests that are never
finished, however.
2023-09-10 22:45:42 +02:00
Bastiaan van der Plaat
494a8cb816 AK: Add to_radians and to_degrees math functions 2023-09-10 08:38:29 +01:00
Liav A
b55199c227 Kernel: Move TTY-related code to a new subdirectory under Devices
The TTY subsystem is represented with unix devices, so it should be
under the Devices directory like the Audio, Storage, GPU and HID
subsystems.
2023-09-09 12:08:59 -06:00
Jakub Berkop
54e79aa1d9 Kernel+ProfileViewer: Display additional filesystem events 2023-09-09 11:26:51 -06:00
kleines Filmröllchen
a0bcc9dd83 LibAudio: Skip empty MP3 scale factor bands in stereo intensity process
These were intentionally set up to be at the end of the granule size,
but since the stereo intensity loop is intentionally using a <= end
comparison (that’s how the scale factor bands work), we must skip these
dummy bands which would otherwise cause an out-of-bounds index.
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
24f5914d18 LibAudio: Prevent overflow in QOA LMS prediction 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
ede8582def LibAudio: Check more FLAC partition order constraints as per the spec 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
dcc3d7bc35 LibAudio: Treat FLAC bps <= wasted_bps as error instead of crash
This can happen with some weird inputs, so instead, return an error; we
need at least one “effective” bit per sample so the bits per sample
cannot be less than or equal to the wasted bits per sample.
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
c776ebcaf6 LibAudio: Only check subframe size if sample rate is constant 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
1bf81f84a0 LibAudio: Perform all seekpoint binary searches with comparisons
One was missed in the previous fix
2023-09-09 11:23:57 -06:00
kleines Filmröllchen
2b61193b71 LibAudio: Account for garbage shifts in several places in FLAC loader 2023-09-09 11:23:57 -06:00
kleines Filmröllchen
b432674923 LibAudio: Prevent overflows during prediction
Saturating arithmetic leads to less screwed up audio in these cases.
2023-09-09 11:23:57 -06:00
Karol Kosek
f789d26e37 LibIMAP+Mail: Rename MultiPartBody's mime_type to multipart_subtype 2023-09-09 11:19:37 -06:00
Karol Kosek
642a3f85ef LibIMAP: Parse body-type-msg to spec 2023-09-09 11:19:37 -06:00
Karol Kosek
4a92d712ea LibIMAP: Don't parse starting space directly in parse_envelope
Makes parse_envelope() look like the defined ABNF rule and the parser
will no longer try to consume double spaces in body-type-msg.
2023-09-09 11:19:37 -06:00
Karol Kosek
e9cf35fd60 LibIMAP: Parse body-ext-1part for every one part body type
Previously we were only doing it only for body-type-text, which isn't
correct to spec.

Fixes a crash when parsing a BODYSTRUCTURE response on a mail with
attachments.
2023-09-09 11:19:37 -06:00
Karol Kosek
a61a66c685 LibIMAP: Simplify parsing one part body structure
Each branch was very similar, so let's merge common parts together for
clarity. Also added corresponding ABNF rules names while I'm here. :^)

No behavior change.
2023-09-09 11:19:37 -06:00
Timothy Flynn
759e07579e LibAudio: Implement PlaybackStream for macOS using Audio Unit framework
https://developer.apple.com/documentation/audiounit

Apple has a number of audio frameworks we could use. This uses the Audio
Unit framework, as it gives us most control over the rendering of the
audio frames (such as being able to quickly pause / discard buffers).
From some reading, we could implement niceties such as fading playback
in and out while seeking over a short (10ms) period. This patch does not
implement such fancy features though.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2023-09-09 13:03:36 -04:00
Timothy Flynn
d0fd34112f LibJS: Remove the now-unused ThrowableStringBuilder 2023-09-09 13:03:25 -04:00
Timothy Flynn
573cbb5ca0 LibJS+LibWeb+WebContent: Stop using ThrowableStringBuilder 2023-09-09 13:03:25 -04:00
Timothy Flynn
54d1f4e234 LibJS: Stop propagating small OOM errors from the Error object 2023-09-09 13:03:25 -04:00
Timothy Flynn
df915f8a98 LibWeb: Add missing return statement to bail from a stream read request
As the spec states, we should invoke the failureSteps and abort.
2023-09-09 13:03:25 -04:00
Timothy Flynn
d1a1ace77a LibJS: Stop propagating small OOM errors from the String object 2023-09-09 13:03:25 -04:00
Timothy Flynn
02a8683266 LibUnicode+LibJS: Stop propagating small OOM errors from normalization
This API only perform small allocations, and is only used by LibJS.
2023-09-09 13:03:25 -04:00
Tim Ledbetter
331991f9c4 find: Allow '+' and '-' prefix for -links and -size options
The presence of this prefix denotes that the value being tested is
strictly greater than or less than the given numeric value.
2023-09-09 11:02:18 -06:00
Konrad Bartecki
773a64aa5a LibWebSocket: Adds capability for receiving fragmented messages 2023-09-09 10:59:59 -06:00
Tim Ledbetter
d277d2e1fb find: Add ! operator to negate the following command 2023-09-09 10:57:17 -06:00
Reza
ffc0046d74 Snake: Replace DeprecatedString with String 2023-09-09 10:50:03 -06:00
Shannon Booth
d312fdc2d3 LibWeb: Port CanvasRenderingContext2D from DeprecatedString to String 2023-09-09 10:47:12 -06:00
Shannon Booth
da1f137967 LibWeb: Port MutationRecord from DeprecatedString to String 2023-09-09 10:47:12 -06:00
Shannon Booth
75133cf733 LibWeb: Port NamedNodeMap from DeprecatedString to String
The conversion which is required here is unfortunately quite ugly, but
in the spirit of making forwards progress, just leave a FIXME for our
future selves to deal with.
2023-09-09 10:47:12 -06:00
Shannon Booth
f5efe9bb63 LibWeb: Port CSSStyleDeclaration from DeprecatedString to String 2023-09-09 10:47:12 -06:00
Aliaksandr Kalenik
df2bc8187c LibWeb: Use actual line height to calculate float y in IFC
Before, we were using the line height from NodeWithStyle::line_height()
 to calculate the y offset for floats inside the IFC. However, this
value doesn't always correspond to the actual height of a line box. For
instance, adding a fragment for an inline-block might change the height
of the line box. With this change, we recalculate the height of the
line box after adding a new fragment and use this recalculated height
value to determine the y position for floats.

Fixes https://github.com/SerenityOS/serenity/issues/20982
2023-09-09 17:05:22 +02:00
Sam Atkins
b1a569c1c5 LibWeb: Stop crashing when textarea element is modified before insertion
If an element is created from JS, it might have its contents modified
before it is inserted into the document. In this case, we don't have a
shadow tree yet and so trying to set m_text_node's text content would
cause a null dereference. So let's not do that. :^)

That case also means that by the time we do create the shadow tree, we
have the text content already, so we can set it there.

Added a test to verify that we don't crash, and that the text content
appears in the textarea whether it was inserted by JS or by the HTML
parser.
2023-09-09 13:52:01 +01:00
Zaggy1024
883f44d397 LibWeb: Use CSSPixels only when calculating radial gradient sizes
In order to do this, a function `sqrt(CSSPixels)` was added, which
currently just converts to floating point to run `AK::sqrt()`.
2023-09-09 13:03:11 +02:00
Zaggy1024
d9c842a83f LibWeb: Set radial gradients' ending shape corners correctly
Previously, the corner was always set to the top right, except if the
top left turned out to be closest, in which case it would be left
default-initialized instead.
2023-09-09 13:03:11 +02:00
Zaggy1024
0e78037c68 LibWeb: Use fractions to calculate font absolute size mappings
This also brings us closer to spec by changing the fractional scaling
to use division instead of hard-coded decimal numbers.
2023-09-09 13:03:11 +02:00
Zaggy1024
c9849aeadd LibWeb: Use a switch instead of HashMap to get absolute size mappings
A `HashMap` is unnecessary complexity for such a small set of possible
keys, let's let the optimizer actually understand what's happening.
2023-09-09 13:03:11 +02:00
Zaggy1024
f57c42fad7 LibWeb: Avoid conversion from floating point in CSS position resolution
We can just use division here, since fixed-point division by 2 will
compile down to a shift by 1.
2023-09-09 13:03:11 +02:00
Zaggy1024
99c90e49b6 LibWeb: Calculate viewport-relative lengths in CSSPixels 2023-09-09 13:03:11 +02:00
Zaggy1024
fc05cda8cf LibWeb: Make division of CSSPixels by integers create a fraction
This also adds some additional operators to `CSSPixelsFraction` to
allow this change to build, since some places were using equations like
`(a / b) + (c / d)` or `-(x / y)`.
2023-09-09 13:03:11 +02:00
Zaggy1024
607a398917 LibWeb: Store computed CSS font size as CSSPixels
The value is originally set using a `CSSPixels` value converted to
double, then when it is used it is always converted back to a
`CSSPixels` again. Let's just store it as that instead.
2023-09-09 13:03:11 +02:00
Zaggy1024
d792461714 LibWeb: Use Integral concept for CSSPixels operators
These were previously manually overloaded, which is unnecessary when we
can just use a concept to cover everything!
2023-09-09 13:03:11 +02:00
Sam Atkins
9e227dfc16 LibWeb: Flesh out HTMLTextAreaElement
Give it a shadow tree, similar to HTMLInputElement's, so that we can
actually edit its contents at a basic level. Add some CSS to use the
`rows` and `cols` attributes as the size if they are present.
2023-09-09 07:45:05 +02:00
Sam Atkins
4897643ffb LibWeb: Allow non-HTMLInputElements to have did_edit_text_node() called
HTMLTextAreaElement also needs to be told when its contained text node
has been edited, so let's make this functionality work for anyone who
extends the new EditableTextNodeOwner interface class.
2023-09-09 07:45:05 +02:00
nipos
b258450fa6 LibCore: Implement waiting for the debugger on FreeBSD 2023-09-07 14:30:11 -06:00
Aliaksandr Kalenik
0f75d0611f LibWeb: Implement support for parsing CSS column-count property 2023-09-07 20:16:33 +02:00
Ali Mohammad Pur
84777fbe62 Shell: Allow the user to set the prompt using PROMPT()
This allows the prompt to be dynamically configurable, making it
possible to display various bits of information in the prompt.
2023-09-07 11:52:37 -06:00
Tim Ledbetter
71ddc33fbf find: Print hyperlinks when standard output is attached to a terminal 2023-09-07 11:52:09 -06:00
Liav A
446200d6f3 Kernel+Services: Enable barebones hot-plug handling capabilities
Userspace initially didn't have any sort of mechanism to handle
device hotplug (either removing or inserting a device).
This meant that after a short term of scanning all known devices, by
fetching device events (DeviceEvent packets) from /dev/devctl, we
basically never try to read it again after SystemServer initialization
code.

To accommodate hotplug needs, we change SystemServer by ensuring it will
generate a known set of device nodes at their location during the its
main initialization code. This includes devices like /dev/mem, /dev/zero
and /dev/full, etc.

The actual responsible userspace program to handle hotplug events is a
new userspace program called DeviceMapper, with following key points:
- Its current task is to to constantly read the /dev/devctl device node.
  Because we already created generic devices, we only handle devices
  that are dynamically-generated in nature, like storage devices, audio
  channels, etc.

- Since dynamically-generated device nodes could have an infinite minor
  numbers, but major numbers are decoded to a device type, we create an
  internal registry based on two structures - DeviceNodeFamily, and
  RegisteredDeviceNode. DeviceNodeFamily objects are attached in the
  main logic code, when handling a DeviceEvent device insertion packet.
  A DeviceNodeFamily object has an internal HashTable to hold objects of
  RegisteredDeviceNode class.

- Because some device nodes could still share the same major number (TTY
  and serial TTY devices), we have two modes of allocation - limited
  allocation (so a range is defined for a major number), or infinite
  range. Therefore, two (or more) separate DeviceNodeFamily objects can
  can exist albeit sharing the same major number, but they are required
  to allocate from a different minor numbers' range to ensure there are
  no collisions.

- As for KCOV, we handle this device differently. In case the user
  compiled the kernel with such support - this happens to be a singular
  device node that we usually don't need, so it's dynamically-generated
  too, and because it has only one instance, we don't register it in our
  internal registry to not make it complicated needlessly.

The Kernel code is modified to allow proper blocking in case of no
events in the DeviceControlDevice class, because otherwise we will need
to poll periodically the device to check if a new event is available,
which would waste CPU time for no good reason.
2023-09-07 11:50:50 -06:00
Liav A
9dbd22b555 SystemServer: Make decision on whether to enable a service more readable
This change ensures that code in the Service class doesn't try to check
the g_system_mode variable, but instead is asked on whether it supports
a given system mode string value.

Also, don't assume that we should create sockets for any new Service
instance, but instead do that only if the Service should run in the
current system mode.
2023-09-07 11:50:50 -06:00
Liav A
41db527369 LibCore: Add helpers to create block and character device files 2023-09-07 11:50:50 -06:00
Liav A
0c14a2aba7 SystemServer: Organize initialization sequence into logical units
Just a small cleanup to ensure we can get these pieces of code out to
other files and still have the main.cpp file organized.

The populate_devtmpfs_char_devices_based_on_sysfs() method is removed
because we can simply create the /dev/devctl device node without looking
at the SysFS. This assumed-to-exist device node will be used later on in
an event loop to handle hotplug events.
2023-09-07 11:50:50 -06:00
kamp
74d15195a4 HexEditor: Replace DeprecatedString in HexEditor.cpp 2023-09-07 09:58:00 -06:00
kamp
7a2ad83c07 HexEditor: Replace DeprecatedString in ValueInspectorModel 2023-09-07 09:58:00 -06:00
kamp
4b87714700 HexEditor: Replace DeprecatedString in SearchResultsModel
Except one instance where it is required for interfacing with LibGUI

Also changed an instance of west const to east because the clang-format
commit hook required it.
2023-09-07 09:58:00 -06:00
kamp
81afa029ac HexEditor: Replace DeprecatedString in FindDialog 2023-09-07 09:58:00 -06:00
kamp
f38cf0ca18 HexEditor: Replace DeprecatedString in GoToOffsetDialog 2023-09-07 09:58:00 -06:00
Aliaksandr Kalenik
b4fe118dff LibWeb+WebContent: Set ConsoleClient for nested browsing contexts
Before page_did_create_main_document() only initialized ConsoleClient
for top-level browsing context which means that nested browsing context
could not print into the console.

With this change, ConsoleClient is initialized for documents created
for nested browsing context too. One ConsoleClient is shared between
all browsing contexts within the same page.
2023-09-07 09:06:00 -06:00
Sergey Bugaev
6d18ec7546 LibTest: Don't attempt to use SA_NOCLDWAIT for SIGABRT
SA_NOCLDWAIT is only meaningful for SIGCHLD.

Fixes building on the Hurd, which lacks SA_NOCLDWAIT.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
976d93d910 LibDNS: Fix compilation with signed time_t
With signed 32-bit time_t, the type of time_t + m_ttl is unsigned int,
which results in -Werror=sign-compare. Fix this by explicitly casting
it back to time_t.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
fcced97509 LookupServer: Fix building on GNU Hurd
The Hurd has sin_len, just like the BSDs.

This happened to hit a clang-format bug, and we have been advised
to disable clang-format for this block of code for now.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
29da1d7c23 LibCore: Implement readlink() and current_executable_path() on GNU/Hurd
Without using PATH_MAX :^)

To read a symlink, we can just open its file with O_NOLINK and read its
contents. To get the executable path, we could read the /proc/self/exe
link like the Linux version does; but that relies on procfs being
mounted. Instead, we could do what procfs itself does to get the path:
ask the proc server about it.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
cee38cf1e5 LibCore: Use SHM_ANON for anon_create() when available
On FreeBSD and GNU/Hurd, SHM_ANON is a nice way to create anonymous
files using the usual shm_open() API. This is a lot like the fallback
shm_open() branch that follows, except we don't have to fool around
with choosing a unique name (with retrying) and unlinking the file
afterwards; it just does the right thing. Isn't this nice?
2023-09-06 11:41:16 -06:00
Sergey Bugaev
ec68979483 LibCore: Implement Process::is_being_debugged() on GNU/Hurd
This checks for the PI_TRACED bit being set in the info returned by
proc_getprocinfo().
2023-09-06 11:41:16 -06:00
Sergey Bugaev
bba193d6a0 Tests, LibTest: Implement disabling core dumps on GNU Hurd 2023-09-06 11:41:16 -06:00
Sergey Bugaev
f31df017f9 LibCore: Port Socket to GNU Hurd
The Hurd supports sending file descriptors over local sockets using
the SCM_RIGHTS / cmsg mechanism just like the other systems. It doesn't
have anything like ucred/PEERCRED, though.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
79431b32b2 AK: Add AK_OS_GNU_HURD :^)
This is defined when building on GNU/Hurd, the GNU operating system with
the Hurd as its kernel (as it was designed originally, before Linux and
GNU/Linux came to be).

Also, define the corresponding part of User-Agent.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
e6cf125535 Utilities: Fix building ntpquery without SO_TIMESTAMP
If SO_TIMESTAMP is unsupported, we won't be able to determine
kernelspace-to-userspace latency. But other than that, things should
still build and work.

(It's a separate question of what "kernelspace-to-userspace latency"
even means on a microkernel system, where the network card drivers, the
network stack, and ntpquery(1) are all running as userspace programs.)

Also, don't fail completely if settting receive timeout fails.
2023-09-06 11:41:16 -06:00
Sergey Bugaev
7cb765173c LibELF: Fix building without PTHREAD_STACK_MIN defined
It may or may not be defined according to Dr. POSIX.
Also, sneak in a little fix for passing a 64-bit value into a
size_t-typed argument.
2023-09-06 11:41:16 -06:00
Shannon Booth
76449c21b2 LibWeb: Port TextEncoder interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
278061e8b9 LibWeb: Port TextDecoder interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
41928c2902 LibWeb: Port DOMException interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
bcb6851c07 LibWeb: Port Text interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
6789a2dd8e LibWeb: Port ShadowRoot interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
0ce5a920f7 LibWeb: Port MutationObserver interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
8531d11fab LibWeb: Port DOMParser interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Shannon Booth
cc1e4c5cb3 LibWeb: Port Comment interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Andreas Kling
4da1f4e836 LibWeb: Make FontPlugin::generic_font_name() return FlyString 2023-09-06 11:29:03 -04:00
Andreas Kling
13db3c5ce0 LibGfx: Convert FontDatabase APIs to use FlyString 2023-09-06 11:29:03 -04:00
Andreas Kling
545d8336b8 LibGfx: Convert Font APIs to return String instead of DeprecatedString 2023-09-06 11:29:03 -04:00
Ali Caglayan
1ee3ec16a9 Userland: Fix absolute paths in man page links
Absolute paths in man page links such as

```
[some link](/foo/bar)
```

Were being interpreted as relative paths when rendered in HTML. This
issue was observed in #20889 and #20041.

The fix is to make sure we don't leave any absolute paths when parsing
links. Instead we check if a directory is absolute (by checking for `/`)
and add `file://` accordingly. This turns the above link into:

```
[some link](file:///foo/bar)
```

Which does get interpreted correctly when rendered as HTML.

- fixes #20889
- fixes #20041

Before this patch, opening the Help application would raise an error.
Now all the pictures in the man pages render correctly.
2023-09-06 15:02:44 +01:00
Sergey Bugaev
8ebddc1ff6 LibGfx: Misc 32-bit build fixes 2023-09-06 07:21:07 -06:00
Sergey Bugaev
79022090bf LibWeb: Add CSSPixels operator overloads for unsigned int
Fixes building on 32-bit, where using operators with size_t (aka
unsigned int) results in ambiguity between the overloads for int
and unsigned long.
2023-09-06 07:21:07 -06:00
Sergey Bugaev
b21382bd4e LibWeb: Set CPU_STRING for i386 2023-09-06 07:21:07 -06:00
Sergey Bugaev
de6664c0cb LibTimeZone: Replace PATH_MAX usage with heap allocation 2023-09-06 07:14:35 -06:00
Sergey Bugaev
ae10d085ba LibFileSystem: Replace PATH_MAX usage with heap allocation 2023-09-06 07:14:35 -06:00
Sergey Bugaev
4825919bcf AK, LibCore: Enable misc things on glibc
program_invocation_name, pthread_getattr_np(), EXECINFO_BACKTRACE are
all glibc specifics (that other libcs may also have).
2023-09-06 07:14:35 -06:00
Shannon Booth
c4f12feadc LibWeb: Port CanvasGradient interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
2c69f273a0 LibWeb: Port HTMLElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
938356da98 LibWeb: Port HTMLInputElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
f4bc1602e2 LibWeb: Port HTMLMediaElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
e5910a4593 LibWeb: Port HTMLAnchorElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
76af9d434c LibWeb: Port HTMLCanvasElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
7206f1777a LibWeb: Port HTMLOptionElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
c405ba6b08 LibWeb: Port HTMLBaseElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
2a732e6ddd LibWeb: Port HTMLFormElement interface from DeprecatedString to String
Leaving a FIXME for HTMLFormElement::method as it looks like this could
be Reflect in the IDL.
2023-09-05 20:36:09 -04:00
Shannon Booth
63aa93aaf4 LibWeb: Port HTMLObjectElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
de07fb5132 LibWeb: Port HTMLAreaElement interface from DeprecatedString to String
Which required HTMLHyperlinkElementUtils to also be changed to support
this.
2023-09-05 20:36:09 -04:00
Shannon Booth
57d8b0ec73 LibWeb: Port HTMLButtonElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
2ab7129595 LibWeb: Port HTMLScriptElement interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Shannon Booth
6fb3586baa LibWeb: Add Optional<String> version of Element::attribute
As a non-deprecated alternative to DeprecatedString Element::attribute.
2023-09-05 20:36:09 -04:00
Shannon Booth
0f6782fae6 LibWeb: Rename Element::attribute to Element::deprecated_attribute
This should allow us to add a Element::attribute which returns an
Optional<String>. Eventually all callers should be ported to switch from
the DeprecatedString version, but in the meantime, this should allow us
to port some more IDL interfaces away from DeprecatedString.
2023-09-05 20:36:09 -04:00
Shannon Booth
da637a527d LibWeb: Port CSSStyleSheet interface from DeprecatedString to String 2023-09-05 20:36:09 -04:00
Bastiaan van der Plaat
f1742ae1b9 LibWeb: Add DOMMatrix flipX and flipY 2023-09-05 20:30:36 +02:00
Bastiaan van der Plaat
fc380bf516 LibWeb: Add DOMMatrix skewX and skewY 2023-09-05 20:30:36 +02:00
Jelle Raaijmakers
b21ca0d04e Maps: Add pledge and unveils 2023-09-05 20:16:05 +02:00
Aliaksandr Kalenik
8d05ff1fe7 LibWeb: Print FIXME if vertical-align value is not supported in TFC
Producing incorrect layout for table cells is better than crashing :)
2023-09-05 16:51:25 +02:00
Michal Grich
331a19efe8 Calendar: Save time of the event and display it in Calendar
This PR introduces the ability to save calendar event times
and adds functionality for displaying saved times in the calendar.
Additionally, it addresses the issue where changes to the time
value in the dropdown were not being saved.
2023-09-05 15:08:42 +01:00
Zaggy1024
98926b487c LibWeb: Perform rounding when dividing CSSPixels
This should allow us to produce results that more closely match old
layouts when divisions were done in floating-point.
2023-09-05 14:50:45 +02:00
Zaggy1024
bd85e1b30b LibWeb: Entirely and exactly distribute grids' extra space to tracks
Previously, the code assumed that in dividing up the space in the
affected tracks there would never be an overshoot. Instead, we can
check for each track how much extra space is left and never consume any
extra.

In the same way, we can ensure that all extra space is consumed by
distributing all remaining extra space starting from the first track.
Thus, if there is no growth limit, the space distribution should always
consume all the extra space.
2023-09-05 14:50:45 +02:00
Zaggy1024
eb7c2ee307 LibWeb: Limit affected size of grid tracks instead of only increase
The spec says that the sum of affected size + item-incurred increase
should reach the limit, rather than just the item-incurred increase.

This seems to improve layout on the testcase `row-span-2-with-gaps`.
The extra line of space at the bottom of the left div
(`div.grid-item.item-span-two`) is not present anymore, matching other
browsers' layout much more closely.
2023-09-05 14:50:45 +02:00
Sam Atkins
07039af982 LibWeb: Implement attr() types :^)
Support the optional `<attr-type>` parameter to the `attr()` function,
which allows parsing the attribute's value as a variety of types,
instead of always as a string.
2023-09-05 14:27:23 +02:00
Sam Atkins
6f45df5ced LibWeb: Add more CSS Token factory methods
The way we currently deal with `attr()` means having to manufacture
Tokens, so we need a way to do that from StyleComputer.
2023-09-05 14:27:23 +02:00
Sam Atkins
9735f474a2 LibWeb: Extract attr() substitution into its own method
No functional changes.
2023-09-05 14:27:23 +02:00
Sam Atkins
7d10484660 LibWeb: Move UnresolvedStyleValue resolution into the CSS Parser
Resolving typed `attr()` functions is going to involve using more
internal Parser methods, so this is the simplest solution for that.
Also... resolving these is basically parsing them, so it makes more
sense for that process to live here.

This is just moving code, with minimal changes so it still works.
2023-09-05 14:27:23 +02:00
Sam Atkins
cab8b3e180 LibWeb: Move a FIXME comment where it belongs
`var()` is now handled in  `expand_variables()`, so let's have the FIXME
where it applies to the entire process.
2023-09-05 14:27:23 +02:00
Sam Atkins
733ad57f39 LibWeb: Expose Parser::Function name as FlyString const&
This saves us from having to re-convert the StringView back to a
FlyString again when resolving UnresolvedStyleValues.
2023-09-05 14:27:23 +02:00
Sam Atkins
e9b58ff096 LibWeb: Move check for CSS-wide keywords to ValueID.h
This feels like a better home for it. The new name better reflects the
spec phrasing.
2023-09-05 14:27:23 +02:00
Andreas Kling
e013306df8 LibWeb: Allow font-size: 0
Zero is a valid font-size value, and should result in no text being
visible. We now match the behavior of other engines.
2023-09-05 14:23:35 +02:00
Andreas Kling
6a32634440 LibGfx: Don't crash on Typeface::get_font() with size 0
If someone wants a zero-sized font, we can just give it to them instead
of making a fuss.
2023-09-05 14:23:35 +02:00
Andreas Kling
589a1e9325 LibWeb: Propagate font-size & line-height into generated table boxes
The final used values for these properties is stored in the layout node,
so we need to make sure they are propagated there as well when doing
table box fixup.
2023-09-05 14:23:35 +02:00
Cubic Love
8eb10b135d Maps: Add Application Icons
Add 16px and 32px application icons for Maps
2023-09-05 14:13:32 +02:00
Timothy Flynn
bc5b7aeffb Ladybird: Hide the WebDriver-to-WebContent IPC path from the help menu
This is never meant to be passed by a human, it is created and passed by
WebDriver only. Hide it from the --help menu to avoid confusion.
2023-09-05 06:51:16 -04:00
Timothy Flynn
b6835d2c40 LibJS: Stop propagating small OOM errors from Intl.RelativeTimeFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
b3694653a7 LibJS: Stop propagating small OOM errors from Intl.NumberFormat
Note this also does the same for Intl.PluralRules. The only OOM errors
propagated from Intl.PluralRules were from Intl.NumberFormat.
2023-09-05 08:08:09 +02:00
Timothy Flynn
30a812b77b LibJS: Stop propagating small OOM errors from Intl.MathematicalValue 2023-09-05 08:08:09 +02:00
Timothy Flynn
746ce6f9a1 LibJS: Stop propagating small OOM errors from Intl.Locale 2023-09-05 08:08:09 +02:00
Timothy Flynn
9e5055c298 LibJS: Stop propagating small OOM errors from Intl.ListFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
76b5974f08 LibJS: Stop propagating small OOM errors from the Intl namespace object 2023-09-05 08:08:09 +02:00
Timothy Flynn
20aaa2c236 LibJS: Stop propagating small OOM errors from Intl.DurationFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
b78cbf88db LibJS: Stop propagating small OOM errors from Intl.DateTimeFormat 2023-09-05 08:08:09 +02:00
Timothy Flynn
1708c1fdfe LibJS: Stop propagating small OOM errors from Intl.Collator 2023-09-05 08:08:09 +02:00
Timothy Flynn
b6ff25bd26 LibJS: Stop propagating small OOM errors from Intl abstract operations 2023-09-05 08:08:09 +02:00
Andreas Kling
c24d317d8f LibWeb: Remove some unnecessary static_casts to Layout::Box&
UBSAN flagged one of these as invalid, and since it's not even necessary
to cast here anymore, let's just not.
2023-09-04 18:22:59 +02:00
Andreas Kling
1434721247 LibWeb: Relax restrictions on LayoutState::get() input type
Instead of only letting NodeWithStyleAndBoxModelMetrics (and subclasses)
have used values in the layout state, we now allow any NodeWithStyle.
2023-09-04 18:22:59 +02:00
Andreas Kling
9577cd853a LibWeb: Use JS::MarkedVector while parsing CSS keyframe rules
We need to be sure they are marked in case the GC runs while we're
in the CSS parser.
2023-09-04 18:22:59 +02:00