Commit graph

46040 commits

Author SHA1 Message Date
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
Nico Weber
2f4a83215c LibGfx: Move TagTableEntry into read_tag_table
It's now used only there.
2023-01-24 14:45:27 +00:00
Nico Weber
f7f592f5d3 LibGfx: Pass offset and size instead of full TagTableEntry to read_tag
read_tag() has no business knowing the tag signature.
2023-01-24 14:45:27 +00:00
Sam Atkins
a19e54c1db WindowServer: Reuse existing WindowManager::desktop_rect() method 2023-01-24 14:41:16 +00:00
Tim Schumacher
1cb306cbe3 LibGfx: Use Core::Stream to decode QOI images 2023-01-24 14:40:02 +00:00
Tim Schumacher
e6f5a208a0 LibGfx: Pass the first QOI chunk byte to the operation implementation
This reduces reliance on the peek operation, which the generic stream
implementation does not support.

This also corrects the naming, since "tag" wasn't entirely correct for
some of the operations, where the tag takes up only part of a byte, with
the rest being reserved for data.
2023-01-24 14:40:02 +00:00
Nico Weber
55e45856ae LibGfx: Use x-mac-roman TextCodec for decoding MacRoman text 2023-01-24 14:37:20 +00:00
Nico Weber
eac2b2382c LibTextCodec: Add a MacRoman decoder
Allows displaying `<meta charset="x-mac-roman">` html files.
(`:set fenc=macroman`, `:w` in vim to save in that encoding.)
2023-01-24 14:37:20 +00:00
Nico Weber
b14b5a4d06 LibTextCodec: Simplify Latin1Decoder::process() a tiny bit 2023-01-24 14:37:20 +00:00
Andreas Kling
850b4a03e6 LibGfx: Cache font pixel metrics in ScaledFont
Instead of recomputing the pixel metrics over and over, we can just
cache them with the font and avoid a bunch of expensive computation.
2023-01-24 14:13:59 +01:00
Jelle Raaijmakers
83488cd102 WindowServer: Double click a window's frame to latch to screen's edge 2023-01-24 12:53:26 +00:00