Commit graph

53730 commits

Author SHA1 Message Date
Andreas Kling
69a81243f5 LibWeb: Consider system fonts when looking for inexact weight match
Previously, we only considered loaded (web) fonts.
2023-08-17 20:32:21 +02:00
Andreas Kling
4bb907aa22 LibWeb: Only propagate overflow from document element when it exists 2023-08-17 20:32:21 +02:00
Aliaksandr Kalenik
e9a718ff88 LibWeb/Layout: Replace INFINITY with CSSPixels::min() or max() 2023-08-17 20:03:13 +02:00
Aliaksandr Kalenik
f2a15ecea7 LibWeb/Layout: Replace isfinite() with might_be_saturated()
Since we switched to using fixed-point math for CSSPixels, it cannot
represent infinite values, so we need to check if the value is
saturated instead.
2023-08-17 20:03:13 +02:00
Sam Atkins
c40e441894 LibWeb: Move CSS ParsingContext to its own header
The implementation is already its own file, so having the class defined
in Parser.h feels weird.
2023-08-17 19:39:10 +02:00
Sam Atkins
f176e04323 LibWeb: Move CSS::Parser::Dimension class to a separate file 2023-08-17 19:39:10 +02:00
Sam Atkins
199a931da1 LibWeb: Move gradient parsing code to a separate file 2023-08-17 19:39:10 +02:00
Sam Atkins
8e5b2907f6 LibWeb: Move selector parsing code to a separate file 2023-08-17 19:39:10 +02:00
Sam Atkins
1d6c2cb287 LibWeb: Move media-query parsing code to separate file
Parser.cpp is big and complicated enough to make CLion sluggish and
unhappy, so let's move some code out of it.
2023-08-17 19:39:10 +02:00
Aliaksandr Kalenik
24edb7c97f Ladybird, WebContent: Add option in debug menu to output GC graph dump 2023-08-17 18:27:02 +02:00
Aliaksandr Kalenik
0ff29349e6 LibJS: Add GC graph dumper
This change introduces a very basic GC graph dumper. The `dump_graph()`
function outputs JSON data that contains information about all nodes in
the graph, including their class types and edges.

Root nodes will have a property indicating their root type or source
location if the root is captured by a SafeFunction. It would be useful
to add source location for other types of roots in the future.

Output JSON dump have following format:
```json
    "4908721208": {
        "class_name": "Accessor",
        "edges": [
            "4909298232",
            "4909297976"
        ]
    },
    "4907520440": {
        "root": "SafeFunction Optional Optional.h:137",
        "class_name": "Realm",
        "edges": [
            "4908269624",
            "4924821560",
            "4908409240",
            "4908483960",
            "4924527672"
        ]
    },
    "4908251320": {
        "class_name": "CSSStyleRule",
        "edges": [
            "4908302648",
            "4925101656",
            "4908251192"
        ]
    },
```
2023-08-17 18:27:02 +02:00
Aliaksandr Kalenik
ee29a21ae8 LibJS: Delete unused operator=s in SafeFunction 2023-08-17 18:27:02 +02:00
martinfalisse
70919dbed7 LibWeb: Fix parsing bug for SVG attributes
This doesn't seem to actually have fixed any bugs, as having
FillOpacity instead of StrokeOpacity in the call to parse_css_value
doesn't seem to have actually been causing bugs. But, I still think it's
worthwhile correcting.

The reason that it wasn't causing bugs is that having FillOpacity
instead of StrokeOpacity in the call to parse_css_value means that when
parsing the value is compared to the acceptable values for that property
(for example the value can only be a percentage, or a number, etc.). In
this case both FillOpacity and StrokeOpacity seem to accept the same
values.
2023-08-17 17:48:34 +02:00
martinfalisse
f2047a5c32 LibWeb: Size SVG G container according to children
The SVG G container should have the same size as its children. This
fixes a bug when there was an opacity value on the G element, as in
StackingContext it would try and get a bitmap of the element which would
be empty due to it having no size.
2023-08-17 17:48:34 +02:00
Andreas Kling
258af0fb1b Ladybird/Qt: Turn off web search and autocomplete by default
Anyone who wants this can enable it in the settings window.
2023-08-17 16:49:22 +02:00
Cameron Youell
d972338208 Browser: Add more intuitive search 2023-08-17 15:30:23 +01:00
Cameron Youell
d68433653a Ladybird: Add autocomplete to LocationEdit 2023-08-17 15:30:23 +01:00
Cameron Youell
8fcf42f684 LibPublicSuffix: Add Library and Generators 2023-08-17 15:30:23 +01:00
Cameron Youell
c53d3e7aa4 Ladybird: Simplify the LocationEdit constructor 2023-08-17 15:30:23 +01:00
Cameron Youell
0da5af0eff Ladybird: Pass QIcon by reference in tab_favicon_changed 2023-08-17 15:30:23 +01:00
Cameron Youell
6e40e8316e Ladybird: Convert Browser::Settings to a singleton 2023-08-17 15:30:23 +01:00
Sam Atkins
68dae8ab46 LibWeb: Deduplicate calc-parsing code
We had `parse_calculated_value()` which parsed the contents of `calc()`,
and `parse_dynamic_value()` which parsed any math function, both of
which produce a CalculatedStyleValue, but return a plain StyleValue.
This was confusing, so let's combine them together, and return a
CalculatedStyleValue.

This also makes the other math functions work in
`StyleComputer::expand_unresolved_values()`.
2023-08-17 16:21:42 +02:00
Timothy Flynn
7bc7f376fa LibGfx: Add Point::scaled(T) and Rect::scaled(T)
Note that we already have Size::scaled(T). While subjectively providing
API symmetry, this is mostly to allow using these methods in templated
helpers without caring what the exact underlying type is.
2023-08-17 09:57:30 -04:00
Timothy Flynn
7c4b0b0389 LibGfx+Userland: Rename Size::scaled_by to Size::scaled
Ignoring Size for a second, we currently have:

    Rect::scale_by
    Rect::scaled

    Point::scale_by
    Point::scaled

In Size, before this patch, we have:

    Size::scale_by
    Size::scaled_by

This aligns Size to use the same method name as Rect and Point. While
subjectively providing API symmetry, this is mostly to allow using this
method in templated helpers without caring what the exact underlying
type is.
2023-08-17 09:57:30 -04:00
Andreas Kling
f34cc0b8e3 LibWeb: Null check fonts after parsing them in CRC2D.font assignment
Fixes an issue where setting CRC2D.font to an unparseable value would
assert due to a null dereference.
2023-08-17 10:07:38 +02:00
Andi Gallo
ef6a78518f LibWeb: Remove unused argument of InlineLevelIterator::next
Also remove unused method from LineBuilder.
2023-08-17 09:08:18 +02:00
Andreas Kling
768c35af71 LibWeb: Throw on attempt to create a Worker for now
Trying to run a worker right now just results in the WebContent process
asserting down the road, so let's throw and log a FIXME instead.
This makes it easier to see what's failing. We'll obviously remove this
once we get workers working correctly. :^)
2023-08-17 09:07:44 +02:00
EWouters
5defca01f0 Mandelbrot: Pledge unix to enable image export 2023-08-17 07:14:54 +02:00
Hendiadyoin1
30cb4cb69b LibWeb: Reject nullptr StyleValues as invalid ColorStops
This would cause a nullptr-deref during painting of invalid
linear-gradients, such as `linear-gradient(top, #f8f9fa, #ececec)`
found in googles sign-in button
2023-08-17 07:11:13 +02:00
Andi Gallo
d5f54956ba LibWeb: Use the auto table width formula if it cannot be resolved
If the width is a percentage but the parent isn't resolved yet, take the
same path as for auto width.
2023-08-17 04:13:46 +02:00
Tim Ledbetter
3a8e362ab0 Ports/citron: Use correct quote format 2023-08-16 21:40:05 +02:00
Ali Mohammad Pur
4d27257c45 LibRegex: Treat backwards jumps to IP 0 as normal backwards jumps too
This shows up in something like /\d+|x/, where the `+` ends up jumping
to the start of its own alternative.
2023-08-16 22:20:24 +03:30
Andreas Kling
045880e6c7 LibWeb: Stop whining about WOFF2 errors when trying to guess font format 2023-08-16 18:22:01 +02:00
Sam Atkins
12a2750d1e LibWeb: Support multiple values in :lang() selector
Parse them, and also don't give up completely if the first language
listed doesn't match an element.
2023-08-16 18:05:26 +02:00
Sam Atkins
39cba61c2d LibGUI: Fall back to words when double-clicking TextEditor with spans
If we double-click on a TextEditor that has spans, but the click itself
was not on a span, fall back to the without-spans behavior. Previously
the cursor would instead jump to the end of the document.
2023-08-16 16:58:49 +02:00
Sam Atkins
631a988a57 LibWeb: Allow any valid <color> in CSS gradients
We now keep the color value as a StyleValue up until we go to paint the
gradient, which makes `currentColor` work, along with any other color
values that can't be immediately converted into a `Gfx::Color` while
parsing.
2023-08-16 14:51:12 +02:00
Andreas Kling
2971ae59d8 LibGfx/WOFF2: Align all reconstructed glyf entries to 4 bytes
It wasn't enough to do it only for simple glyphs, we need to do it for
composite glyphs as well.

Fixes an issue where some glyph data was misaligned in the output and
thus ended up rendered incorrectly or not at all.
2023-08-16 14:49:59 +02:00
Tim Ledbetter
149ab91040 Ports/citron: Update formatting to be consistent with other ports 2023-08-16 15:32:42 +03:30
Tim Ledbetter
87d8a32f3d Ports/citron: Update to the latest commit 2023-08-16 15:32:42 +03:30
Andreas Kling
1c47695bae LibWeb: Invalidate layout-transformed text on DOM text node change
This fixes an issue where programmatically changing the value of an
input element wasn't reflected visually.
2023-08-16 12:16:05 +02:00
Andreas Kling
e2740bd19d LibWeb: Don't overwrite existing text content when flushing HTML parser
If we run an inline script from the HTML parser, it may append a text
node to the current insertion point.

If there was text content immediately following the script element,
we would previously overwrite the script-inserted text content, due to
an oversight in the way we select an appropriate insertion point

This patch fixes the issue by only inserting parser content into
existing text nodes if they are empty.
2023-08-16 12:16:05 +02:00
kleines Filmröllchen
c7f416682b LibAudio: Write final FLAC audio data instead of discarding it 2023-08-16 01:10:35 +02:00
kleines Filmröllchen
1a1cba1c3f LibAudio: Use channel coupling for stereo FLAC encoding
The estimation for this is fast but not very accurate, meaning we save
around 5-10% storage space. (We also don’t try other channel coupling
methods, but I am sceptical of how much benefit that actually provides.)
2023-08-16 01:10:35 +02:00
kleines Filmröllchen
3d0da734ee AK: Allow Statistics to be used with any container type
This not only facilitates using non-owning types, but also those that
cannot be default-constructed.
2023-08-16 01:10:35 +02:00
Tim Ledbetter
9aaf516bdd Base: Render checksum man page synopsis using a multi-line code block
This is consistent with other man pages and makes the synopsis render
correctly in the terminal.
2023-08-16 01:04:13 +02:00
Tim Ledbetter
b707a7f57a Ports/klong: Create /usr/local/bin if it doesn't exist 2023-08-16 00:52:18 +02:00
Tim Ledbetter
c1e94bc3c1 Ports/stb: Create /usr/local/include if it doesn't exist 2023-08-16 00:51:09 +02:00
Jelle Raaijmakers
386505d0e0 Ports: Update README.md to show the right style for depends :^) 2023-08-16 00:38:18 +02:00
Tim Ledbetter
3782903642 Ports/brogue: Update formatting to be consistent with other ports 2023-08-16 00:29:55 +02:00
Tim Ledbetter
b5f34b3cda Ports/brogue: Update to version 1.12 2023-08-16 00:29:55 +02:00