Commit graph

16675 commits

Author SHA1 Message Date
MacDue 9ed5b2dfb5 LibGfx: Move AntiAliasingPainter.cpp into Gfx namespace 2022-06-18 02:34:56 +01:00
MacDue e4cca7886e LibWeb: Use the AA painter for drawing dotted lines
The AA painter will actually draw the dots as circles, which is
how other browsers handle this.
2022-06-18 02:34:56 +01:00
MacDue 6139fc5c87 LibGfx: Add AA dotted horizontal/vertical lines
This adds simple dotted lines (horizontal/vertical only for now).

There's a little number fudging added in to make sure the final
dot is always drawn at the endpoint (for lines with at least a
handful of dots).
2022-06-18 02:34:56 +01:00
kleines Filmröllchen 96180fc2d9 LibC: Add printf and scanf format macros for "fast" and "least" types
As usual, we just define these based on the given integer size itself.
2022-06-17 21:53:28 +01:00
Linus Groh d9fc09c6e5 LibJS/Tests: Remove outdated FIXME 2022-06-17 21:06:01 +01:00
Linus Groh 25667a834c ThemeEditor: Run gml-format 2022-06-17 19:49:16 +01:00
networkException 8163faa696 DisplaySettings: Use IPC calls instead of current_system_theme helper 2022-06-17 19:46:30 +01:00
networkException ccb31b347e LibGfx: Rename DO_PATH macro to ENCODE_PATH to match ThemeEditor 2022-06-17 19:46:30 +01:00
networkException 28f4b67bdc ThemeEditor: Allow temporarily overriding the system theme
This patch introduces two new buttons to apply the current theme being
edited to the whole system and to reset to the previously selected
on disk system theme.
2022-06-17 19:46:30 +01:00
networkException e2d2b403e9 DisplaySettings: Handle an override theme being active
This patch updates the "Theme" tab to react to an override theme being
set. The preview will reflect the override theme and the combo box will
show no selection.
2022-06-17 19:46:30 +01:00
networkException c76c3e38e6 LibGUI: Support setting an in memory theme in AbstractThemePreview 2022-06-17 19:46:30 +01:00
networkException ef7fbbcf70 Taskbar: Handle an override theme being active
This patch makes taskbar react to an override theme being set by not
having any theme in the menu selected.
2022-06-17 19:46:30 +01:00
networkException 976b6156d4 WindowServer: Allow temporarily overriding the system theme
This patch adds a new api to override the current system theme with an
in memory override theme.
2022-06-17 19:46:30 +01:00
networkException 278fd28502 DisplaySettings: Update selected theme on change
Previously the "Theme" tab in DisplaySettings would only reflect the
current theme on startup and get out of sync when a theme would get
selected using the taskbar menu.
2022-06-17 19:46:30 +01:00
networkException 82f537b847 LibGUI: Actually update the selection in ComboBox::set_selected_index
Previously we would not set m_selected_index or the editor's text value
when calling set_selected_index.
2022-06-17 19:46:30 +01:00
networkException 695dfabc2e Taskbar: Update checked state of theme menu on global theme change
Previously we would assume that the theme would only change through the
taskbar menu. As the theme can also be changed in DisplaySettings, the
selected theme in the taskbar menu would get out of sync.

With this patch the menu will get updated every time the theme changes
and the menu is not shown.
2022-06-17 19:46:30 +01:00
networkException 535e1c9152 LibGUI: Add on_theme_change callback to Application
This allows an Application without a window to listen for theme changes.
2022-06-17 19:46:30 +01:00
networkException 84780f3ed5 LibGUI: Add clear_selection helper for ComboBox
This patch adds a helper to ComboBox allowing it to clear the current
selection and show a blank editor.
2022-06-17 19:46:30 +01:00
ferhatgec e9e1959d4c BrowserSettings: Avoid adding empty domain to content filter 2022-06-17 19:45:52 +01:00
Tim Schumacher 2a45d30302 LibC: Allow parsing numbers right on the cutoff 2022-06-17 11:24:27 +01:00
SeekingBlues cba4750921 LibC: Add POSIX spec links to wait, waitpid and waitid 2022-06-17 10:59:26 +02:00
SeekingBlues 4796a25bbd LibC: Make waitpid's return value more POSIX-compliant
* Always return 0 if `WNOHANG` is specified and no waitable child is
  found, even if `wstatus` is null.
* Do not return 0 if the child is continued. Treat it the same way as
  all the other states.

Refer to the RETURN VALUE section of the POSIX spec:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html
2022-06-17 10:59:26 +02:00
SeekingBlues 8730e56e88 LibC: Add WIFCONTINUED macro
Like other systems, we can encode the continued state with 0xffff in the
status value. This is needed for some ports.
2022-06-17 10:59:26 +02:00
FrHun 5a73bf1553 LibGUI: End Scrollbar gutter tinting when target is reached
Before, when holding at a location in the gutter until the scrubber
reached that location, the gutter would stay tinted, even after the
target was reached, and the scrubber didn't move any more; only
stopping when the pointer was moved.
2022-06-17 09:58:10 +01:00
FrHun 2f388065c8 LibGUI: Fix crash on Scrollbar shift click and re enable jumping
Previously clicking in the gutter of an activated scrollbar while
holding shift would crash on the removed VERIFY.
2022-06-17 09:58:10 +01:00
MacDue c9a70ffff5 LibWeb: Fix 'background-repeat: round' calculation
Previously, this was slightly off and not doing what the spec comment
above asked for. This led to really small values for x_step and
y_step, making the `backgrounds.html' example use crazy amounts of
CPU whist painting.
2022-06-17 09:37:39 +01:00
MacDue c491ab7523 LibWeb: Only paint the background image on integer steps
This avoids excessive over painting.
2022-06-17 09:37:39 +01:00
Sam Atkins c4ef4fcd72 LibWeb: Add deprecated image-rendering values
From the spec:

> This property previously accepted the values optimizeSpeed and
  optimizeQuality. These are now deprecated; a user agent must accept
  them as valid values but must treat them as having the same behavior
  as pixelated and smooth respectively, and authors must not use them.

- https://www.w3.org/TR/css-images-3/#the-image-rendering
2022-06-16 17:36:13 +01:00
FrHun 1b4ab8626b LibWeb: Disable unused error on temporarily unused variable from spec 2022-06-16 17:20:49 +01:00
Paweł Łukasik a0ffdeb58a Keymap: Fix switching selected keymap
Previously keymap did switching of the selected keymap twice when the
command was executed. First set it to the first keymap on the list and
later, if present, to the chosen one.

Currently the switching to the first keymap on the list is done only
when the selection is not present or it's not on the list of keymaps.
2022-06-16 14:58:43 +01:00
Karol Kosek 54687c63af PixelPaint: Add Smooth Pixels scaling option 2022-06-16 14:26:55 +01:00
Karol Kosek 1759d8f34e ImageViewer: Add Smooth Pixels image scaling option 2022-06-16 14:26:55 +01:00
Karol Kosek ab6288fd3d LibWeb: Use SmoothPixels scaling mode as the pixelated rendering
It's probably not in 1:1 as spec says, as it wants us to first upscale
the image to the nearest integer and then downscale it bilinearly.
But this mode still falls into the general description of the value:

> The image is scaled in a way that preserves the pixelated nature of
> the original as much as possible, but allows minor smoothing instead
> of awkward distortion when necessary.

Also, this way we don't have to allocate the memory just for the integer
scale. :^) :^)
2022-06-16 14:26:55 +01:00
Karol Kosek 3d7838c5fb LibGfx: Implement SmoothPixels scaling mode
If you wanted to upscale an image, you had two options:
- use Nearest Neighbor: it's probably a good choice. The image stays
  sharp.. unless you aren't using integer scales.
- use Bilinear blending, but this on the other hand, doesn't handle
  upscaling well. It just blurs everything.

But what if we could take the best of both of them and make the image
sharp on integers and just blur it a little when needed?

Well, there's Smooth Pixels!

This mode is similar to the Bilinear Blend, with the main difference
is that the blend ratio is multiplied by the current scale, so the blur
on corners can be only 1px wide.

From my testing this mode doesn't handles downscaling as good as the
Bilinear blending though.
2022-06-16 14:26:55 +01:00
Karol Kosek c409881b5f LibGfx: Pass scaling mode as an enum in do_draw_scaled_bitmap 2022-06-16 14:26:55 +01:00
hhsdev 3f230a638d HackStudio: Add "Open in New Tab" context menu entry
This action creates a new editor tab and opens the selected file in the
newly created tab.
2022-06-16 12:55:14 +01:00
MacDue 4d110c39f3 LibWeb: Support using border-radius on <img> tags 2022-06-16 10:28:07 +01:00
MacDue 5b6abfadfd LibWeb: Make PaintableBox::normalized_border_radii_data() protected
This method is needed in subclasses of PaintableBox to do
border-radius clipping.
2022-06-16 10:28:07 +01:00
MacDue 4e8e1492f9 LibWeb: Support using border-radius with a background-image 2022-06-16 10:28:07 +01:00
MacDue 830632407f LibWeb: Add BorderRadiusCornerClipper
This is a helper class for clipping the corners off a element.

This works in a similar way to how (outline) borders are painted.

The steps are:
  1. A small bitmap that fits only the corners is allocated
  2. The corners are painted into the bitmap
  3. The existing pixels (where the corners will be painted)
     are copied using the (inverse) corner bitmap as a mask
     (done before the element is painted)
  4. The element is painted
  5. The areas outside the corner radii are restored

Like with the borders, this only requires allocation on the first
paint.
2022-06-16 10:28:07 +01:00
MacDue 4dfbbd5965 LibWeb: Move border corner bitmap getter/cache to function
This will allow the same bitmap to be shared between border,
background, and various other corner clipping code.
2022-06-16 10:28:07 +01:00
MacDue 81a3ec0692 LibGfx: Add Painter::get_pixel()
This is required to do some painting tricks in LibWeb, this has to be
added to the painter so it can apply the paint translation first.
2022-06-16 10:28:07 +01:00
Thomas Fach-Pedersen 019e3a342d LibWeb: Parse rgb and hsl functions according to CSS Module Level 4
Implement parsing of rgb(..) and hsl(..) in both the modern level 4
syntax without commas, and the legacy syntax with commas.

The parser accepts non-integer numbers but rounds to integer values
for now.
2022-06-15 19:10:43 +01:00
Thomas Fach-Pedersen 83c79fec1c LibWeb: Fix calculation of degrees from radians 2022-06-15 19:10:43 +01:00
Linus Groh 2c647da0b5 LibJS: Mark AddInstant in AddZonedDateTime as fallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/8bc0f98
2022-06-15 17:49:20 +01:00
Linus Groh b2965cf204 LibJS: Fix Instant rounding modes
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0993b75
2022-06-15 17:49:20 +01:00
Linus Groh 1755d051fd LibJS: Mark two calls as infallible in DifferenceTemporalPlainTime
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0e4966a
2022-06-15 17:49:20 +01:00
Linus Groh 36ef604905 LibJS: Assume options is an object in the DifferenceZonedDateTime AO
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a6662f1
2022-06-15 17:49:20 +01:00
Linus Groh 52a4ee563d LibJS: Assume options is an object in the MergeLargestUnitOption AO
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/20a04ac
2022-06-15 17:49:20 +01:00
Linus Groh 569c2dc1d0 LibJS: Adjust order of operations in ISO{Date,MonthDay}FromFields
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/7dd90dc
2022-06-15 17:49:20 +01:00