Commit Graph

46250 Commits

Author SHA1 Message Date
Tim Schumacher
982ebbc304 LibWasm: Port the parser to Core::Stream 2023-01-25 17:10:05 +03:30
Tim Schumacher
409fb0fe79 LibWasm: Port Wasm::Printer to Core::Stream 2023-01-25 17:10:05 +03:30
Tim Ledbetter
4bad4dc8d5 PixelPaint: Use background color when cropping layer to content
This commit expands the functionality of the "Crop Image to Content"
and "Crop Layer to Content" features by allowing them to detect and
crop the background color of an image instead of just cropping
transparent pixels.

The background color is determined by looking at the corner pixels of
the image. If no background color is found, the old behavior of
cropping transparent pixels is retained.
2023-01-25 14:31:15 +01:00
Timon Kruiper
3a802e365c Meta: Unify installing GCC dependencies in disk image
This makes sure that the aarch64 disk image also contains the correct
dynamic shared objects, specifically libgcc_s.so.1, as that one is a
dynamic dependency of every aarch64 executable.

To unify the x86_64 and aarch64 code paths, this commit just installs
everything from the compilers lib directory into the disk image lib
directory. This also happens for the Clang toolchain. This copies a few
extra files related to libsupc++ and libstdc++, increasing the size of
the disk image by 1.6MB. However, we were already copying libstdc++.a
manually anyway.
2023-01-25 14:28:53 +01:00
Timon Kruiper
7eccacf418 Toolchain: Ensure aarch64 libgcc_s.so.1 includes DT_SONAME tag
Without this tag, executables that link libgcc_s.so.1, which is every
executable, end up with the host path to libgcc_s.so.1 as the path for
the dynamic dependency (DT_NEEDED) of the executable. By making sure
that the libgcc_s.so.1 shared object includes the DT_SONAME tag, the
path to libgcc_s.so.1 dynamic dependency will only contain the basename,
instead of the absolute host path.
2023-01-25 14:28:53 +01:00
Karol Kosek
5aaa39e64e LibGfx: Port GIFLoader to Core::Stream 2023-01-25 14:28:20 +01:00
Sam Atkins
86b1b49d9a UserspaceEmulator: Use Core::Process::set_name() 2023-01-25 14:27:45 +01:00
Sam Atkins
8297516f89 FileManager: Use Core::Process::set_name() 2023-01-25 14:27:45 +01:00
Sam Atkins
00b897af8f LibCore: Add nice get/set_process_name() wrappers in Core::Process
`Process::get_name()` and `Process::set_name()` are basically the same
as `get_process_name()` and `set_process_name()`, except making use of
convenient Serenity standard types and returning ErrorOr, instead of
char* and errno shenanigans.

`Process::set_name()` has an optional `SetThreadName` parameter, for
when you also want to set the thread's name to the same thing. That's
true for the two places that use `set_process_name()`.
2023-01-25 14:27:45 +01:00
Nico Weber
2095e2529f icc: Print each tag signature's spec name
The spec names are still a bit cryptic ("deviceMfgDescTag"
for "device manufacturer description"), but less cryptic than
just the fourcc.

There's a private tag area, so this will only print the spec name
of tags in the current spec. Private tags are in active use, e.g.:

    $ icc /Library/ColorSync/Profiles/WebSafeColors.icc
    ...
    Unknown tag ('dscm'): type 'mluc', offset 312, size 1490

(That's a v2 file. In v2, 'desc' has that strange textDescriptionType.
In v4, 'desc' has type 'mluc' -- but in v2, it didn't yet, so Apple
invented the private 'dscm' tag which has the description as an 'mluc'.)
2023-01-25 14:26:21 +01:00
Nico Weber
2e315757b1 LibGfx: Add names for all tag signatures in the v4 spec
Also add a function to map each tag signature to its name,
that is a function that maps e.g. measurementTag to "measurementTag"sv.
To implement this without too much repetition, use an x-macro.

I used pdftotext on the icc v4 spec to extract the list of tags,
and then manually cleaned it up a bit:
https://github.com/nico/hack/blob/main/icc-tags.txt
I then converted that to an x-macro using vim macros.
2023-01-25 14:26:21 +01:00
Aliaksandr Kalenik
08f217526a LibWeb: Use rect of containing block instead of parent to clip overflow
Move overflow clipping from `before_children_paint` into separate
method and call this method on containing block instead of parent.

Example that got fixed:
```html
<!DOCTYPE html><html><head><style>
    * {
      border: 2px solid black;
    }
    body {
      overflow: hidden;
    }
    .inner {
      position: absolute;
      width: 100px;
      height: 100px;
      background: lime;
    }
</style></head><body><div class=inner></div>
```
2023-01-25 10:44:58 +01:00
Aliaksandr Kalenik
ee4ba7617c LibWeb: Fix clip of hidden overflow when translated boxes are involved
There is a problem with current approach where overflow clip rectange is
calculated by aggregating intersection of absolute padding boxes of
boxes in containing block chain that resulting rectangle doesn't
respect transform properties.

To solve this problem `PaintableBox` is changed to store clip rectangle
saved from painter because it does respect transform properties of all
previously applied clip rectangles.
2023-01-25 10:44:58 +01:00
MacDue
b0846ec78a LibWeb: Propagate more StringBuilder errors in from StyleValues 2023-01-24 21:12:44 -05:00
MacDue
95aacd4f78 LibWeb: Remove some unchecked .value() calls in StyleValue
Here .to_string() was being called, which gives an ErrorOr<String>,
then .value() was called on that without any checks. Cases like this
should at least be .release_value_but_fixme_should_propagate_errors()
which makes it clear the error is ignored, but here it's easy to
propagate.
2023-01-24 21:12:44 -05:00
Timothy Flynn
0c2efa285a LibJS+LibLocale: Port Intl.NumberFormat to String 2023-01-24 16:23:50 -05:00
Timothy Flynn
76fd5f2756 AK: Add convenience substring wrappers to String to exclude a length
These overloads exist on other string classes and are used throughout
the code base.
2023-01-24 16:23:50 -05:00
Timothy Flynn
427b82065c AK: Add a method to create a String with a repeated code point 2023-01-24 16:23:50 -05:00
Timothy Flynn
d50724956e AK: Add a method to find the byte offset of a code point 2023-01-24 16:23:50 -05:00
Timothy Flynn
5e44b93af2 AK: Remove [[nodiscard]] attribute from String methods returning ErrorOr 2023-01-24 16:23:50 -05:00
Timothy Flynn
bc9a440f31 LibJS: Use correct type for NumberFormat's UseGrouping internal slot
This was converted to an enumeration for Intl.NumberFormat V3 in commit
33698b9615, but the default value was not
updated (and it's a bit surprising it compiled at all, given that this
is an 'enum class').
2023-01-24 16:23:50 -05:00
Timothy Flynn
4548906e7b LibJS: Propagate OOM errors from all Intl.Locale *OfLocale AOs 2023-01-24 16:23:50 -05:00
Timothy Flynn
f2527c8c81 LibJS: Add a fallible variant of Array::create_from 2023-01-24 16:23:50 -05:00
Timothy Flynn
879a590882 LibJS: Propagate OOM errors from ApplyUnicodeExtensionToTag
These were missed in bff0e25ebe.
2023-01-24 16:23:50 -05:00
Timothy Flynn
d2ec31cbdb LibJS: Remove DeprecatedString usage from Intl.PluralRules
This can make due with a StringView.
2023-01-24 16:23:50 -05:00
Karol Kosek
e45434c0c7 FileManager+HackStudio+SpaceAnalyzer: Use File::can_delete_or_move 2023-01-24 20:13:30 +00:00
Karol Kosek
b810f7f88a LibCore: Implement File::can_delete_or_move()
Besides from a general check if a file's directory has write
permissions, this also checks if the directory has set a sticky bit,
meaning that only file owners and the directory owner can remove or move
files in such directory. It's being used in /tmp for example.
2023-01-24 20:13:30 +00:00
Karol Kosek
8cfd445c23 Kernel: Allow to remove files from sticky directory if user owns it
It's what the Linux chmod(1) manpage says (in the 'Restricted Deletion
Flag or Sticky Bit' section), and it just makes sense to me. :^)
2023-01-24 20:13:30 +00:00
Karol Kosek
798154fbbc FileManager: Calculate file action permissions for subsequent columns
Previously, the permission for the action was always calculated
according to the first column.
2023-01-24 20:13:30 +00:00
kleines Filmröllchen
4d9b4e1381 Documentation: Add a link list
The link list tries to collect all links from the website, BenW's link
list <https://benwiederhake.github.io/serenity-fixmes/index.html#links>
and the unofficial wiki <https://wiki.serenityos.net/links.html> into
one sorted and expanded list, so that hopefully noone has difficulty
searching for serenity pages in the future :^)
2023-01-24 19:51:13 +00:00
Aliaksandr Kalenik
025b496616 LibWeb: Improve column width distribution 2023-01-24 20:47:11 +01:00
Aliaksandr Kalenik
5966f181f5 LibWeb: Avoid division by zero in distribute_width_to_columns 2023-01-24 20:47:11 +01:00
Aliaksandr Kalenik
d331cbba41 LibWeb: Use table wrapper box width to resolve cells width 2023-01-24 20:47:11 +01:00
Aliaksandr Kalenik
2b0ae71172 LibWeb: Use percentage column widths in compute_table_measures
This reverts commit 9b6fcd8591 because not
resolving percentage column widths breaks table width calculation.
2023-01-24 20:47:11 +01:00
davidot
bb483c8308 LibJS: Add missing MUST in DisposableStack.prototype.use
Although the spec has a TRY here I believe this is a spec issue
together with the missing TRY just above this change.
2023-01-24 15:50:39 +00:00
Zaggy1024
42606c87e3 LibVideo/VP9: Move TreeSelection class to TreeParser.cpp
The class no longer needs to be defined in the header, as it is only
used in static functions.
2023-01-24 14:55:51 +00:00
Timon Kruiper
c4a3af12fc Kernel/aarch64: Change base address of the kernel to 0x2000000000
This is the same address that the x86_64 kernel runs at, and allows us
to run the kernel at a high virtual memory address. Since we now run
completely in high virtual memory, we can also unmap the identity
mapping. Additionally some changes in MMU.cpp are required to
successfully boot.
2023-01-24 14:54:44 +00:00
Timon Kruiper
3bc122fcef Kernel/aarch64: Ensure global variable accesses work without MMU enabled
Since we link the kernel at a high virtual memory address, the addresses
of global variables are also at virtual addresses. To be able to access
them without the MMU enabled, we have to subtract the
KERNEL_MAPPING_BASE.
2023-01-24 14:54:44 +00:00
Timon Kruiper
fdc687a911 Kernel/aarch64: Disable stack protector + sanitizers for MMU-less files
Compile source files that run early in the boot process without the MMU
enabled, without stack protector and sanitizers. Enabling them will
cause the compiler to insert accesses to global variables, such as
__stack_chk_guard, which cause the CPU to crash, because these variables
are linked at high virtual addresses, which the CPU cannot access
without the MMU enabled.
2023-01-24 14:54:44 +00:00
Timon Kruiper
ebdb899d3d Kernel/aarch64: Add pre_init function for that sets up the CPU and MMU
This is a separate file that behaves similar to the Prekernel for
x86_64, and makes sure the CPU is dropped to EL1, the MMU is enabled,
and makes sure the CPU is running in high virtual memory. This code then
jumps to the usual init function of the kernel.
2023-01-24 14:54:44 +00:00
Timon Kruiper
5e00bb0b9f Kernel/aarch64: Change MMU::kernel_virtual_range to high virtual memory
This was previously hardcoded this to be the physical memory range,
since we identity mapped the memory, however we now run the kernel at
a high virtual memory address.

Also changes PageDirectory.h to store up-to 512 pages, as the code now
needs access to more than 4 pages.
2023-01-24 14:54:44 +00:00
Timon Kruiper
5db32ecbe1 Kernel/aarch64: Access MMIO using mapping in high virtual memory
This ensures that we can unmap the identity mapping of the kernel in
physical memory.
2023-01-24 14:54:44 +00:00
Timon Kruiper
91d0451999 Kernel/aarch64: Use relative addressing in boot.S
As the kernel is now linked at high address in virtual memory, we cannot
use absolute addresses as they refer to high addresses in virtual
memory. At this point in the boot process we are still running with the
MMU off, so we have to make sure the accesses are using physical memory
addresses.
2023-01-24 14:54:44 +00:00
Timon Kruiper
a581cae4d4 Kernel/aarch64: Add function to MMU.cpp to unmap identity mapping
This function will be used once the kernel runs in high virtual memory
to unmap the identity mapping as userspace will later on use this memory
range instead.
2023-01-24 14:54:44 +00:00
Timon Kruiper
150c52e420 Kernel/aarch64: Add {panic,dbgln}_without_mmu
And use it the code that will be part of the early boot process.

The PANIC macro and dbgln functions cannot be used as it accesses global
variables, which in the early boot process do not work, since the MMU is
not yet enabled.
2023-01-24 14:54:44 +00:00
Timon Kruiper
69c49b3d00 Kernel/aarch64: Map kernel and MMIO in high virtual memory
In the upcoming commits, we'll change the kernel to run at a virtual
address in high memory. This commit prepares for that by making sure the
kernel and mmio are mapped into high virtual memory.
2023-01-24 14:54:44 +00:00
Timon Kruiper
33581d5c44 Kernel: Add KERNEL_MAPPING_BASE to Sections.h and use it in Prekernel 2023-01-24 14:54:44 +00:00
Nico Weber
95992a255e icc: Print every TagData object only once
When several tags refer to the same TagData object, we now only print
it the first time, and print "(see 'foob' above)" the following times,
where `foob` is the tag identifier where we printed it the first time.
2023-01-24 14:45:27 +00:00
Nico Weber
81cc64f29c LibGfx: Dedupe ICC TagData objects
Several tags can refer to the same TagData. In particular, the
rTRC, gTRC, bTRC tags usually all three refer to the same curve.
Curve objects can be large, so allocate only a single TagData
object in that case and make all tags point to it.

(If we end up storing some cache in the curve object later on,
this will also increase the effectiveness of that cache.)
2023-01-24 14:45:27 +00:00
Nico Weber
44de4d163b AK: Make HashMap::try_ensure work with a fallible construction callback
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2023-01-24 14:45:27 +00:00