Commit graph

27810 commits

Author SHA1 Message Date
Andreas Kling 1be4cbd639 AK: Make Utf8View constructors inline and remove C string constructor
Using StringView instead of C strings is basically always preferable.
The only reason to use a C string is because you are calling a C API.
2021-09-18 19:54:24 +02:00
Andreas Kling 291dbff2e1 LibWeb: Remove the unused LayoutTreeModel
If we want to bring back this functionality, we'll have to rewrite it
for multi-process mode anyway.
2021-09-18 19:54:24 +02:00
Brian Gianforcaro aa118642aa Lagom/Fuzzers: Add fuzzer for the LibCrypto PEM parser 2021-09-18 17:15:08 +00:00
Brian Gianforcaro 4f5d71b4e8 Lagom/Fuzzers: Add fuzzer for the LibTLS ASN1 parser 2021-09-18 17:15:08 +00:00
Liav A 3f5a6be69f Documentation: Add the new supported RTL8168 variants to the list 2021-09-18 17:49:24 +03:00
Liav A 23ef46f4f7 Kernel/Net: Enable usage of RTL8168E and RTL8168H in RTL8168 driver
I tested both (version 15 and 30 of the RTL8168 chipset) with PCI-
passthrough of these cards, and they seem to work just fine with the
driver.
2021-09-18 17:49:24 +03:00
Liav A 86fa5d71c0 Kernel/Memory: Add more super pages to satisfy contiguous allocations
When testing the RTL8168 driver, it seems we can't allocate super pages
anymore. Either we expand the super pages range, or find a solution to
dynamically expand the range (or let drivers utilize other ranges).
2021-09-18 17:49:24 +03:00
Itamar a27716846f HackStudio: Make sure Window is destroyed before Application object
We previously stored the Window object in a global RefPtr (for no
apparent reason).

This led to a use-after-free bug in the Window's destructor when
HackStudio was exited via the Quit action (Exiting by closing the
window did not trigger this bug).
2021-09-18 16:45:50 +02:00
Tobias Christiansen d104885757 LibWeb: Flexbox: Assume Block when finding max main size of flex-column
This is a hack, but it seems to do quite okay.

What we should do is to find the largest size the Box could want in its
main axis. To do that we have to layout the Box according to the needed
LayoutMode. For flex-rows we do as requested and try to make the Box as
wide as we want.
However, for flex-columns we simply assume the Box is a Block and we
calculate their height according to this.
2021-09-18 15:50:47 +02:00
Tobias Christiansen ddb7402649 LibWeb: Also avoid setting definite size for height
This patch patches ef22a1b to also check for is_auto() on the height
property when setting definite_height.
2021-09-18 15:50:47 +02:00
Andrew Kaster aed56b46d4 Documentation: Update Lagom ReadMe with new fuzzer build instructions 2021-09-18 16:38:59 +03:00
Liav A d19bd59e28 Kernel/Storage: Tidy up RamdiskDevice class 2021-09-18 15:05:51 +03:00
Linus Groh f90d98aef0 LibJS: Update step order in the InterpretTemporalDateTimeFields AO
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/be88667
2021-09-18 13:38:48 +02:00
Andreas Kling 99f9667e5d LibWeb: Simplify ComputedCSSStyleDeclaration property lookup
Factor out the per-property StyleValue generation to a separate function
so we don't have to repeat ourselves so much in property(). :^)
2021-09-18 13:14:40 +02:00
Andreas Kling 1735d978ed LibWebSocket: Use deferred_invoke() when discarding a connection
We don't want to destroy the WebSocketImpl while we're still using it
higher up the stack. By using deferred_invoke(), we allow the stack
to unwind before actually destroying any objects.

This fixes an issue with the WebSocket service crashing on immediate
connection failure.
2021-09-18 12:57:58 +02:00
Andreas Kling f82c4c4137 LibWebSocket: Fix confusion about sizeof(size_t) on 64-bit platforms
sizeof(size_t) is 8 on 64-bit platforms, not 64.
2021-09-18 12:51:31 +02:00
Andreas Kling 00895a5789 LibWebSocket: Fix a handful of clang-tidy warnings in WebSocket.{cpp,h} 2021-09-18 12:48:34 +02:00
Andreas Kling 4e47e6d578 LibWeb: Use floating-point math for border-radius rendering
We're still limited by Gfx::Painter here, but we can at least do most
of the LibWeb things in floating-point math.
2021-09-18 12:21:42 +02:00
Andreas Kling f6a2d6af0b LibGfx: Add Point<T>::to_rounded<U>() 2021-09-18 12:21:42 +02:00
Mustafa Quraish 441e601689 ClipboardHistory: Listen for configuration changes
Resize the clipboard history size dynamically by listening for config
changes. This is currently not ideal since we don't have the callbacks
for `Config::Listener::config_i32_did_change`, so for now we are just
taking the string and attempting to convert it to an int.
2021-09-18 03:33:25 +00:00
Mustafa Quraish b1a3bb638b ClipboardHistory: Use config file to set number of history items
The number of items in history was hardcoded to 20 earlier, now
we try to load this value from a config file. The default if none
is available is still 20.
2021-09-18 03:33:25 +00:00
Tim Schumacher b9979e9a59 LibC: Implement most langinfo values mentioned in POSIX 2021-09-18 03:12:58 +00:00
Tim Schumacher b8c756a53a LibC: Primitively implement wcscoll
At the moment, sorting like LC_COLLATE=C would do is better than
nothing.
2021-09-18 02:57:56 +00:00
Jean-Baptiste Boric 8043fcd466 LibC: Don't format strings when asserting with an unstable heap
If we hit an assertion while the heap isn't in a stable state, we can't
rely on dynamic memory allocation because the malloc mutex is already
held and the heap is most likely corrupted. Instead, we need to bail
out fast before we make the situation even worse.
2021-09-18 01:35:11 +00:00
Andreas Kling e215580147 LibWeb: Don't attempt to run unparsed scripts 2021-09-18 01:39:59 +02:00
Andreas Kling 0bb680bacd LibWeb: Remove bogus offset when painting an SVG <path> box 2021-09-18 01:39:59 +02:00
Andreas Kling 684f7cca9f LibWeb: Implement very naive layout of <path> within <svg> 2021-09-18 01:39:59 +02:00
Andreas Kling 7ac889e533 LibWeb: Add a bare-bones SVG <g> element 2021-09-18 01:39:59 +02:00
Andreas Kling 92c08ad4ac LibWeb: Add SVGFormattingContext to handle SVG box trees
Instead of trying to layout SVG boxes as if they are regular CSS boxes,
let's invent an "SVG formatting context" and let it manage SVG boxes.

To facilitate this, Layout::SVGBox no longer inherits from ReplacedBox,
and is instead a simple, "inline-block" style BlockBox.
2021-09-18 01:39:59 +02:00
Andreas Kling 4417f26d7c LibWeb: Make SVG boxes red in layout tree dumps 2021-09-18 01:39:59 +02:00
Tim Schumacher 42031f026a LibC: Implement towctrans 2021-09-17 22:59:51 +00:00
Tim Schumacher 8c7b566629 LibC: Implement iswctype 2021-09-17 22:59:51 +00:00
Tim Schumacher ff0ab8b9a9 LibC: Implement wctrans 2021-09-17 22:59:51 +00:00
Tim Schumacher 7b17230d7a LibC: Implement wctype 2021-09-17 22:59:51 +00:00
Tim Schumacher ac406c8d0e LibC: Change wctrans_t to be a long instead of int*
The POSIX manpage just says that wctrans_t should be "a scalar type that
can hold values which represent locale-specific character mappings", and
doing switch statements with ints is much more pleasant than with
pointers.
2021-09-17 22:59:51 +00:00
Tobias Christiansen 2f891fd4b8 LibWeb: Flexbox: Take parent's width in the flex container for layouting
If our parent in the FlexFormattingContext also was a flex-container, we
didn't give our children any meaningful width to play with into
layout_inside(), which resulted in way too narrow layouting.
Now the width of the parent gets borrowed if the own width isn't
specified.
2021-09-17 23:51:03 +02:00
Tobias Christiansen 3cc6ffd4a6 LibGfx: Don't crash on request to draw impossible circle segment
The previous VERIFY_NOT_REACHED() could be reached when there were equal
coodinates. This could be the case for a small radius which lead to
rounding making the two coordinates equal.
2021-09-17 23:51:03 +02:00
Marcus Nilsson 401ea85655 Magnifier: Add 8x magnification and pausing
This adds an option for even more magnification, when you really need to
count pixels, as well as pausing the capture by pressing Space and
switching between magnification levels with keys 2, 4 & 8.
2021-09-17 23:48:42 +02:00
Linus Groh 6bdd62b51b LibJS: Convert Now AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Linus Groh d764f1c699 LibJS: Convert PlainDateTime AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Linus Groh 35bba1c98d LibJS: Convert PlainDate AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Ali Mohammad Pur 433725fef2 LibGfx: Implement cubic bezier curves by splitting them to subcurves
This makes them significantly more nicer-looking, and fixes a FIXME :^)
2021-09-18 02:12:38 +04:30
Ali Mohammad Pur 02d949cfb6 LibGfx: Switch Painter.{h,cpp} to use east-const 2021-09-18 02:12:38 +04:30
Ali Mohammad Pur 5a2e7d30ce LibWeb: Use Gfx::AntiAliasingPainter to draw SVG paths
This is still quite bad, but it's much more pleasing to look at when
drawing random SVGs :^)
2021-09-18 02:12:38 +04:30
Ali Mohammad Pur e2cd558101 LibGfx: Start a very basic anti-aliased Painter implementation
This can currently draw AA lines (and by proxy, AA paths), and passes
all its output through a 2D affine transform to an underlying
Gfx::Painter.
2021-09-18 02:12:38 +04:30
Sam Atkins f4ea235a33 LibWeb: Replace hard-coded defaults in Node::apply_style()
This now uses the values in `InitialValues`, which is not ideal, but
it's better to have our defaults defined in two places, than in 3.

The default for `border-colors` is `currentcolor`, so we shortcut that
here and just grab the value of the `color` property. As noted, this is
not perfect, but it's somewhat better.
2021-09-17 23:06:45 +02:00
Sam Atkins 0053314dd1 LibWeb: Use initial values from Properties.json inside CSS Parser
This replaces several hard-coded initial values, with use of
`property_initial_value()`.
2021-09-17 23:06:45 +02:00
Sam Atkins 4f81cb927a LibWeb: Correct some initial values and add missing ones
- The `text-decoration-foo` values now match the spec.
- Added values for `border-foo` since those are needed soon.
- Make `color`'s initial value be `-libweb-palette-base-text`.
2021-09-17 23:06:45 +02:00
Sam Atkins fc11b1f242 LibWeb: Add some more CSS identifiers
These are used by the "initial" values in Properties.json
2021-09-17 23:06:45 +02:00
Sam Atkins 6ea9edf84b LibWeb: Generate shorthand initial values after their longhands
When parsing shorthand values, we'd like to use
`property_initial_value()` to get their longhand property values,
instead of hard-coding them as we currently do. That involves
recursively calling that function while the `initial_values` map is
being initialized, which causes problems because the shorthands appear
alphabetically before their longhand components, so the longhands aren't
initialized yet!

The solution here is to perform 2 passes when generating the code,
outputting properties without "longhands" first, and the rest after.
This could potentially cause issues when shorthands have multiple
levels, in particular `border` -> `border-color` -> `border-left-color`.
But, we do not currently define a default value for `border`, and
`border-color` takes only a single value, so it's fine for now. :^)
2021-09-17 23:06:45 +02:00