Commit graph

234 commits

Author SHA1 Message Date
Andreas Kling 5aeab9878e LibWeb: Rename LayoutNode classes and move them into Layout namespace
Bring the names of various boxes closer to spec language. This should
hopefully make things easier to understand and hack on. :^)

Some notable changes:

- LayoutNode -> Layout::Node
- LayoutBox -> Layout::Box
- LayoutBlock -> Layout::BlockBox
- LayoutReplaced -> Layout::ReplacedBox
- LayoutDocument -> Layout::InitialContainingBlockBox
- LayoutText -> Layout::TextNode
- LayoutInline -> Layout::InlineNode

Note that this is not strictly a "box tree" as we also hang inline/text
nodes in the same tree, and they don't generate boxes. (Instead, they
contribute line box fragments to their containing block!)
2020-11-22 15:56:27 +01:00
Andreas Kling adabcf24ec Everywhere: Add missing <AK/ByteBuffer.h> includes
All of these files were getting ByteBuffer.h from someone else and then
using it. Let's include it explicitly.
2020-11-15 13:11:21 +01:00
Andreas Kling ebaf20547c WindowServer: Show modal window's cursor over blocked windows
When a window is blocked by a modal window from the same application,
we now prefer the modal window's cursor instead of the hovered window.
2020-11-10 19:30:22 +01:00
Tom 75f61fe3d9 AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.

Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.

In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
2020-11-10 19:11:52 +01:00
AnotherTest 6d1e47e7dd LibGUI+WindowServer: Make DragOperation hold a MimeData instance
...instead of maybe bitmap + a single mime type and its corresponding data.
This allows drag&drop operations to hold multiple different kinds of
data, and the views/applications to choose between those.
For instance, Spreadsheet can keep the structure of the dragged cells,
and still provide text-only data to be passed to different unrelated editors.
2020-11-08 21:46:13 +01:00
Brendan Coles fb5ea8a212 WindowServer+LibGfx: Add Gfx::StandardCursor::Hidden cursor 2020-11-02 20:58:07 +01:00
Brendan Coles 328915a279 ChessEngine: Use pledge and unveil 2020-11-02 13:16:09 +01:00
AnotherTest 812e3ecedd LibProtocol+LibGemini+LibHTTP: Provide root certificates to LibTLS
Now we (almost) verify all the sites we browse.
Certificate verification failures should not be unexpected, as the
existing CA certificates are likely not complete.
2020-10-30 23:42:03 +01:00
AnotherTest a461526b07 LibHTTP+ProtocolServer+LibGemini: Remove Request::schedule()
This API is only used for HttpRequest, but replicated in GeminiRequest
without an actual user, so remove it and construct the job like the rest
of the protocols.
2020-10-30 23:42:03 +01:00
Uma Sankar Yedida 9ccae7a908 WindowServer+LibGfx: Added Crosshair cursor 2020-10-30 19:10:15 +01:00
Andreas Kling 3ec19ae4b6 LibGUI+LibGfx+WindowServer: Auto-generate disabled action icons :^)
This patch adds a simple filter that makes button and menu item icons
have that "'90s disabled" look when disabled. It's pretty awesome.
2020-10-27 21:25:40 +01:00
Andreas Kling ce4ee1df1b WindowServer: Improve look of drag&drop items somewhat
This just adds a bit of padding around items. There's lots of room for
improvement here.
2020-10-27 20:45:38 +01:00
Linus Groh 7eee39b850 LookupServer: Support multiple nameservers
The configuration key [DNS] Nameserver has been renamed to Nameservers
and accepts a comma-separated list of nameserver addresses, which will
be queried in the given order until a response has been received.

The new default value is still Cloudflare's 1.1.1.1 as well as their
secondary DNS server 1.0.0.1.
2020-10-25 18:52:20 +01:00
Linus Groh 2440112d53 LookupServer: Replace unused 'did_timeout' with 'did_get_response'
did_timeout is a bool& parameter of lookup() that used to be set when
the UDP connection timed out, but this behaviour was broken in e335d73.
I replaced it with a more useful 'did_get_response' parameter that is
being set after the UDP socket connected, sent its request and got a
response - it might still be bogus data but we know the communication
was successful.
2020-10-25 18:52:20 +01:00
Linus Groh 75864b5a85 LookupServer: Replace dbg()/dbgprintf() with dbgln() 2020-10-25 18:52:20 +01:00
Andreas Kling cfe1c132cb WindowServer: Raise menu item icons slightly when hovered :^)
Same effect as LibGUI toolbar buttons.
2020-10-25 15:32:19 +01:00
Andreas Kling 3ba6dceee3 Taskbar: Make quicklaunch buttons larger and reduce spacing
The end result is almost identical, but now it's a little easier to
hit the buttons with the cursor. :^)
2020-10-25 15:32:19 +01:00
Andreas Kling 20ca3d4a99 LibGfx+WindowServer: Handle taller window title fonts better
If the window title font is taller than the theme's specified title
height, compute the title height based on the font instead. :^)
2020-10-24 00:26:13 +02:00
Andreas Kling 5043c4a3e5 LibCore+WebServer+LibWeb: Make MIME type guesser take a StringView
This reverts my previous commit in WebServer and fixes the whole issue
in a much better way. Instead of having the MIME type guesser take a
URL (which we don't actually have in the WebServer at that point),
just take a path as a StringView.

Also, make use of the case-insensitive StringView::ends_with() :^)
2020-10-21 21:16:20 +02:00
Andreas Kling 9c14e2ea5d WebServer: Force "text/html" mimetype for directories with index.html
When you GET a directory with an index.html file, we were using the
mime type guessing logic from LibCore on the "/" filename, which gave
us "text/plain". Force the mime type to "text/html" in these cases
so browsers actually interpret it as HTML. :^)
2020-10-21 20:55:16 +02:00
Andreas Kling f5f99ccd6a WindowServer: Return some event members by const reference 2020-10-20 18:10:22 +02:00
Linus Groh e40135fefd LibWeb: Add OutOfProcessWebView::load_html() 2020-10-08 23:20:52 +02:00
Nico Weber 9d27644b7d DHCPClient: Remove unused UPDSocket.h include 2020-10-08 10:00:39 +02:00
Nico Weber be693e95ff Services: Remove unused includes of {LibCore,WindowServer}/EventLoop.h 2020-10-05 23:48:33 +02:00
asynts d5ffb51a83 AK: Don't add newline for outf/dbgf/warnf.
In the future all (normal) output should be written by any of the
following functions:

    out    (currently called new_out)
    outln
    dbg    (currently called new_dbg)
    dbgln
    warn   (currently called new_warn)
    warnln

However, there are still a ton of uses of the old out/warn/dbg in the
code base so the new functions are called new_out/new_warn/new_dbg. I am
going to rename them as soon as all the other usages are gone (this
might take a while.)

I also added raw_out/raw_dbg/raw_warn which don't do any escaping,
this should be useful if no formatting is required and if the input
contains tons of curly braces. (I am not entirely sure if this function
will stay, but I am adding it for now.)
2020-10-04 17:04:55 +02:00
Linus Groh bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
Tom 7399874479 AK: Add trivial structure validation to SharedBuffer
If we're sharing buffers, we only want to share trivial structures
as anything else could potentially share internal pointers, which
most likely is going to cause problems due to different address
spaces.

Fix the GUI::SystemTheme structure, which was not trivial, which
is now caught at compile time.

Fixes #3650
2020-10-02 15:38:07 +02:00
Itamar fec4152220 LibCore: Add ensure_parent_directories to LibCore::File
Moved the implementation in SystemServer/Service.cpp to LibCore.
2020-09-30 21:46:59 +02:00
Andreas Kling f88a7cd4e1 LibCore: Make TCPServer::listen() report failure instead of asserting 2020-09-28 22:14:23 +02:00
Andreas Kling 2946a684ef ProtocolServer+LibWeb: Support more detailed HTTP requests
This patch adds the ability for ProtocolServer clients to specify which
HTTP method to use, and also to include an optional HTTP request body.
2020-09-28 11:55:26 +02:00
Ben Wiederhake 934d4d4033 Meta+Services: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
asynts 26f4b5e6ba TelnetServer: Use OutputMemoryStream instead of BufferStream.
I could not test these changes because I could not get my telnet client
(on Linux) to connect to the telnet server running in Serenity.

I tried the follwing:

    # Serenity
    su
    TelnetServer

    # Linux
    telnet localhost 8823

The server then immediatelly closes the connection:

    Connection closed by foreign host.

In the debug logs the following message appears:

    [NetworkTask(5:5)]: handle_tcp: unexpected flags in FinWait2 state
    [NetworkTask(5:5)]: handle_tcp: unexpected flags in Closed state
    [NetworkTask(5:5)]: handle_tcp: unexpected flags in Closed state

This seems to be an unrelated bug in the TCP implementation.
2020-09-21 09:37:49 +02:00
asynts 8f06e4aaa4 LookupServer: Use DuplexMemoryStream instead of BufferStream. 2020-09-21 09:37:49 +02:00
asynts 3fa0bba4b4 AudioServer: Use OutputMemoryStream instead of BufferStream. 2020-09-21 09:37:49 +02:00
Andreas Kling d3fcba78b0 WindowServer: Shrink menubar menu text rects slightly
We don't want the menu titles to cover the entire menubar.
2020-09-19 19:16:22 +02:00
Tom 6212f57755 WindowServer: Make SetWindowTaskbarRect tolerant to non-existing windows
There is a window between windows disappearing (e.g. closing or crashes)
and the Taskbar process being notified. So it is entirely possible that
it may call SetWindowTaskbarRect() for a window and/or client id that no
longer exists. As the Taskbar process does not own these windows, this
should not be treated as a misbehaving application request. Instead, just
silently ignore the request. The Taskbar will be notified shortly after
that the window no longer exist and remove it from its list.

Fixes #3494
2020-09-16 15:57:12 +02:00
Andreas Kling e2f32b8f9d LibCore: Make Core::Object properties more dynamic
Instead of everyone overriding save_to() and set_property() and doing
a pretty asymmetric job of implementing the various properties, let's
add a bit of structure here.

Object properties are now represented by a Core::Property. Properties
are registered with a getter and setter (optional) in constructors.
I've added some convenience macros for creating and registering
properties, but this does still feel a bit bulky. We'll have to
iterate on this and see where it goes.
2020-09-15 21:46:26 +02:00
Andreas Kling d9e39cb82d LibWeb: Support window.alert() in multi-process context
Alerts are now delegated to the embedding GUI process.
2020-09-12 14:49:29 +02:00
Andreas Kling aba793fb3e LibIPC: Share most of the code between {Client,Server}Connection
This patch introduces IPC::Connection which becomes the new base class
of ClientConnection and ServerConnection. Most of the functionality
has been hoisted up to the base class since almost all of it is useful
on both sides.

This gives us the ability to send synchronous messages in both
directions, which is needed for the WebContent server process.
Unlike other servers, WebContent does not mind blocking on a response
from its client.
2020-09-12 14:49:29 +02:00
Andreas Kling b4f307f982 LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Andreas Kling 0f9be82826 LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Tom 0c2d36d1cd WindowServer: Draw minimize animation inverted
Inverting the pixels makes the animation visible over most colors.
2020-09-08 10:45:35 +02:00
Tom 3a4a9d4c6b WindowServer: Fix invalidating window frame
When invalidating the frame we need to properly flag that so that
we trigger rendering the frame, even if "all" was flagged as being
invalidated. Otherwise it will only get rendered if anything else
happens to trigger it (such as focus change).

Fixes #3427
2020-09-07 19:39:48 +02:00
Andreas Kling 2e6d59b7b2 Clipboard: Add a key-value map alongside the clipboard storage
A clipping now consists of three things:

- The raw clip data
- A MIME type
- A key-value map (String, String) for anything you like
2020-09-05 16:52:24 +02:00
thankyouverycool 72deaa3423 WindowServer: Return correct IsMaximized response 2020-08-31 09:08:26 +02:00
Sergey Bugaev 852454746e Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
Ben Wiederhake ec842b21cf WindowServer: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
Andreas Kling 0a7d9319af ChessEngine: Move from Applications to Services
This is not a stand-alone application. :^)
2020-08-28 12:53:02 +02:00
Tom 6ea7e67b62 WindowServer: Fix minor flicker with transparent windows
Do not fill the backing store mismatch area with the solid window
color if the window is transparent. This caused some minor flicker
when such a window is e.g. snapped to the left/right or maximized.
2020-08-27 10:13:03 +02:00
thankyouverycool 208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00