Commit graph

28136 commits

Author SHA1 Message Date
Ben Wiederhake
98a0f9c0bd LibPDF: Rely on default-constructor of Variant 2021-09-21 04:22:52 +04:30
Ben Wiederhake
9265595e42 LibIMAP: Remove unused Variant option 2021-09-21 04:22:52 +04:30
Ben Wiederhake
12247fe9b4 Kernel: Use AK::Variant default initialization where appropriate 2021-09-21 04:22:52 +04:30
Ben Wiederhake
743470c8f2 AK: Introduce ability to default-initialize a Variant
I noticed that Variant<Empty, …> is a somewhat common pattern while
working on #10080, and this will simplify a few use-cases. :^)
2021-09-21 04:22:52 +04:30
David Isaksson
f261b68408 WindowServer: Apply screen scaling when getting bitmap around cursor
This fixes an issue for the magnifier that when the screen scaling is
increased to 2 the magnifier doesn't center around the cursor.

Since booting Serenity with multiple displays doesn't work at the moment
the rescaling is only added for the one display case.
2021-09-20 22:25:24 +02:00
Tobias Christiansen
548ebbc233 LibWeb: Resolve 'inherit' property-value somewhat
This doesn't capture the whole picture as shorthands are not considered
in a careful way.
A very dirty hack is included to not try to resolve 'font' as the amount
of debug spam it generated ("No inital value found for...") was
unhelpful.
2021-09-20 22:18:45 +02:00
Sam Atkins
a50f4d2fc9 LibWeb: Enable bilinear blending for bitmaps
This is slower, but looks a lot nicer. :^)
2021-09-20 22:18:20 +02:00
Sam Atkins
1c807410cd LibGfx: Add optional bilinear filtering to draw_scaled_bitmap()
The algorithm is quite simple: You grab a 2x2 area of pixels around the
point you want from the source bitmap, and then linearly interpolate
between them based on how far they are from that point.

This works well when scaling up images, and moderately well when scaling
down - small details may get skipped over. The way GPUs solve this is
with mipmaps, which is not something I want to get into right now. (And
increases the memory usage per bitmap by 50%.)

I have not focused on performance, but this does reuse much of the
existing fixed-point calculation, and uses constexpr so that the
performance for nearest-neighbor should be the same as it was
previously.
2021-09-20 22:18:20 +02:00
Sam Atkins
10e54a29b2 Base: Add several scaled images to test page
These look really bad with our current nearest-neighbor image scaling,
so they are a good test case to see how well other scaling algorithms
work.
2021-09-20 22:18:20 +02:00
Itamar
a3360bcee8 LibC+DynamicLoader: Store the auxiliary vector address at startup
Previously, getauxval() got the address of the auxiliary vector by
traversing to the end of the `environ` pointer.

The assumption that the auxiliary vector comes after the environment
array is true at program startup, however the environment array may
be re-allocated and change its address during runtime which would cause
getauxval() to work with an incorrect auxiliary vector address.

To fix this, we now get the address of the auxiliary vector once in
__libc_init and store it in a libc-internal pointer which is then used
by getauxval().

Fixes #10087.
2021-09-20 18:32:09 +02:00
Andreas Kling
01900801e3 LibWeb: Implement <script src> execution for non-blocking scripts 2021-09-20 17:22:25 +02:00
Andreas Kling
c34da16089 LibWeb: Make <script src> loads partially async (by following the spec)
Instead of firing up a network request and synchronously blocking for it
to finish via a nested event loop, we now start an asynchronous request
when encountering <script src>.

Once the script load finishes (or fails), it gets executed at one of the
synchronization points in the HTML parser.

This solves some long-standing issues with random unexpected events
getting dispatched in the middle of parsing.
2021-09-20 17:22:25 +02:00
Andreas Kling
e11ae33c66 LibWeb: Pop entire stack of open elements at the end of parsing 2021-09-20 17:22:25 +02:00
Andreas Kling
398692722b LibWeb: Implement an ad-hoc version of EventLoop::spin_until(condition)
This doesn't follow the exact spec steps but instead simply makes a
nested Core::EventLoop and spins it while a periodic timer tests the
goal condition.
2021-09-20 17:22:25 +02:00
Andreas Kling
60d0f041b7 LibWeb: Use Document::realm() in HTMLScriptElement::prepare_script() 2021-09-20 17:22:25 +02:00
Karol Kosek
bcfb07bc30 WidgetGallery: Crop animated cursors
Selecting the wait cursor displayed the full sprite image.

This has been borrowed from the MouseSettings.
2021-09-20 15:59:34 +02:00
Karol Kosek
d1846867cd WidgetGallery+MouseSettings: Use LexicalPath::basename() 2021-09-20 15:59:34 +02:00
Karol Kosek
9ddd2fdcc5 WidgetGallery: Simplify cursor change code
The code here wasn't updated when a new file icons appeared, so double-
-clicking a cursor didn't always set it to the correct one.

Also, the cursor list is sorted alphabetically, by the file name.
So if a theme used a different file naming in Config.ini, then
the previous code would also be incorrect.

Here we will just take the bitmap icon from the model.

Closes: #10142
2021-09-20 15:59:34 +02:00
Karol Kosek
38bc81015b LibGUI: Update the window cursor if it was provided as a bitmap
This condition rejected almost every bitmap cursor change.
2021-09-20 15:59:34 +02:00
Kenneth Myhra
3b901e5b2b LibC: Spec compliant IN6_IS_ADDR_V4MAPPED
An IPv4 mapped IPv6 address consist of 80 "0" bits, followed by 16 "1"
bits, followed by the 32-bit IPv4 address.

Example of IPv4 mapped IPv6 address:
IPv4 address: 169.219.13.133
IPv6 address: 0000:0000:0000:0000:FFFF:A9DB:0D85
Simplified  : ::FFFF:A9DB:0D85
2021-09-20 15:26:46 +02:00
Ben Wiederhake
f84a7e2e22 LibPDF: Replace Value class by AK::Variant
This decreases the memory consumption by LibPDF by 4 bytes per Value,
compensating exactly for the increase in an earlier commit. :^)
2021-09-20 17:39:36 +04:30
Ben Wiederhake
d344253b08 LibPDF: Extract reference bitpacking into dedicated class 2021-09-20 17:39:36 +04:30
Ben Wiederhake
da170997d5 LibPDF: Move inline function definition
This breaks the dependency cycle between Parser and Document.
2021-09-20 17:39:36 +04:30
Ben Wiederhake
edc0cd29f8 LibPDF: Break weird dependency cycle
Old situation:
Object.h defines Object
Object.h defines ArrayObject
ArrayObject requires the definition of Object
ArrayObject requires the definition of Value
Value.h defines Value
Value requires the definition of Object

Therefore, a file with the single line "#include <Value.h>" used to
raise compilation errors; certainly not something that one might expect
from a library.

This patch splits up the definitions in Object.h to break the cycle.
Now, Object.h only defines Object, Value.h still only defines Value (and
includes Object.h), and the new header ObjectDerivatives.h defines
ArrayObject (and includes both Object.h and Value.h).
2021-09-20 17:39:36 +04:30
Ben Wiederhake
7ddd11729d LibPDF: Add missing headers in Value.h 2021-09-20 17:39:36 +04:30
Ben Wiederhake
35674b8a42 LibPDF: Fix math error in comments 2021-09-20 17:39:36 +04:30
Ben Wiederhake
750bed254f LibPDF: Switch to automatic ref counting, fix memory leak
At least `Value::operator=` didn't properly unref the `PDF::Object` when
it was called. This type of problem is removed by just letting `RefPtr`
do its thing.

This patch increases the memory consumption by LibPDF by 4 bytes (the
other union objects) per value.
2021-09-20 17:39:36 +04:30
Ben Wiederhake
05006e63c4 LibPDF: Add missing headers to XRefTable.h 2021-09-20 17:39:36 +04:30
Ben Wiederhake
6089c4d97d LibPDF: Add missing headers to Reader.h 2021-09-20 17:39:36 +04:30
Ben Wiederhake
6836ca2136 LibPDF: Add missing headers to Forward.h 2021-09-20 17:39:36 +04:30
Ben Wiederhake
de15a6a657 Kernel: Clean up PCI::Device namespace formatting 2021-09-20 16:00:43 +03:00
Marcus Nilsson
f9e0815c3b PixelPaint: Move Tools to it's own subdirectory
The PixelPaint source directory was getting a bit large, let's move all
the Tools to it's own subdirectory. Also remove some unused includes.
2021-09-20 03:04:24 +00:00
Andrew Kaster
61ad239ee0 AK: Remove unnecessary include of <new> for non-__serenity__ builds
We already include `<new>` in AK/kmalloc.h when KERNEL is not defined,
which applies to all non-`__serenity__` builds.
2021-09-20 00:39:46 +00:00
Andrew Kaster
da87497e61 AK+LibC: Remove SERENITY_LIBC_BUILD guard around <initializer_list>
This was required before commit 5f724b6ca1
when we were building LibC before libstdc++ headers were available in
the sysroot. However as noted in that commit, we never actually needed
to be building LibC before libstdc++, so we can go ahead and remove this
ancient hack.
2021-09-20 00:39:46 +00:00
Andrew Kaster
210b0b883b AK: Remove unused ifdef for BUILDING_SERENITY_TOOLCHAIN
The only use of this define was removed in commit
5f724b6ca1, over a year ago.

The define was there to prevent the LibC build we built before libstdc++
from complaining about missing libgcc symbols. However, as noted in that
commit, we never actually needed to build LibC at all.
2021-09-20 00:39:46 +00:00
Ali Mohammad Pur
b946a1ce48 Shell: Make ArgsParser not exit on failure in builtin_exit()
Fixes #10128.
2021-09-20 03:31:57 +04:30
Tobias Christiansen
f6ffa09437 Meta: Add section to CLion Configuration Docs about including headers 2021-09-19 22:57:58 +02:00
Sam Atkins
0cedb7a7c4 LibWeb: Give InlineNodes borders :^) 2021-09-19 22:53:35 +02:00
Sam Atkins
e1f3fb0146 LibWeb: Move border-painting code out of Box
The logic here is needed by InlineNode too. Moving it into a
`paint_all_borders()` function makes it available to them both, as well
as anyone else who wants it. :^)
2021-09-19 22:53:35 +02:00
Sam Atkins
eb07668589 LibGfx: Add per-side overloads of Rect::inflate() and ::shrink()
These are in CSS order (top, right, bottom, left) since LibWeb is the
reason I'm adding these. :^)
2021-09-19 22:53:35 +02:00
Sam Atkins
0712036485 LibWeb: Give InlineNodes a box-shadow :^) 2021-09-19 22:53:35 +02:00
Sam Atkins
912596fae8 LibWeb: Give InlineNodes a background
This now uses the same code as Box, so images, repeat-rules, and
anything that's added in the future will work for `display: inline`
elements too. :^)
2021-09-19 22:53:35 +02:00
Sam Atkins
14dc20118c Base: Add page for testing styling on display: inline elements 2021-09-19 22:53:35 +02:00
Sam Atkins
abc22b727c LibWeb: Move background painting from Box to its own file
This makes the code accessible to things that aren't a Box, such as
InlineNode.
2021-09-19 22:53:35 +02:00
Sam Atkins
b047c1bc97 LibWeb: Move box-shadow painting out of Box to its own file
This makes the code accessible to things that aren't a Box, such as
InlineNode.
2021-09-19 22:53:35 +02:00
Sam Atkins
3b6325e787 LibWeb: Move InlineNode background code from paint_fragment -> paint
`paint_fragment()` seems to never get called. Moving the painting to
`paint()` fixes the background.
2021-09-19 22:53:35 +02:00
Sam Atkins
aaf12929d5 LibWeb: Extract border-radius normalization code from Box
This is going to be needed by InlineNodes too!

`BorderPainting.{h,cpp}` might not be the best place for it, but it
works for now.
2021-09-19 22:53:35 +02:00
Sam Atkins
b88641e44b LibWeb: Stop painting backgrounds for TextNodes
Doing so was causing the background to be painted twice, which looks
ugly if the background is semi-transparent. The painting is a bit of a
hack, as some situations apparently relied on it. This commit is ripping
the band-aid off to find where those are and fix them. :^)
2021-09-19 22:53:35 +02:00
Andreas Kling
7ef4d75716 LibWeb: Implement XMLHttpRequest.getAllResponseHeaders() 2021-09-19 22:34:44 +02:00
Andreas Kling
95559c4277 LibWeb: Implement basic support for MessageChannel and MessagePort
This patch adds a basic initial implementation of these API's.

Since LibWeb currently doesn't support workers, this implementation of
messaging doesn't bother with serializing and deserializing messages.
2021-09-19 22:34:44 +02:00