Commit Graph

41090 Commits

Author SHA1 Message Date
Tim Schumacher
1b25c38b8b Everywhere: Fully remove the separate LibM directory 2022-09-16 16:09:19 +00:00
Tim Schumacher
bbcdd0dca0 Tests: Move the former LibM test into the LibC namespace 2022-09-16 16:09:19 +00:00
Tim Schumacher
81d46fa100 LibM: Move the math standard library to LibC 2022-09-16 16:09:19 +00:00
Andrew Kaster
eef989f9ed LibGPU: Don't use relative paths for libsoftgpu in Lagom environments
We can count on the dynamic loader for each platform, and the RPATH of
our build infrastrucuture, to load the lib up automagically.
2022-09-16 15:32:38 +02:00
Andrew Kaster
8ed5ed3ec0 LibGL: Make GL::create_context fallible
Propagate errors in places that are already set up to handle them, like
WebGLRenderingContext and the Tubes demo, and convert other callers
to using MUST.
2022-09-16 15:32:38 +02:00
Timothy Flynn
7e5080ea53 LibGUI: Load emoji icons for EmojiInputDialog through Gfx::Emoji
No difference when cold-loading the emoji icons, but for a warm load,
this provides a per-process cache of the loaded icons.
2022-09-16 15:20:59 +02:00
Timothy Flynn
98f99a9f7e LibGfx: Change Emoji::emoji_for_code_points to accept const code points
Span<u32 const> is the type used when converting a constant Vector<u32>
to a Span.
2022-09-16 15:20:59 +02:00
Timothy Flynn
35b74ebbfc LibGUI: Defer loading emoji icons until their first paint event
The EmojiInputDialog re-uses emoji buttons to help with performance as
filters are applied / removed. The downside of pre-creating the buttons
is that it currently takes upwards of 600ms (on my machine) to load all
emoji icons from disk at once. This will only become worse over time as
more emoji are added.

To alleviate this, defer loading the icons until they are needed for
painting (i.e. come into view).
2022-09-16 15:20:59 +02:00
Andreas Kling
cd7262ee56 LibWeb+LibWebView+WebContent: Add Web::Platform::ImageCodecPlugin
This replaces the previous Web::ImageDecoding::Decoder interface.
While we're doing this, also move the SerenityOS implementation of this
interface from LibWebView to WebContent. That means we no longer have to
link with LibImageDecoderClient in applications that use a web view.
2022-09-16 15:15:50 +02:00
Andreas Kling
412b2313f3 LibWeb: Improve inline flow around floating boxes
This patch combines a number of techniques to make inline content flow
more correctly around floats:

- During inline layout, BFC now lets LineBuilder decide the Y coordinate
  when inserting a new float. LineBuilder has more information about the
  currently accumulated line, and can make better breaking decisions.

- When inserting a float on one side, and the top of the newly inserted
  float is below the bottommost float on the opposite side, we now reset
  the opposite side back to the start of that edge. This improves
  breaking behavior between opposite-side floats.

- After inserting a float during inline layout, we now recalculate the
  available space on the line, but don't adjust X offsets of already
  existing fragments. This is handled by update_last_line() anyway,
  so it was pointless busywork.

- When measuring whether a line can fit at a given Y coordinate, we now
  consider both the top and bottom Y values of the line. This fixes an
  issue where the bottom part of a line would bleed over other content
  (since we had only checked that the top Y coordinate of that line
  would fit.)

There are some pretty brain-dead algorithms in here that we need to make
smarter, but I didn't want to complicate this any further so I've left
FIXMEs about them instead.
2022-09-16 15:15:50 +02:00
Andreas Kling
54e7359243 LibWeb: Repaint the page immediately when using the mouse to select
Otherwise we'd repaint the next time our "caret blink" timer would fire
(or something else caused a repaint). This made selection feel sluggish.
2022-09-16 15:15:50 +02:00
Enver Balalic
11a44ffb69 LibGfx: Recurse TrueType composite glyphs until a simple glyph is found
This fixes a bug in ladybird where it was crashing while rendering
characters like ščćž in the Noto Sans Regular font.

That font renders those characters as a composite where the caret
has numberOfContours = -1. When using the rasterize_impl simple path
for that, it would negatively overflow the offsets.
2022-09-16 14:52:03 +02:00
Liav A
e6306d459a Tests/Kernel: Add tests to ensure we don't regress InodeVMObjects 2022-09-16 14:55:45 +03:00
Liav A
0c675192c9 Kernel: Send SIGBUS to threads that use after valid Inode mmaped range
According to Dr. POSIX, we should allow to call mmap on inodes even on
ranges that currently don't map to any actual data. Trying to read or
write to those ranges should result in SIGBUS being sent to the thread
that did violating memory access.
2022-09-16 14:55:45 +03:00
Liav A
3ad0e1a1d5 Kernel: Handle mmap requests on zero-length data file inodes safely 2022-09-16 14:55:45 +03:00
Liav A
c88cc8557f Kernel/FileSystem: Make Inode::{write,read}_bytes methods non-virtual
We make these methods non-virtual because we want to ensure we properly
enforce locking of the m_inode_lock mutex. Also, for write operations,
we want to call prepare_to_write_data before the actual write. The
previous design required us to ensure the callers do that at various
places which lead to hard-to-find bugs. By moving everything to a place
where we call prepare_to_write_data only once, we eliminate a possibilty
of forgeting to call it on some code path in the kernel.
2022-09-16 14:55:45 +03:00
Liav A
4f4717e351 Kernel/FileSystem: Mark ext2 inode block list non-const
The block list required a bit of work, and now the only method being
declared const to bypass its const-iness is the read_bytes method that
calls a new method called compute_block_list_with_exclusive_locking that
takes care of proper locking before trying to update the block list data
of the ext2 inode.
2022-09-16 14:55:45 +03:00
Liav A
843bd43c5b Kernel/FileSystem: Mark ext2 inode lookup cache non-const
For the lookup cache, no method being declared const tried to modify it,
so it was easy to drop the mutable declaration on the HashMap member.
2022-09-16 14:55:45 +03:00
Andrew Kaster
b04de3090f Lagom: Skip IMPORTED targets in get_linked_lagom_libraries
This script is useful when wanting to install lagom libraries for
projects using Lagom via FetchContent, but trips over itself if the
project links other non-Lagom imported targets to itself. So, let's just
skip them.
2022-09-16 07:48:51 -04:00
MacDue
cfa9b44894 Base: Add a backdrop-filter demo web page 2022-09-16 10:50:48 +01:00
MacDue
011439d3e3 LibWeb: Paint backdrop-filter effects!
This implements all the filters other than `saturate()`,
`hue-rotate()`, and `drop-shadow()`.

There are still a lot of FIXMEs to handle in the actual implementation
though, particularly around supporting transforms, but this handles
the most common use cases :^)
2022-09-16 10:50:48 +01:00
MacDue
60356c8dde LibGfx: Support getting a bitmap for a region of painter
This will be needed so we can apply filter effects to the backdrop
of an element in LibWeb.

This now also allows getting a crop of a bitmap in a different format
than the source bitmap. This is for if the painter's bitmap does not
have an alpha channel, but you want to ensure the cropped bitmap does.
2022-09-16 10:50:48 +01:00
MacDue
978a70ddcc LibGfx: Add BrightnessFilter, ContrastFilter, and OpacityFilter
These filters are based off the ones defined in:
https://drafts.fxtf.org/filter-effects-1/#supported-filter-functions
2022-09-16 10:50:48 +01:00
MacDue
8f225acf58 LibGfx: Allow applying all color filters with an amount
This amount can be handled in the filter's implementation or if
not it will default to mixing between the new and previous pixel.

This behaviour is used for implementing CSS filters that allow stuff
like grayscale(70%).
2022-09-16 10:50:48 +01:00
MacDue
7bc0c66290 LibWeb+LibGfx: Move premultiplied alpha mixing to color.mixed_with()
This will be needed for mixing filters in LibGfx (and may be
generally useful elsewhere).
2022-09-16 10:50:48 +01:00
MacDue
ec4de1e07d LibWeb: Plumb style/computed values for backdrop-filter 2022-09-16 10:50:48 +01:00
MacDue
d1b99282d8 LibWeb+Meta: Parse the backdrop-filter CSS property
Note: The parsing and style value completely ignores the SVG filters
part of the spec for now... That's a yak for another day :^)
2022-09-16 10:50:48 +01:00
MacDue
980c92e9b5 LibWeb: Add FilterValueListStyleValue
This style value holds a list of CSS filter function calls e.g.

blur(10px) invert() grayscale()

It will be used to implement backdrop-filter, but the same style value
can be used for the image filter property.

(The name is a little awkward but it's referenced to as
filter-value-list in the spec too).
2022-09-16 10:50:48 +01:00
MacDue
776538a6c4 LibWeb: Add operator== to CSS::Number
This will be needed for the .equals() function of the backdrop-filter
style value.
2022-09-16 10:50:48 +01:00
MacDue
84d9a226e6 LibWeb: Add NumberPercentage CSS type
This type is used quite a bit in CSS filters.
2022-09-16 10:50:48 +01:00
MacDue
0829aa5df0 Meta: Use is_abstract_image() for the "image" CSS type 2022-09-16 10:50:48 +01:00
MacDue
b219931dfc LibWeb: Pass values by reference in style value operator== functions 2022-09-16 10:50:48 +01:00
Tim Schumacher
671712cae6 CMake: Use -static-libstdc++ on Clang as well
This resolves an old FIXME that we added ages ago, and our LLVM driver
apparently gained support for `-static-libstdc++` somewhere along the
way.
2022-09-16 05:39:28 +00:00
Tim Schumacher
88ff01bb17 LibC: Remove _aligned_malloc and _aligned_free
We now have a proper aligned allocation implementation, and the
toolchain patch to make Clang use the intermediary implementation
has already been removed in an earlier iteration.
2022-09-16 05:39:28 +00:00
Tim Schumacher
119567e176 Ports: Remove the duplicated Clang compiler symlinks
Those have been added to the Clang build script in
d4d6f2d945, and now that the Clang version
has been updated, everyone should have those symlinks already anyways.
2022-09-16 05:39:28 +00:00
Tim Schumacher
f45238db0f Toolchain: Update to LLVM 15.0.0 2022-09-16 05:39:28 +00:00
Tim Schumacher
388dc9cc5f LibJS: Supress an unused bind when wrapping float atomic operations 2022-09-16 05:39:28 +00:00
Tim Schumacher
8763dbcccc Everywhere: Remove a bunch of dead write-only variables
LLVM 15 now warns (and thus errors) about this, and there is really no
point in keeping them.
2022-09-16 05:39:28 +00:00
Tim Schumacher
643d2a683b AK: Define both ::nullptr_t and std::nullptr_t
LLVM 15 switched around what it's basing its `nullptr_t` definitions on,
it's now defining `std::nullptr_t` using `::nullptr_t` instead of the
other way around.

Work around any errors that result from that by just defining it both in
the global namespace as well as in `std` ourselves.
2022-09-16 05:39:28 +00:00
Ben Wiederhake
79ec6ed03d Shell: Fix 'Command:' output for built-in 'time' command 2022-09-16 05:38:09 +00:00
Hendiadyoin1
6b6510b577 AK+Tests: Don't double-destroy NoAllocationGuard in TestFixedArray
This caused the m_allocation_enabled_previously member to be technically
uninitialized when the compiler emits the implicit destructor call for
stack allocated classes.
This was pointed out by gcc on lagom builds, no clue how this was flying
under the radar for so long and is not triggering CI.
2022-09-15 23:04:46 +00:00
Joel Hansen
7bb8d26b0c Base: Add 13 emoji
U+1F3A4 - Microphone
U+1F3D7 - Crane
U+1F4BC - Briefcase
U+1F4BD - Computer Disk
U+1F4DC - Scroll
U+1F6CF - Bed
U+1F6D1 - Stop Sign
U+1F9A2 - Swan
U+1F37D - Plate with knife and fork
U+1F96A - Sandwich
U+1F438 - Frog
U+1F441 - Eye
U+1F489 - Syringe
2022-09-15 22:59:37 +00:00
Mykola
2cb21b295f Base: Add new emoji
Added the 🎑 emoji, also known as "Moon Viewing Ceremony".
Additionally added the 🌊 emoji, the 🧵 emoji, and the
🌉 emoji.
2022-09-15 21:05:13 +01:00
Andreas Kling
d1dac8695c LibWeb: Don't set initial font+color on both HTML and BODY elements
It's enough to set it on the HTML element. That way, it doesn't get
reset in content that sets its own font on HTML but not on BODY.
2022-09-15 16:16:56 +02:00
Andreas Kling
1dd4e2dc87 LibWeb: Cache lowercased names in SimpleSelector
When matching selectors in HTML documents, we know that all the elements
have lowercase local names already (the parser makes sure of this.)

Style sheets still need to remember the original name strings, in case
we want to match against non-HTML content like XML/SVG. To make the
common HTML case faster, we now cache a lowercase version of the name
with each type/class/id SimpleSelector.

This makes tag type checks O(1) instead of O(n).
2022-09-15 16:16:56 +02:00
Andreas Kling
d9c64ee876 LibWeb: Hoist case sensitivity check out of loop in Element::has_class() 2022-09-15 16:16:56 +02:00
Ben Wiederhake
8deced39a8 LibWeb: Resolve cyclic declaration/definitions involving Length
This remained undetected for a long time as HeaderCheck is disabled by
default. This commit makes the following file compile again:

    // file: compile_me.cpp
    #include <LibWeb/CSS/GridTrackSize.h>
    // That's it, this was enough to cause a compilation error.
2022-09-15 14:45:38 +01:00
Lucas CHOLLET
53eb35caba Calculator: Change internal representation to support perfect division
The purpose of this patch is to support addition, subtraction,
multiplication and division without using conversion to double. To this
end, we use the BigFraction class of LibCrypto. With this solution, we
can store values without any losses and forward rounding as the last
step before displaying.
2022-09-15 14:08:21 +01:00
Lucas CHOLLET
4ab8ad2ed2 LibCrypto: Fix -0 and 0 non-equality
SignedBigInteger::operator==(const UnsignedBigInteger&) was rejecting
all negative value before testing for equality. It now accepts negative
zero and test for a value equality with the UnsignedBigInteger.
2022-09-15 14:08:21 +01:00
Lucas CHOLLET
6a937312b3 LibCrypto: Add BigFraction
This new abstraction allows the user to store rational numbers with
infinite precision.
2022-09-15 14:08:21 +01:00