Commit Graph

16738 Commits

Author SHA1 Message Date
Andreas Kling
497d48a8de AK: Make IsUnsigned<T> behave as you would expect 2021-02-10 22:23:54 +01:00
Andreas Kling
8743ea3149 LibWeb: Relayout document on CharacterData data change
This can definitely be optimized to avoid full relayouts in many
situations, but for now let's just go for correctness.
2021-02-10 19:06:20 +01:00
Andreas Kling
29a2aac89a LibWeb: Start implementing <input type=text> using a shadow DOM
Text <input> fields will now generate a basic shadow DOM and attach it
to the input element.

The shadow DOM contains a <div> with some inline style, and an always-
editable text node inside it. Accessing the "value" attribute on such
an input element will get/set the value from that text node.

This is really cool, although not super stable since HTML editing is
not super stable. But it's a start! :^)
2021-02-10 19:06:20 +01:00
Andreas Kling
e4e325ff61 LibWeb: Include shadow DOM subtrees in DOM dumps 2021-02-10 19:06:20 +01:00
Andreas Kling
e562819a7e LibWeb: Generate layout nodes for shadow subtrees
Elements with shadow roots will now recurse into those shadow trees
while building the layout tree.

This is the first step towards basic Shadow DOM support. :^)
2021-02-10 19:06:20 +01:00
Andreas Kling
41ff7268db LibWeb: Add a way to make a DOM::Text always editable
This will be useful for input element purposes.
2021-02-10 19:06:20 +01:00
Andreas Kling
2eddd74e85 LibWeb: Add DOM::Node::parent_or_shadow_host()
This is useful when you want to traverse across shadow boundaries.
2021-02-10 19:06:20 +01:00
Andreas Kling
d597626ea1 LibWeb: Add a way to give DOM::Element a ShadowRoot
You can now attach a shadow root to your favorite Element. It doesn't
do anything yet, but you can.
2021-02-10 19:06:20 +01:00
Andreas Kling
bf82e7fba2 LibWeb: Add DOM::ShadowRoot to forwarding header 2021-02-10 19:06:20 +01:00
Andreas Kling
bbce1ab1c1 LibWeb: Use the DOM::Node::node_name() a bit more in dumps 2021-02-10 17:15:16 +01:00
Andreas Kling
70bd1724db LibJS: Include <typeinfo> in AST.cpp again
Linus points out that oss-fuzz wants this to be there.
2021-02-10 12:21:14 +01:00
Andreas Kling
acd46dcb0c LibWeb: Respect the bgcolor attribute on <marquee> elements
We don't yet animate marquees, but we can at least fill them with the
right background color.
2021-02-10 09:54:16 +01:00
Andreas Kling
5e91e61900 LibWeb: Remove WidgetBox layout node
The approach of attaching sub-widgets to the web view widget was only
ever going to work in single-process mode, and that's not what we're
about anymore, so let's just get rid of WidgetBox so we don't have the
dead-end architecture hanging over us.

The next step here is to re-implement <input type=text> using LibWeb
primitives.
2021-02-10 09:13:30 +01:00
Andreas Kling
1ad65b173b LibWeb+WebContent: Support window.confirm() in OOPWV 2021-02-10 09:13:30 +01:00
Andreas Kling
abf7c02acb LibWeb: Move window.confirm() to using a PageClient callback
This allows us to move the GUI::MessageBox out of DOM::Window and up to
the widget layer.
2021-02-10 09:13:30 +01:00
Andreas Kling
794ebb699c LibWeb: Remove low-hanging LibGUI fruit from LibWeb
We'll want to remove the LibGUI dependency from the WebContent process.
This is the first basic step of removing unnecessary LibGUI includes
and swapping out GUI::Painter for Gfx::Painter.
2021-02-10 09:13:29 +01:00
Andreas Kling
548f8a0644 AK: TypeCasts.h should include Assertions.h 2021-02-10 09:13:29 +01:00
Andreas Kling
635a5eec75 LibJS: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
Andreas Kling
9de1253f44 LibWeb: Remove a whole bunch of unnecessary #includes 2021-02-10 09:13:29 +01:00
Tom
a807d92a32 WindowServer: Fix switching between shadows and no shadows with themes
We weren't properly handling switching between having a shadow and
not having a shadow when switching themes. This allows an empty string
in the theme configuration for a shadow path, meaning no shadow should
be rendered.
2021-02-10 09:12:49 +01:00
Tom
5d4c4bd372 WindowServer: Occlusion calculation fixes
We didn't properly determine whether a window was fully covered, which
caused some artifacts in certain cases.

Fixes #5283
2021-02-10 09:12:49 +01:00
AnotherTest
338bb73289 AK: Fix build with Clang>=12
Build failure as in https://oss-fuzz-build-logs.storage.googleapis.com/log-79750138-f41e-4f39-8812-7c536f1d2e35.txt
Clang does not appear to like using consteval functions' arguments as
constant expressions, so move all the arguments that need to appear as
constant expressions into the template parameters for now.

This patch should fix the OSS-Fuzz build.
2021-02-10 08:01:47 +01:00
Linus Groh
1fd349b8c2 Userland: Use INET_ADDRSTRLEN for inet_ntop() buffers
There's no point in using different, seemingly randomly sized buffers as
the required size for storing an IPv4 address representation is well
known (16 bytes).
2021-02-09 22:58:19 +01:00
Andreas Kling
f24b674d7a LibWeb+WebContent: Don't relayout page on every scroll event
The WebContent process was redoing page layout every time you scrolled
the page. This was a huge CPU hog for no reason. Fix this by only doing
a relayout when the viewport is resized, not when it moves around.
2021-02-09 22:40:16 +01:00
Tom
964894dee6 WindowServer: Allow specifying different shadows for menus and tooltips
Also update the Redmond 2000 theme to drop shadows more Redmond-like.
2021-02-09 22:27:14 +01:00
Andreas Kling
c9aa7539a6 LibWeb: Make OOPWV resizing flicker-free :^)
When resizing, keep a copy of the last good bitmap we have, and keep
using that until we receive a new one from the WebContent process.
2021-02-09 22:08:55 +01:00
Camisul
8c220dee03 WindowServer: Vertically maximize window
Button now can handle middle and right clicks.
Added 2 new handlers in button class: on_right_click for Right mouse
button and on_middle_click for middle mouse button.

Added functionality to vertically maximize window with middle mouse
click on the maximize window button.

Also added a way to vertically maximize window by resizing window
height-wise lower than the maximum window height.
2021-02-09 21:36:11 +01:00
Tom
e1ee59ac9d WindowServer: Recompute occlusions and re-render shadows on theme change
Since theme changes may change geometrics, which are also affected by
window shadows, we need to recompute occlusions as well as re-render
window frames.
2021-02-09 21:33:54 +01:00
Andreas Kling
ace1b34798 LibWeb: Reset the HTML editing cursor blink cycle on arrow key movement
Also stop exposing the DOM cursor as a mutable reference on Frame,
since event handling code was using that to mess with the text offset
directly. Setting the cursor now always goes through the Frame where
we can reset the blink cycle appropriately.

This makes cursor movement look a lot more natural. :^)
2021-02-09 21:25:38 +01:00
Andreas Kling
2c4829cb14 LibWeb: Remove duplicated locals in EventHandler::handle_mousedown() 2021-02-09 20:49:37 +01:00
Andreas Kling
da7a8fc055 LibGUI: TextEditor widget should default to no wrapping
Since we don't support wrapping in right-aligned text mode, let's keep
the old behavior of wrapping being off-by-default for now.

Fixes #5275.
2021-02-09 20:28:29 +01:00
Nico Weber
106939c11f Base: Fill in rightmost pixel in crosshair cursor
gimp claimed that the rightmost white pixel was actually transparent.
It didn't look transparent in Serenity, but I painted it white like
the other inner pixels anyways.
2021-02-09 20:10:00 +01:00
Nico Weber
ae98f575d9 Base: Add 2x versions of most cursors
I upsampled them in gimp using the "None" filter and manually cleaned up
the outline. The drop shadow is just upsampled using "None" and looks a
bit rough -- someone who knows how to do this either has to re-create
the shadow on the 2x bitmaps, or we need to remove the shadow from the
resource and render it in code at some point. Still, looks a lot better
than with the upsampled 1x bitmaps.
2021-02-09 20:10:00 +01:00
Andreas Kling
085f80aeac Kernel: Remove unused root directory computation in Process creation
sys$fork() already takes care of children inheriting the parent's root
directory, so there was no need to do the same thing when creating a
new user process.
2021-02-09 19:18:13 +01:00
Andreas Kling
1f277f0bd9 Kernel: Convert all *Builder::appendf() => appendff() 2021-02-09 19:18:13 +01:00
Andreas Kling
764af6cdec AK: Use StringBuilder::appendff() instead of appendf() 2021-02-09 19:18:13 +01:00
Tom
db0149056f WindowServer: Don't render shadow for frameless windows
Fixes CatDog rendering odd square shadow.
2021-02-09 19:18:00 +01:00
Tom
3d374954eb WindowServer: Try harder to avoid re-rendering window shadow
We only really need to re-render the simple window shadow when
the size of the frame changes. So, for all other cases only re-render
the window frame without rendering the shadow.
2021-02-09 18:47:43 +01:00
Tom
0ce4b9d7db WindowServer: Implement simple window shadows
This implements simple window shadows around most windows, including
tooltips. Because this method uses a bitmap for the shadow bits,
it is limited to rectangular window frames. For non-rectangular
window frames we'll need to implement a more sophisticated algorithm.
2021-02-09 18:47:43 +01:00
Itamar
72fdab7bfb LanguageServers/Cpp: ParserAutoComplete engine inspects header files
... and performs preprocessing on the source code before parsing.

To support this, we are now able to keep track of multiple
files in the autocomplete engine. We re-parse a file whenever it is
edited.
2021-02-08 23:10:38 +01:00
Itamar
02038a0ede LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class 2021-02-08 23:10:38 +01:00
Itamar
bed06b13f3 LanguageServers/Cpp: Add FileDB and pass project_root in Greet()
FileDB wraps the access to the contents of project files.

When asked to fetch a file, FileDB will either return its in-memory
model of the file if it has been "opened" by the language-server
protocol, or otherwise fetch it from the filesystem.

Previously, the cpp language server did not pledge "rpath" and got
access to the contents of files whenever they were opened by the
language client.
However, features like inspection of header files require the language
server to get the content of files that were not opened by the client.

The language server now pledges rpath but makes sure to only unveil
the project's directory and /usr/include.
2021-02-08 23:10:38 +01:00
Itamar
bed3261723 LibCpp: Start working on a C preprocessor
We currently handle basic #define statements as well as ifdef and else
branches.
2021-02-08 23:10:38 +01:00
Itamar
2d2b3ba5ed LibCpp: Include CPP_DEBUG in AK/Debug.h 2021-02-08 23:10:38 +01:00
Itamar
8ed65d7b48 LibCpp: Parse If statements 2021-02-08 23:10:38 +01:00
Andreas Kling
e8f040139b Kernel: Remove unused Thread::is_runnable_state() 2021-02-08 23:07:33 +01:00
Andreas Kling
4ff0f971f7 Kernel: Prevent execve/ptrace race
Add a per-process ptrace lock and use it to prevent ptrace access to a
process after it decides to commit to a new executable in sys$execve().

Fixes #5230.
2021-02-08 23:05:41 +01:00
Andreas Kling
4b7b92c201 Kernel: Remove two unused fields from sys$execve's LoadResult 2021-02-08 22:31:03 +01:00
Andreas Kling
4cd2c475a8 Kernel: Make the space lock a RecursiveSpinLock 2021-02-08 22:28:48 +01:00
Andreas Kling
0d7af498d7 Kernel: Move ShouldAllocateTls enum from Process to execve.cpp 2021-02-08 22:24:37 +01:00