Commit Graph

27928 Commits

Author SHA1 Message Date
Tim Schumacher
ff0ab8b9a9 LibC: Implement wctrans 2021-09-17 22:59:51 +00:00
Tim Schumacher
7b17230d7a LibC: Implement wctype 2021-09-17 22:59:51 +00:00
Tim Schumacher
ac406c8d0e LibC: Change wctrans_t to be a long instead of int*
The POSIX manpage just says that wctrans_t should be "a scalar type that
can hold values which represent locale-specific character mappings", and
doing switch statements with ints is much more pleasant than with
pointers.
2021-09-17 22:59:51 +00:00
Tobias Christiansen
2f891fd4b8 LibWeb: Flexbox: Take parent's width in the flex container for layouting
If our parent in the FlexFormattingContext also was a flex-container, we
didn't give our children any meaningful width to play with into
layout_inside(), which resulted in way too narrow layouting.
Now the width of the parent gets borrowed if the own width isn't
specified.
2021-09-17 23:51:03 +02:00
Tobias Christiansen
3cc6ffd4a6 LibGfx: Don't crash on request to draw impossible circle segment
The previous VERIFY_NOT_REACHED() could be reached when there were equal
coodinates. This could be the case for a small radius which lead to
rounding making the two coordinates equal.
2021-09-17 23:51:03 +02:00
Marcus Nilsson
401ea85655 Magnifier: Add 8x magnification and pausing
This adds an option for even more magnification, when you really need to
count pixels, as well as pausing the capture by pressing Space and
switching between magnification levels with keys 2, 4 & 8.
2021-09-17 23:48:42 +02:00
Linus Groh
6bdd62b51b LibJS: Convert Now AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Linus Groh
d764f1c699 LibJS: Convert PlainDateTime AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Linus Groh
35bba1c98d LibJS: Convert PlainDate AOs to ThrowCompletionOr 2021-09-17 23:43:01 +02:00
Ali Mohammad Pur
433725fef2 LibGfx: Implement cubic bezier curves by splitting them to subcurves
This makes them significantly more nicer-looking, and fixes a FIXME :^)
2021-09-18 02:12:38 +04:30
Ali Mohammad Pur
02d949cfb6 LibGfx: Switch Painter.{h,cpp} to use east-const 2021-09-18 02:12:38 +04:30
Ali Mohammad Pur
5a2e7d30ce LibWeb: Use Gfx::AntiAliasingPainter to draw SVG paths
This is still quite bad, but it's much more pleasing to look at when
drawing random SVGs :^)
2021-09-18 02:12:38 +04:30
Ali Mohammad Pur
e2cd558101 LibGfx: Start a very basic anti-aliased Painter implementation
This can currently draw AA lines (and by proxy, AA paths), and passes
all its output through a 2D affine transform to an underlying
Gfx::Painter.
2021-09-18 02:12:38 +04:30
Sam Atkins
f4ea235a33 LibWeb: Replace hard-coded defaults in Node::apply_style()
This now uses the values in `InitialValues`, which is not ideal, but
it's better to have our defaults defined in two places, than in 3.

The default for `border-colors` is `currentcolor`, so we shortcut that
here and just grab the value of the `color` property. As noted, this is
not perfect, but it's somewhat better.
2021-09-17 23:06:45 +02:00
Sam Atkins
0053314dd1 LibWeb: Use initial values from Properties.json inside CSS Parser
This replaces several hard-coded initial values, with use of
`property_initial_value()`.
2021-09-17 23:06:45 +02:00
Sam Atkins
4f81cb927a LibWeb: Correct some initial values and add missing ones
- The `text-decoration-foo` values now match the spec.
- Added values for `border-foo` since those are needed soon.
- Make `color`'s initial value be `-libweb-palette-base-text`.
2021-09-17 23:06:45 +02:00
Sam Atkins
fc11b1f242 LibWeb: Add some more CSS identifiers
These are used by the "initial" values in Properties.json
2021-09-17 23:06:45 +02:00
Sam Atkins
6ea9edf84b LibWeb: Generate shorthand initial values after their longhands
When parsing shorthand values, we'd like to use
`property_initial_value()` to get their longhand property values,
instead of hard-coding them as we currently do. That involves
recursively calling that function while the `initial_values` map is
being initialized, which causes problems because the shorthands appear
alphabetically before their longhand components, so the longhands aren't
initialized yet!

The solution here is to perform 2 passes when generating the code,
outputting properties without "longhands" first, and the rest after.
This could potentially cause issues when shorthands have multiple
levels, in particular `border` -> `border-color` -> `border-left-color`.
But, we do not currently define a default value for `border`, and
`border-color` takes only a single value, so it's fine for now. :^)
2021-09-17 23:06:45 +02:00
Sam Atkins
bb1cc99750 LibWeb: Stop treating EOF as a valid part of an identifier
This was specifically causing the string "0" to be parsed as an invalid
Dimension token with no units, instead of as a Number. That then caused
out generated `property_initial_value()` function to fail for those
values.
2021-09-17 23:06:45 +02:00
Sam Atkins
2a3675f0c1 LibWeb: Make "currentcolor" lowercase in Properties.json
It's technically case-insensitive, but the spec always defines it as
"currentcolor" so it feels wrong to capitalise it differently there.
2021-09-17 23:06:45 +02:00
Sam Atkins
854d6e5822 LibWeb: Persuade CSS Parser that idents like currentcolor are colors
Shorthand properties were only checking for `ColorStyleValue`s, which
excludes identifier colors. Now they accept them too, including the
various `-libweb-foo` colors. :^)
2021-09-17 23:06:45 +02:00
Sam Atkins
17bb913625 LibWeb: Implement currentcolor special value
The `currentcolor` identifier represents the current value of the
`color` property. This is the default value for `border-color` and
`text-decoration-color`, and is generally useful to have. :^)
2021-09-17 23:06:45 +02:00
Sam Atkins
86f78bff2a LibWeb: Make StyleValue::to_color() take a Node instead of the Document
This is in preparation for the `currentcolor` value, which needs to know
what Node it's on so it can check the `color`.
2021-09-17 23:06:45 +02:00
Julian Offenhäuser
8657148194 SystemMonitor: Make process memory statistics more human readable
These are the only instances in SystemMonitor which still show memory
statistics in KiB only. They will now adapt to the input size better.
2021-09-17 20:12:48 +02:00
Mustafa Quraish
f552c26c79 Utilities: Add a basic diff utility 2021-09-17 16:56:59 +00:00
Mustafa Quraish
5e28da1aa4 LibDiff: Add new API to generate hunks from two pieces of text
For now this is just a standard implementation of the longest
common subsequence algorithm over the lines, except that it doesn't
do any coalescing of the lines. This isn't really ideal since
we get a single Hunk per changed line, and is definitely something
to improve in the future.
2021-09-17 16:56:59 +00:00
Mustafa Quraish
27f28998b1 AK/Vector: Add Vector::reverse() method
This reverses the contents of the vector in-place.
2021-09-17 16:56:59 +00:00
Nico Weber
a339b73fc2 Kernel: Don't link Prekernel against kernel_heap
This was added in b5c98ede08, but it looks like a copy-paste
mistake from Kernel/CMakeLists.txt.

Unbreaks building for aarch64.
2021-09-17 17:59:22 +03:00
Andreas Kling
f58b2a0358 LibJS: Increase time between garbage collections
This patch ups the max number of heap allocations between each GC
from 10'000 to 100'000. This is still relatively aggressive but already
does a good job of cutting down on time spent in GC.
2021-09-17 15:23:18 +02:00
Andreas Kling
c2c007b356 LibWeb: Don't request WebContent repaint while we have repaints pending
This prevents flickering by ensuring that WebContent is only ever
painting into the back buffer bitmap. Without this change, it was
possible for WebContent to paint into the front buffer bitmap.
2021-09-17 14:54:51 +02:00
Andreas Kling
17a5c96b7c LibWeb: Make a SharedBitmap struct for OOPWV bitmaps
Instead of having separate members for "bitmap ID" and "bitmap", let's
wrap them in a struct.
2021-09-17 14:39:42 +02:00
Andreas Kling
c8c3828b59 LibGfx: Avoid invalidation when Path::close() is a no-op
If the path is already closed, calling close() is a no-op, and we don't
need to invalidate the split lines cache.
2021-09-17 13:41:34 +02:00
Andreas Kling
32b9d80ee5 LibGfx: Make Painter::fill_path() take Path by const reference
Taking a mutable reference here made the API look very strange.
2021-09-17 13:41:03 +02:00
Andreas Kling
8c863ad959 LibGfx: Make Path::bounding_box() and Path::split_lines() const
Use a const_cast internally when segmentizing. As far as clients are
concerned, these are const operations.
2021-09-17 13:40:34 +02:00
Andreas Kling
5726017414 LibGfx: Move FastBoxBlurFilter to its own .cpp file 2021-09-17 13:20:18 +02:00
Andreas Kling
f9a38fa693 LibGfx: Don't use unbounded VLA's in FastBoxBlurFilter
These would cause the stack to overflow when LibWeb tried rendering a
CSS box-shadow for a large enough element.

Use Vector (with *some* inline capacity for smaller images) to avoid
this issue. If these heap allocations turn out to be too much work,
we can add something like a persistent scratch buffer cache.
2021-09-17 13:20:18 +02:00
Andreas Kling
4fcb1be734 LibWeb: Skip rendering box-shadow blur if we don't have memory for it
A slight loss in graphical fidelity is better than not rendering the
page at all.
2021-09-17 13:20:18 +02:00
Andreas Kling
850795e088 LibGfx: Make some coding style fixes to FastBoxBlurFilter 2021-09-17 13:20:18 +02:00
Andreas Kling
e2e6c12ea0 LibWeb: Make ComputedValues return larger items by const reference 2021-09-17 13:20:18 +02:00
Andreas Kling
11bb6e045f LibWeb: Add the IdleDeadline interface from the RequestIdleCallback spec 2021-09-17 13:20:18 +02:00
Andreas Kling
64df30230d LibWeb: Add HTML::Task::Source::IdleTask
This represents what the spec calls the "idle-task task source".
2021-09-17 13:20:18 +02:00
Andrew Kaster
99b526731e CI: Add missing $ to Sonar Cloud build steps
Without the `$` GitHub Actions doesn't do the environment variable
replacement and CMake thinks we want a source directory of `./}}`
2021-09-17 11:03:27 +01:00
Mustafa Quraish
090962823b PixelPaint: Allow selecting a custom aspect ratio for RectangleTool
If you enter a custom aspect ratio, and are not holding down shift,
the rectangle will be constrained to the entered aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
6ba3fc559f PixelPaint: Allow selecting a custom aspect ratio for EllipseTool
If you enter a custom aspect ratio, and are not holding down shift,
the bounding rect for the ellipse will be constrained to the entered
aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
f14c891ba5 LibGfx+PixelPaint: Add Point::end_point_for_aspect_ratio method
Previously we only had `Point::end_point_for_square_aspect_ratio`,
which was convenient for PixelPaint but assumed the aspect ratio
was always fixed at 1. This patch replaces it with a new mthod that
takes in an arbitrary aspect ratio and computes the end point based
off that.

There's some explicit casting going on in `Point.cpp` to ensure that
the types line up, since we're templating Point based on `T`.`
2021-09-17 11:54:13 +02:00
Brian Gianforcaro
5c244a7893 Meta: Set SERENITY_ARCH if it is not set in debug-kernel.sh
This appears to have regressed recently in commit 783a58dbc.
2021-09-17 09:16:40 +00:00
Eyad Hossam
fe9e2f463c Browser: Remove redundant tab::view() call from the tab constructor 2021-09-17 10:45:37 +03:00
Linus Groh
20337a34a2 LibJS: Convert Instant AOs to ThrowCompletionOr 2021-09-17 08:25:12 +01:00
Linus Groh
ea7cc70118 LibJS: Convert Duration AOs to ThrowCompletionOr 2021-09-17 08:25:12 +01:00
Linus Groh
f8d92232c8 LibJS: Convert Calendar AOs to ThrowCompletionOr 2021-09-17 08:25:12 +01:00