Commit graph

1086 commits

Author SHA1 Message Date
Linus Groh 46ad69cd1e LookupServer: Fix confusing copy/paste error in debug message 2022-03-27 18:39:47 +01:00
Timur Sultanov 46710d9efa LookupServer: Use case-insensitive comparison for domain names
Some ISPs may MITM DNS requests coming from clients, changing the case
of domain name in response. LookupServer will refuse responses from
any DNS server in that case. This commit changes the behaviour to
perform a case-insensitive equality check.
2022-03-27 17:36:13 +02:00
circl eeeaf410fb WindowServer+LibGUI: Expose raw scroll wheel values to applications
This is useful, for instance, in games in which you can switch held
items using the scroll wheel. In order to implement this, they
previously would have to either add a hard-coded division by 4, or look
up your mouse settings to adjust correctly.

This commit adds an MouseEvent.wheel_raw_delta_x() and
MouseEvent.wheel_raw_delta_y().
2022-03-27 01:11:27 +01:00
Andreas Kling bd44d9d641 LibWeb: Show correct element margin values in Inspector "Box Model" view
We were showing the margin-top value for all 4 margin values.
2022-03-25 11:57:30 +01:00
Lenny Maiorani 0b7baa7e5a Services: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-24 20:09:26 -07:00
Andreas Kling c2d7ef057d WebContent: Remove accidentally committed unveil() call 2022-03-24 23:17:49 +01:00
Andreas Kling 195ef5e26f LibWeb: Bring CSS line-height implementation closer to spec
We now distribute the line-height evenly between the space above and
below inline-level boxes. This noticeably improves our baseline
alignment in many cases.

Note that the "vertical-align: <length>" case is quite awkward, as the
extra height added by the offset baseline must count towards the line
box height.

There's a lot of room for improvement here, but this makes the buckets
container on Acid3 show up in the right place, with the right size.
2022-03-24 22:52:44 +01:00
Kenneth Myhra 4a57be824c Userland+Tests: Convert File::read_link() from String to ErrorOr<String>
This converts the return value of File::read_link() from String to
ErrorOr<String>.

The rest of the change is to support the potential of an Error being
returned and subsequent release of the value when no Error is returned.
Unfortunately at this stage none of the places affected can utililize
our TRY() macro.
2022-03-24 11:57:51 +01:00
Andreas Kling ca85ac26d4 WebContent: Fill OOPWV with palette base color when there's no content 2022-03-23 17:27:20 +01:00
Liav A e508073168 SystemServer: Create /dev/tty as a character device instead of a symlink
The new device has major number 5, minor number 0, and is represented by
the SelfTTYDevice class in the Kernel.
2022-03-22 20:26:05 +01:00
sin-ack e212514bbf LookupServer: Return with failure result when lookup fails
This was missed in 4ca0669d1e and the
error condition would still fall through to an ErrorOr unwrapping which
caused a crash.
2022-03-20 12:09:31 +03:30
Ali Mohammad Pur dff8344336 RequestServer: Keep the EnsureConnection job alive until it finishes
Fixes #12906.
2022-03-19 22:04:35 +01:00
Maciej c1ca009939 WebServer: Add Content-Length header to HTTP responses
This makes the browser know how much data it should expect.
2022-03-19 22:03:51 +01:00
Tom 9f59d7d9a0 WindowServer: Fix animation crash
If an Animation's on_stop handler cleared itself inside the on_stop
event handler, it would remove itself from the animation map that was
still being iterated, leading to a crash.

To solve this, we'll iterate over the animations using the
remove_all_matching function, which enables us to delete it by simply
returning true when the animation finished. In the event that the
Animation is kept alive elsewhere and the on_stop event clears its own
reference, we need to temporarily bump the reference count. Another
advantage is that we only need to bump the reference count when an
animation is finished, whereas before this we bumped it
unconditionally.
2022-03-18 20:00:30 +01:00
Lenny Maiorani f912a48315 Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time
during initialization or the first time a function is called. Change
them to `static constexpr` to ensure they are computed at
compile-time.

This allows some removal of `strlen` because the length of the
`StringView` can be used which is pre-computed at compile-time.
2022-03-18 19:58:57 +01:00
Linus Groh 9422ae9bb2 LibJS: Add infallible variant of VM::push_execution_context()
It makes no sense to require passing a global object and doing a stack
space check in some cases where running out of stack is highly unlikely,
we can't recover from errors, and currently ignore the result anyway.

This is most commonly in constructors and when setting things up, rather
than regular function calls.
2022-03-18 01:12:12 +01:00
Andreas Kling e31fe3eeb8 LibWeb: Rename Element::specified_css_values() => computed_css_values()
Let's make it very clear that these are *computed* values, and not at
all the specified values. The specified values are currently discarded
by the CSS cascade algorithm.
2022-03-15 19:48:19 +01:00
Andreas Kling 43ef813f3d LibWeb: Rename Element::computed_style() to resolved_css_values()
This more accurately reflects what's actually being returned.
2022-03-15 19:48:19 +01:00
kleines Filmröllchen 79deb7d6c7 AudioServer: Decrease sample headroom to 5%
This might still be too much, but it's better than what we had before.
2022-03-14 22:46:46 +01:00
Karol Kosek a5e149c012 WindowServer: Update menu buttons' rects on font change
Prior to this change, after changing the system font, the menu rects
stayed the same, making the menu bar look a bit cramped on larger fonts.
2022-03-14 22:29:57 +01:00
Karol Kosek fe47e66438 WindowServer: Use font height for item heights in Menus
The height of menu items was relatively small on larger fonts.
2022-03-14 22:29:57 +01:00
Sam Atkins 7535398dbf FileOperation: Port to Core::Stream 2022-03-13 22:38:48 +01:00
Andreas Kling 5779a910e5 LibWeb: Move hit testing to the painting tree 2022-03-11 00:21:49 +01:00
Andreas Kling ba606d9057 LibWeb: Move PaintingBox to its own .cpp and .h files 2022-03-11 00:21:49 +01:00
Andreas Kling 9461e44afa LibWeb: Use Layout::Box::paint_box() accessor in more places 2022-03-11 00:21:49 +01:00
Andreas Kling f6497b64ac LibWeb: Rename Painting::Box => Paintable
Calling this "Box" made it very confusing to look at code that used both
Layout::Box and Painting::Box. Let's try calling it Paintable instead.
2022-03-11 00:21:49 +01:00
Andreas Kling 9f5cbcaad3 LibWeb: Hang StackingContext off of the paint boxes
Stacking contexts have nothing to do with layout and everything with
painting, so let's keep them in Painting::Box.
2022-03-11 00:21:49 +01:00
Andreas Kling a4d51b3dc2 LibWeb: Add Painting::Box and move things from Layout::Box into it
The "paintable" state in Layout::Box was actually not safe to access
until after layout had been performed.

As a first step towards making this harder to mess up accidentally,
this patch moves painting information from Layout::Box to a new class:
Painting::Box. Every layout can have a corresponding paint box, and
it holds the final used metrics determined by layout.

The paint box is created and populated by FormattingState::commit().

I've also added DOM::Node::paint_box() as a convenient way to access
the paint box (if available) of a given DOM node.

Going forward, I believe this will allow us to better separate data
that belongs to layout vs painting, and also open up opportunities
for naturally invalidating caches in the paint box (since it's
reconstituted by every layout.)
2022-03-11 00:21:49 +01:00
Sam Atkins 10429e1043 WebContent: Return empty JSON object if element has no box model
The blank string "" does not parse as JSON, and so the InspectorWidget
would fail to update the box-model information when inspecting elements
with no box, (for example, `<head>`) showing stale values instead. Now,
they show all 0s.

You could argue that InspectorWidget should be more resilient when given
invalid JSON strings, but making sure we only pass valid ones works
too.
2022-03-10 17:30:09 +01:00
Sam Atkins b5ea14b884 WebContent: Show box-model metrics for (some) pseudo-elements
This only applies to pseudo-elements which have a Layout::Box, so this
excludes any that are InlineNodes.
2022-03-10 17:30:09 +01:00
Sam Atkins 0326ad34df Browser+LibWeb+WebContent: Show style for pseudo-elements :^)
This expands the InspectorWidget::Selection to include an optional
PseudoElement, which is then passed over IPC to request style
information for it.

As noted, this has some pretty big limitations because pseudo-elements
don't have DOM nodes:
- Declared style has to be recalculated when it's requested.
- We don't display the computed style.
- We don't display custom properties.
2022-03-10 17:30:09 +01:00
Ben Abraham 7594350376 Browser: Show currently loading host and remaining resource count 2022-03-10 00:51:05 +01:00
Sahan Fernando 2939f65753 SystemServer: Create device files for gpus on startup
We are adding a new class of file, a GPU device. These devices have
major number 28, and are bound to files named /dev/gpuN.
2022-03-09 14:58:48 +03:30
javabird25 9246ad96b3 LoginServer: Add a label for login fail messages 2022-03-08 22:12:21 +01:00
Vrins 39a5076f40 Browser+LibWeb: Add an Element size preview widget to inspector
This Adds an element size preview widget to the inspector widget
in a new tab. This functions similar to chrome and firefox and
shows the margin, border, padding, and content size of the selected
element in the inspector.

The colors for the size preview widget are taken from the chrome
browser.
2022-03-08 22:09:52 +01:00
Linus Groh 1422bd45eb LibWeb: Move Window from DOM directory & namespace to HTML
The Window object is part of the HTML spec. :^)
https://html.spec.whatwg.org/multipage/window-object.html
2022-03-08 00:30:30 +01:00
Andreas Kling 5ace66a903 LibGfx: Rename RGBA32 => ARGB32
The ARGB32 typedef is used for 32-bit #AARRGGBB quadruplets. As such,
the name RGBA32 was misleading, so let's call it ARGB32 instead.

Since endianness is a thing, let's not encode any assumptions about byte
order in the name of this type. ARGB32 is basically a "machine word"
of color.
2022-03-04 23:40:21 +01:00
Lenny Maiorani d5fdc6096c Libraries: Make CharacterBitmap instances at compile-time
`CharacterBitmap` instances are generated at run-time and put on the
heap, but they can be created in a `constexpr` context and stored in
static memory.

Also, remove additional `width` and `height` `static` values in favor
of using the `constexpr` member functions of `CharacterBitmap`.

These changes also include the removal of some initialization code
which tests if the `CharacterBitmap` is created since it is always
created and removes function-local `static` values which cause
run-time branches to ensure it is initialized each time the function
is called.
2022-03-04 17:41:08 +01:00
MacDue 6ff041dcfc WindowServer: Treat window frames with a border radius as transparent
Without this, there are repainting artefacts when the window is moved.
2022-03-02 21:56:57 +01:00
MacDue c2fcc3a621 WindowServer: Disable shadow rendering for themes with a border-radius
The current shadow renderer only works for purely rectangular windows,
when enabled with border radiuses the corners are wrong.
2022-03-02 21:56:57 +01:00
Lenny Maiorani f5fd2f3857 Services: Port FileOperation to LibMain 2022-02-28 13:57:26 +01:00
Idan Horowitz feb00b7105 Everywhere: Make JSON serialization fallible
This allows us to eliminate a major source of infallible allocation in
the Kernel, as well as lay down the groundwork for OOM fallibility in
userland.
2022-02-27 20:37:57 +01:00
Itamar 493f604dba SpiceAgent: Rename ClipboardServerConnection
Rename ClipboardServerConnection=>ConnectionToClipboardServer.

This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar 935d023967 Userland: Rename WindowServerConnection=>ConnectionToWindowServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar af132fdbd1 Userland: Rename WindowManagerServerConnection
Rename WindowManagerServerConnection=>ConnectionToWindowManagerServer.

This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar d88da82e28 Userland: Rename IPC::ServerConnection=>IPC::ConnectionToServer
This was done with CLion's automatic rename feature.
2022-02-25 22:35:12 +01:00
Itamar 3a71748e5d Userland: Rename IPC ClientConnection => ConnectionFromClient
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
2022-02-25 22:35:12 +01:00
thankyouverycool e1a72c6df8 Taskbar: Update ClockWidget FrameShape and adjust dimensions
Uses the new Window FrameShape. Fixes some erroneously elided text
and incorrect calendar window placement.
2022-02-25 19:38:23 +01:00
Jan Grau 9311b685fe Taskbar: Minimize/activate window on Super+Digit event
Handle the SuperDigitKeyPressed event in the taskbar. Toggle the
respective taskbar button.
2022-02-24 18:57:20 +00:00
Jan Grau 6992a07afc LibGUI+WindowServer: Add new WMEvent Super+Digit
This adds a keyboard event for Super+0 to Super+9. Later to be consumed
in the taskbar.

Currently only this keyboard sequence is supported:
  - Super key down
  - Digit key down

But not this:
  - Super key down
  - Digit key down
  - Digit key up
  - Digit key down
2022-02-24 18:57:20 +00:00