Commit graph

2106 commits

Author SHA1 Message Date
Tim Ledbetter 4e3b59a4bb LibDNS: Prefer spans over raw pointers when parsing DNS packets
This means we don't have to keep track of the pointer and size
separately.
2023-11-08 09:38:36 +01:00
Sergey Bugaev 38a368c8f6 WebContent: Fix checking for accelerated graphics
What matters here is whether or not we can use LibAccelGfx and OpenGL,
not whether the kernel is Linux.
2023-11-08 09:29:59 +01:00
Shannon Booth ea2b733862 LibWeb: Port custom properties to FlyString 2023-11-07 11:33:41 +01:00
Daniel Bertalan 6f972c190b Everywhere: Work around Clang trunk bug with templated lambda + Variant
Since 2023-09-08, Clang trunk has had a bug which causes a segfault when
evaluating certain `requires` expressions inside templated lambdas.
There isn't an imminent fix on the horizon, so let's work around the
issue by specifying the type of the offending lambda arguments
explicitly.

See https://github.com/llvm/llvm-project/issues/67260
2023-11-05 13:41:13 -07:00
Rummskartoffel dcbb8cf0ac NotificationServer: Make notifications not overlap when they appear
Before this patch, if two or more notifications were created after one
another, they would overlap. This was caused by the previously lowest
notification's m_original_rect being used to calculate the position for
each new notification instead of the notification's actual rect, which
can be different.
This patch makes notifications use each others' rect() method instead,
which makes them appear in the correct position. With that,
m_original_rect has no use anymore, so this patch removes it.
2023-11-05 09:06:33 +01:00
Rummskartoffel a281fa3902 NotificationServer: Don't shuffle notifications on first hover
Before this patch, hovering with the mouse over one of at least two
newly created notifications would cause all notifications to be
reordered on the screen, when previously they appeared in order of
creation, growing downwards.
This happened because the position of all notifications is updated when
any of them is hovered, in case the hovered notification was resized.
By using an ordered HashMap instead, creation order is preserved.
2023-11-05 09:06:33 +01:00
Liav A 1b00618fd9 Kernel+Userland: Replace the beep syscall with the new /dev/beep device
There's no need to have separate syscall for this kind of functionality,
as we can just have a device node in /dev, called "beep", that allows
writing tone generation packets to emulate the same behavior.

In addition to that, we remove LibC sysbeep function, as this function
was never being used by any C program nor it was standardized in any
way.
Instead, we move the userspace implementation to LibCore.
2023-11-03 15:19:33 +01:00
Liav A ac70abcb73 DeviceMapper: Add a mechanism to handle pluggable-once char devices 2023-11-03 15:19:33 +01:00
Andreas Kling 6b580d68a3 LibWeb: Rename DOM::Node::id() to unique_id()
The old name was pretty confusing, since it had nothing to do with the
common "id" content attribute.

This makes way for using id() to return the "id" attribute instead. :^)
2023-11-02 17:09:34 +01:00
Aliaksandr Kalenik 1e85bf221d LibAccelGfx+WebContent: Use the same Painter across page repaints
In the upcoming changes, Painter will be used to store the state of
OpenGL context. For example, if Painter is aware of the shader that
have already been loaded, it will be possible to reuse them across
repaints. Also, it would be possible to manage state of loaded textures
and add/remove them depending on which ones are present in the next
sequence of painting commands.
2023-11-02 07:41:51 +01:00
Andrew Kaster 40363f54d8 WebContent: Use the accelerated_graphics CMake helper
Instead of relying on AK_OS_LINUX, actually use the more accurate
HAS_ACCELERATED_GRAPHICS define to figure out if we should try to use
the generic LibAccelGfx GPU painter.
2023-11-01 14:30:30 -06:00
Aliaksandr Kalenik b6732b0234 Ladybird+WebContent: Add option to use GPU painter
Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
2023-10-29 17:13:23 +01:00
Lucas CHOLLET fbc25ad302 Lagom: Don't include Serenity's ImageDecoder service
This service assumes paths from the serenity environment, bringing it to
Lagom in its current form is useless.
2023-10-27 07:26:32 +02:00
Andrew Kaster 0f0c9f910a WebDriver: Print out the entire error when failing to start a session 2023-10-27 07:11:35 +02:00
Aliaksandr Kalenik f915aa70cd LibWeb/Painting: Introduce PaintingCommandExecutor
Decoupling painting command executor from RecordingPainter allows to
introduce painters other than CPU Gfx::Painter :)
2023-10-26 11:02:04 +02:00
Aliaksandr Kalenik f32764975a LibWeb: Remove ClearRect command in RecordingPainter
There is only one usage of ClearRect command and it could be replaced
with FillRect to make set of commands in RecordingPainter smaller.
2023-10-21 18:50:28 +02:00
Aliaksandr Kalenik 063e66cae9 LibWeb: Introduce RecordingPainter to serialize painting commands
This modification introduces a new layer to the painting process. The
stacking context traversal no longer immediately calls the
Gfx::Painter methods. Instead, it writes serialized painting commands
into newly introduced RecordingPainter. Created list of commands is
executed later to produce resulting bitmap.

Producing painting command list will make it easier to add new
optimizations:
- It's simpler to check if the painting result is not visible in the
  viewport at the command level rather than during stacking context
  traversal.
- Run painting in a separate thread. The painting thread can process
  serialized painting commands, while the main thread can work on the
  next paintable tree and safely invalidate the previous one.
- As we consider GPU-accelerated painting support, it would be easier
  to back each painting command rather than constructing an alternative
  for the entire Gfx::Painter API.
2023-10-18 10:58:42 +02:00
Ali Mohammad Pur aeee98b3a1 AK+Everywhere: Remove the null state of DeprecatedString
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>

Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
2023-10-13 18:33:21 +03:30
Andreas Kling a396bb0c0b LibGfx: Remove indexed palette formats from Bitmap and Painter
Nobody was actually using these formats anymore, and this simplifies
and shrinks the code. :^)
2023-10-12 07:39:05 +02:00
Shannon Booth e4f8c59210 LibWeb: Port AttributeNames to FlyString 2023-10-08 08:11:48 -04:00
Karol Kosek 03a54a519a Userland: Port remaining calls to Widget::set_tooltip_deprecated()
Replaces `set_tooltip_deprecated(string);` with
`set_tooltip(MUST(String::from_deprecated_string(string)));`
purely to get rid of the deprecated function in the following commit.
2023-10-06 08:20:11 +02:00
Karol Kosek ed3e729d4e Userland: Use nondeprecated set_tooltip for static and formatted strings 2023-10-06 08:20:11 +02:00
Junior Rantila a5b01689f1 LibWeb+LibWebView+WebContent: Add support for meta theme-color 2023-10-03 16:17:43 -06:00
Shannon Booth ff72436448 LibWeb: Add a FlyString version of Element::tag_name
Renaming the DeprecatedString version of this function to
deprecated_tag_name. A FlyString is used here as we often need to
perform equality checks here, and the HTMLParser already has tag_name as
a FlyString.

Remove a FIXME while we're at it - we were already following the spec
there, and we still are :^)
2023-10-03 14:47:53 +01:00
Shannon Booth 50350fb79c LibWeb: Add a non-DeprecatedString version of Element::get_attribute
Renaming the DeprecatedString version of this function to
Element::get_deprecated_attribute.

While performing this rename, port over functions where it is trivial to
do so to the Optional<String> version of this function.
2023-10-03 09:41:20 +02:00
Tim Ledbetter eaa6304aab Userland: Return empty if ImageDecoder client receives an invalid frame
This simplifies error checking for all the users of the ImageDecoder
client.
2023-10-03 08:33:53 +02:00
Karol Kosek 9ce2682ce6 Userland: Port lists of mime types to String 2023-09-29 14:40:21 +01:00
Karol Kosek e75d694974 Userland: Compare event MIME type list with a StringView
The following commit will port MIME types to String. Traits<String>
- used in Vector::contains_slow - can't compare String type with char*,
so we need to use StringView instead.
2023-09-29 14:40:21 +01:00
Karol Kosek 2f35348104 Userland: Store MIME keys as String in Core::MimeData 2023-09-29 14:40:21 +01:00
circl 2995a2e212 LibWeb+LibWebView+WebContent: Add support for <input type="color">
This commit introduces 3 things:
- Support for the color type in HTMLInputElement itself
- A mechanism for handling non event loop blocking dialogs in Page
- The associated plumbing up to ViewImplementation

Frontends may add support for the color picker with the
ViewImplementation.on_request_color_picker function
2023-09-27 12:16:41 +01:00
Shannon Booth 47514e07b4 LibWeb: Make Element attribute getters take a StringView
These functions are deferring to NamedNodeMap::get_attribute which
already takes a StringView. This changes also leads to finding some
places which were passing though a const char* instead of an entry from
Attribute names. Fix that where applicable, and switch to has_attribute
in some of those places instead of deprecated_attribute where
equivalent.

Ideally this should be taking a 'FlyString const&', but to continue
porting away from DeprecatedString, just leave a FIXME for now.
2023-09-25 15:39:29 +02:00
Tim Ledbetter b4e134cb52 Userland: Use non-fallible EventReceiver::add() where possible 2023-09-25 10:58:31 +02:00
Tim Ledbetter 50d0d6e710 WindowServer: Add an IPC call to get the window floating rect 2023-09-24 20:07:54 -06:00
Tim Ledbetter 3aa49f268c Userland: Make Window::set_main_widget() non-fallible 2023-09-21 10:20:23 +02:00
Liav A c9297126db SystemServer: Use correct unix device numbers for null, full and random
This fixes regression made in 446200d6f3
2023-09-20 13:27:09 -06:00
Andreas Kling 38cb15ff49 LibWeb: Move system visibility state to TraversableNavigable
This no longer belongs in BrowsingContext.
2023-09-20 18:29:17 +02:00
Tim Ledbetter a6f6a1afd2 Userland: Prefer non-fallible construction for LibGUI objects 2023-09-18 18:00:45 +02:00
Tim Ledbetter c9e4a82c04 WebServer: Return 403 for a GET request to an inaccessible path
Previously, trying to access a non-readable file would cause a
connection reset in the browser; trying to access a non-executable
directory would show a completely empty directory listing.
2023-09-17 17:10:04 -06:00
Tim Ledbetter b2f0c50376 WebServer: Don't display file on directory listing if stat call fails
Previously, the program would crash when attempting to display a symlink
which pointed outside of the permitted directory.
2023-09-17 17:10:04 -06:00
Tim Ledbetter 1dd0791c7e WebServer: Use human-readable sizes on directory listing
A size is no longer displayed for directories; previously, a size of
4096 was always shown.
2023-09-17 17:10:04 -06:00
Aliaksandr Kalenik 3c675e3f25 Userland+Ladybird: Always specify url to be about:srcdoc in load_html()
After moving to navigables, we started reusing the code that populates
session history entries with the srcdoc attribute value from iframes
in `Page::load_html()` for loading HTML.

This change addresses a crash in `determine_the_origin` which occurred
because this method expected the URL to be `about:srcdoc` if we also
provided HTML content (previously, it was the URL passed along with the
HTML content into `load_html()`).
2023-09-17 21:08:59 +02:00
Shannon Booth 8ce9e51c97 LibWeb: Port Node interface from DeprecatedString to String
Which is fortunately quite straight forward :^)
2023-09-17 20:29:18 +02:00
Aliaksandr Kalenik a76ef04ae6 LibWeb+WebContent: Create WebContentConsoleClient for every document
Fixes regression introduced in b4fe118dff

The `WebContentConsoleClient` needs to be created not just once, but
for every new document. Although the JS Console window allows
communication only with the active document associated with the
top-level browsing context, we still need a console client for each
iframe's document to ensure their console logs are printed.

In the future, we might consider adding the ability to switch which
document the JS Console window communicates with.

Fixes https://github.com/SerenityOS/serenity/issues/21117
2023-09-17 19:58:28 +02:00
Aliaksandr Kalenik d17b1d6b1f LibWeb: Update WebDriverConnection::close_window() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik df5db1631b LibWeb: Update WebDriverConnection::close_session() to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik d559fb8b7e WebContent: Update wait_for_navigation_to_complete to use navigables 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik dd7bba66ed LibWeb: Change viewport ownership from BrowsingContext to Navigable 2023-09-16 16:53:32 +02:00
Aliaksandr Kalenik aef4b84e22 LibWeb+WebContent: Add option to dump session history of a traversable 2023-09-16 16:53:32 +02:00
Tim Ledbetter 81f5b3e66d FileOperation: Don't preserve ownership when copying files 2023-09-16 11:14:40 +02:00
Tim Ledbetter f15a896324 FileOperation: Set umask to 0 when creating new files or directories
This ensures that file permissions are correctly preserved.
2023-09-16 11:14:40 +02:00