Commit Graph

58100 Commits

Author SHA1 Message Date
Sam Atkins
84dd0ce1ae HexEditor: Wrap selection and behavior in a struct 2024-01-14 13:45:02 +00:00
Nico Weber
96e8debf0b test-jpeg-roundtrip: Add a few more colors 2024-01-14 11:35:40 +00:00
Nico Weber
25efe65a83 test-jpeg-roundtrip: Print summary statistics at the end 2024-01-14 11:35:40 +00:00
Nico Weber
8ef3310525 test-jpeg-roundtrip: Print perceived delta of fixpoint to start color 2024-01-14 11:35:40 +00:00
Nico Weber
5a47e71604 Utilities: Add test-jpeg-roundtrip
This creates a bitmap filled with a fixed color, then (in memory)
saves it as jpeg and loads it again, and repeats that until the
color of the bitmap no longer changes. It then reports how many
iterations that took, and what the final color was.

It does this for a couple of colors.

This is for quality assessment of the jpeg codec. Ideally, it should
converge quickly (in one iteration), and on a color not very far from
the original input color.
2024-01-14 11:35:40 +00:00
Shannon Booth
9d4278ad9a LibWeb: Wait until new document is active before running SVG scripts
This is the same fix as 07928129dd
also applied to the SVG script element case. Fixes a crash for the
following HTML:

```html
<svg>
<script>
location.reload();
</script>
</svg>
```

As with the linked commit:
> With this change WebContent does not crash when `location.reload()` is
> invoked but `Navigable::reload()` still not working because of spec
> issue (whatwg/html#9869) so we can't add a
> test yet.
2024-01-14 11:27:58 +00:00
Shannon Booth
4135c3885c LibWeb: Only wait for document to be ready for scripts if executing one
HTML fragments are parsed with a temporary HTML document that never has
its flag set to say that it is ready to have scripts executed. For these
fragments, in the HTMLParser, these scripts are prepared, but
execute_script is never called on them.

This results in the HTMLParser waiting forever on the document to be
ready to have scripts executed.

To fix this, only wait for the document to be ready if we are definitely
going to execute a script.

This fixes a hang processing the HTML in the attached test, as seen on:
https://github.com/SerenityOS/serenity

Fixes: #22735
2024-01-14 11:27:58 +00:00
Tim Ledbetter
48a3a02238 LibCrypto: Make constructing a BigInteger from string fallible
Previously, constructing a `UnsignedBigInteger::from_base()` could
produce an incorrect result if the input string contained a valid
Base36 digit that was out of range of the given base. The same method
would also crash if the input string contained an invalid Base36 digit.
An error is now returned in both these cases.

Constructing a BigFraction from string is now also fallible, so that we
can handle the case where we are given an input string with invalid
digits.
2024-01-13 19:01:35 -07:00
Tim Ledbetter
0b0c7693e2 LibCrypto: Prefer operator when converting string literal to BigInteger 2024-01-13 19:01:35 -07:00
Tim Ledbetter
65827826fe AK: Add CharacterTypes::is_ascii_base36_digit()
This can be used to validate the string passed to
`parse_ascii_base36_digit()`.
2024-01-13 19:01:35 -07:00
Tim Ledbetter
bbdbd71439 Tests/AK: Add unit test for Base36 digit parsing 2024-01-13 19:01:35 -07:00
Liav A
fc0dbd2334 Utilities: Add the listdir utility
This utility uses the Core::DirIterator facility which in turn uses the
get_dir_entries syscall. Therefore, this utility lets us to view the
actual values for inode numbers, and entry type value for directory
entries.
2024-01-13 19:01:07 -07:00
Liav A
603516e8c0 LibCore: Add new flag for DirIterator to not use fstatat
This will be useful in the upcoming listdir utility (in the next commit)
to get the file type which is obtained in the get_dir_entries syscall,
so it's not changed later by the fstatat syscall.

This will ensure that we get the raw file type value as it's represented
by directory entries from the get_dir_entries syscall.
2024-01-13 19:01:07 -07:00
Liav A
d568b09632 LibCore: Add methods to convert DirectoryEntry types to names
We can either convert DirectoryEntry::type to its representative name or
to the POSIX DT_* name.
2024-01-13 19:01:07 -07:00
Liav A
90152dc859 Tests/Kernel: Add test cases for proper types in dirent for various FSes 2024-01-13 19:01:07 -07:00
Liav A
a10e63f08e Kernel/FileSystem: Send proper filetypes when traversing RAM-backed FSes
SysFS, ProcFS and DevPtsFS were all sending filetype 0 when traversing
their directories, but it is actually very easy to send proper filetypes
in these filesystems.
This patch binds all RAM backed filesystems to use only one enum for
their internal filetype, to simplify the implementation and allow
sharing of code.
Please note that the Plan9FS case is currently not solved as I am not
familiar with this filesystem and its constructs.

The ProcFS mostly keeps track of the filetype, and a fix was needed for
the /proc root directory - all processes exhibit a directory inside it
which makes it very easy to hardcode the directory filetype for them.
There's also the `self` symlink inode which is now exposed as DT_LNK.

As for SysFS, we could leverage the fact everything inherits from the
SysFSComponent class, so we could have a virtual const method to return
the proper filetype.
Most of the files in SysFS are "regular" files though, so the base class
has a non-pure virtual method.

Lastly, the DevPtsFS simply hardcodes '.' and '..' as directory file
type, and everything else is hardcoded to send the character device file
type, as this filesystem is only exposing character pts device files.
2024-01-13 19:01:07 -07:00
Lucas CHOLLET
75bd1308c5 Tests/LibCompress: Add a reproducer of oss-fuzz issue 58046
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58046
2024-01-13 15:17:08 -07:00
Sam Atkins
336b8ed80b HackStudio: Use Core::System APIs where possible 2024-01-13 15:13:36 -07:00
Sam Atkins
16543a1918 HackStudio: Convert ProjectTemplate::create_project to ErrorOr
This lets us also use the Core::System APIs, which reduces the amount of
error checking code.
2024-01-13 15:13:36 -07:00
Bastiaan van der Plaat
63c6eae918 LibWebView: Fix sanitizing about scheme URLs 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat
cde14901bc Ladybird+LibWeb: Add initial about:version internal page 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat
05c0640474 Ladybird+LibWeb: Add about scheme support for internal pages 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat
c0acb2918b Ladybird: Rename new-tab.html file to newtab.html 2024-01-13 13:41:09 -05:00
Bastiaan van der Plaat
e3ad75d073 Ladybird: Move and format directory and error template files 2024-01-13 13:41:09 -05:00
Aliaksandr Kalenik
2960bf4ec8 LibWeb: Make inline paintables own their fragments
The paintable tree structure more closely matches the painting order
when fragments are owned by corresponding inline paintables. This
change does not affect the layout tree, as it is more convenient for
layout purposes to have all fragments owned by a block container in
one place.

Additionally, this improves performance significantly on pages with
many fragments, as we no longer have to walk the ancestor chain up
to the closest block container to determine if a fragment belongs
to an inline paintable.
2024-01-13 18:46:41 +01:00
Aliaksandr Kalenik
5ed936289a LibWeb: Set box-shadow for inline paintables in LayoutState::commit()
This is part of the efforts towards making the paintable tree
independent of the layout tree.
2024-01-13 17:31:01 +01:00
Andreas Kling
bfa4143e70 LibWeb: Avoid an unnecessary LayoutState lookup in FlexFormattingContext
The containing block of a flex item is always formed by the flex
container, duh. :^)
2024-01-13 14:34:39 +01:00
Andreas Kling
ba286781b4 LibWeb: Detach all paintables when building/committing layout tree
Instead of trying to be clever and detaching the paint tree lazily,
just detach all paintables from both DOM and layout tree when building
and committing respectively.
2024-01-13 12:34:53 +01:00
Andreas Kling
b0afe8463a LibWeb: Make Node::paintable_box() go directly to the paintable
No need to go via the layout tree here, that's a vestige of an earlier
architecture limitation.
2024-01-13 12:33:53 +01:00
Shannon Booth
e6861cb5ef LibWeb: Port Element::insert_adjacent from ByteString 2024-01-13 12:05:36 +01:00
Shannon Booth
bd2fe3dcaa LibWeb: Use FlyString in Document::get_elements_by_name 2024-01-13 12:05:36 +01:00
Shannon Booth
2a94cddb02 LibWeb: Remove duplicated HTMLInputElement::name
This is already implemented by Element with a cache. Remove it - and
make use of this function where applicable.
2024-01-13 12:05:36 +01:00
Shannon Booth
0695236408 LibWeb: Use cached element name and id where possible
Instead of looking up in the named node map, we can simply use the
cached name and ID on the element.
2024-01-13 12:05:36 +01:00
Shannon Booth
41f84deb9f LibWeb: Port Element::name to a cached FlyString
Also removing some handling of OOM while we are in the area.
2024-01-13 12:05:36 +01:00
Shannon Booth
cb9118efe3 LibWeb: Use cached Element::id in HTMLFormControlsCollection 2024-01-13 12:05:36 +01:00
Shannon Booth
44089ce284 LibWeb: Reuse attribute lookups in HTMLScriptElement::prepare_script
Switch over from deprecated_attribute to attribute, and reuse the result
of this lookup for both checking whether that attribute exists - and for
retrieving the value of that attribute when we need it.
2024-01-13 12:05:36 +01:00
Aliaksandr Kalenik
f9a7535fb8 LibWeb: Scale font per-glyph in paint_text_shadow()
With the support for unicode-ranges implemented, it's no longer
accurate to assume that all glyphs within a fragment share the same
font.
2024-01-13 12:03:32 +01:00
Aliaksandr Kalenik
ee5d66c5d5 LibWeb: Resolve text shadows in LayoutState::commit()
Rather than resolving the text-shadow each time painting commands are
recorded, we can resolve it once during the layout commit and save the
resolved values in paintable fragments. This is also step towards
getting rid of layout node pointer in paintable fragment.
2024-01-13 12:03:32 +01:00
Andreas Kling
c3059701b0 LibWeb: Avoid style invalidation when entire document has invalid style
If the entire document is invalidated, we know a full style update is
coming soon, and there's no need to try and invalidate a smaller part.

This avoids a *lot* of work on some pages. As an example, we are able to
skip ~1.5 million style invalidations on https://html.spec.whatwg.org/
2024-01-13 11:49:04 +01:00
Aliaksandr Kalenik
de32b77ceb LibWeb: Use separate structure to represent fragments in paintable tree
This is a part of refactoring towards making the paintable tree
independent of the layout tree. Now, instead of transferring text
fragments from the layout tree to the paintable tree during the layout
commit phase, we allocate separate PaintableFragments that contain only
the information necessary for painting. Doing this also allows us to
get rid LineBoxes, as they are used only during layout.
2024-01-13 10:53:38 +01:00
Shannon Booth
785fa60cca LibWeb: Implement Element.getAttributeNS 2024-01-13 08:33:10 +01:00
Shannon Booth
8cf783b260 LibWeb: Fix normalizing namespace in NamedNodeMap::get_attribute_ns
There was a typo which effectively meant that the namespace was always
being set to null when given.
2024-01-13 08:33:10 +01:00
Shannon Booth
636a85f04e LibWeb: Use Optional<FlyString> directly in Document & DOMImplementation
Use the [FlyString] extended attribute to allow these functions to take
an Optional<FlyString> directly, allowing us to tidy up some conversions
from Optional<String>.
2024-01-13 08:33:10 +01:00
Sam Atkins
7cf2674061 HackStudio: Stop incorrectly overriding gutter cursors
Only adjust the cursor to respond to clickable text, if the mouse is
over text.
2024-01-13 07:13:52 +00:00
Sam Atkins
e685b0a819 HackStudio: Remove redundant set_cursor() override
All this does is call the immediate parent's implementation.
2024-01-13 07:13:52 +00:00
Kemal Zebari
f2c1130f23 LibWeb/MimeSniff: Remove unnecessary addition in mp4 signature match
A little whoopsie I did not see in 3aaa1c1. This is not erroneous
behavior, but it's just not necessary.
2024-01-12 19:24:35 -07:00
Dan Klishch
ccd701809f Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string
`JsonValue::to_byte_string` has peculiar type-erasure semantics which is
not usually intended. Unfortunately, it also has a very stereotypical
name which does not warn about unexpected behavior. So let's prefix it
with `deprecated_` to make new code use `as_string` if it just wants to
get string value or `serialized<StringBuilder>` if it needs to do proper
serialization.
2024-01-12 17:41:34 -07:00
Sam Atkins
4ed5287792 Solitaire: Hide solve button when game ends
`on_game_start` is not called until the player makes a move, so waiting
until then means that the solve button would still be visible when
starting a new game after completing one. By hiding the button in
`on_game_end`, this happens when the game-over animation starts playing
instead.
2024-01-12 17:16:19 -07:00
Cubic Love
8b3fd16da8 Base: Improve About, AnalogClock & Assistant manpages 2024-01-12 17:14:59 -07:00
ronak69
4aa04cdf65 Calendar: Add feature to view/edit duration of events in AddEventDialog 2024-01-12 17:13:46 -07:00