Commit graph

42289 commits

Author SHA1 Message Date
Andreas Kling
8412206cb4 LibWeb: Cache pseudo element layout nodes weakly on DOM::Element
Having the cache be strong created a reference cycle between DOM nodes
and their pseudo elements.
2022-10-20 15:16:23 +02:00
Andreas Kling
e23fe8cf87 LibJS: Make define_native_foo() take SafeFunctions
We were taking AK::Function and then passing them along to
NativeFunction, which takes a SafeFunction. This works, since
SafeFunction will transparently wrap AK::Function in a CallableWrapper
when assigned, but it was causing us to accumulate thousands of
pointless wrappers around direct function pointers.

By using SafeFunction at every step of the setup call chain, we no
longer create any CallableWrappers for the majority of native functions
in LibJS. Also, the number of heap-registered SafeFunctions in a new
realm goes down from ~5000 to 5. :^)
2022-10-20 15:16:23 +02:00
Andreas Kling
202cc025e5 LibJS: Don't register SafeFunction-to-function-pointer with JS::Heap
Direct function pointers don't have captures, so we don't need to
register the SafeFunction with the Heap when it's just wrapping a
function pointer.
2022-10-20 15:16:23 +02:00
Andreas Kling
be5a39657e LibWeb: Only store one DOM pointer per Layout::Node
Instead of storing two JS::Handles into the DOM, we can combine them
into a single one.

If the layout node is anonymous, m_dom_node points to the DOM::Document.
Otherwise, m_dom_node points to the associated DOM node.

The anonymous state is moved to an m_anonymous boolean member.

This cuts the number of JS::Handles created by the layout tree in half
(and shrinks Layout::Node by 8 bytes).
2022-10-20 15:16:23 +02:00
Andreas Kling
18a5c56f14 LibWeb: Don't store JS::Handle<JS::Promise> in EnvironmentSettingsObject
Now that the ESO is a JS::Cell, we can just store them as NonnullGCPtr
and mark them in visit_edges().
2022-10-20 15:16:23 +02:00
Andreas Kling
dbee75af19 LibWeb: Tear down old layout tree when new document becomes active
When a new document becomes the active document of a browsing context,
we now notify the old document, allowing it to tear down its layout
tree. In the future, there might be more cleanups we'd like to do here.
2022-10-20 15:16:23 +02:00
Andreas Kling
94f0c34dfe LibWeb: Remove unnecessary WeakPtr in queue_microtask_impl()
Capturing a WeakPtr to a GC-allocated object in a JS::SafeFunction is
basically pointless, since the SafeFunction mechanism will then keep
the object alive anyway.
2022-10-20 15:16:23 +02:00
Andreas Kling
57f508f048 LibWeb: Use JS::SafeFunction in run_timer_initialization_steps() 2022-10-20 15:16:23 +02:00
Andreas Kling
a8bdf866d9 LibWeb: Discard old browsing context after obtaining a new one
Cleaning up an old FIXME from before discard was implemented.
2022-10-20 15:16:23 +02:00
Andreas Kling
24510b0845 LibWeb: Make window.parent and window.top return WindowProxy
These functions were previously ad-hoc and returned the active
document's window. They now correctly teturn the browsing context's
WindowProxy instead.
2022-10-20 15:16:23 +02:00
Andreas Kling
3c548adf9c LibWeb: Create and hook up a WindowProxy for each BrowsingContext
All the machinery for this was already in place, we just never created
the actual WindowProxy and installed it.
2022-10-20 15:16:23 +02:00
Andreas Kling
738e770fce LibJS: Remove unnecessary operator==() for ({Nonnull,}GCPtr<T>, T*)
These aren't necessary in the first place since {Nonnull,}GCPtr has
operator T*()
2022-10-20 15:16:23 +02:00
Xexxa
d87e2287dc Snake: Use emoji for in-game food graphics 2022-10-20 10:27:00 +02:00
Moustafa Raafat
8f964604f0 LibJS: Refactor CalendarFields for better linearity
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/9b139a1
2022-10-20 00:53:44 +02:00
Idan Horowitz
d38aeddd77 LibJS: Simplify ParseTemporalTimeZoneString
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/eec8efab
2022-10-20 00:47:42 +02:00
Idan Horowitz
0c61552b81 LibJS: Refactor ToRelativeTemporalObject
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/895854d9
2022-10-20 00:47:42 +02:00
Tobias Lundberg
8d7158025f Base: Add more emoji
🐑 - U+1F411 sheep
🐗 - U+1F417 boar
🐷 - U+1F437 pig face
🐻 - U+1F43B bear face
🐼 - U+1F43C panda face
2022-10-19 23:59:45 +02:00
Timothy Slater
038a833f0c PixelPaint: Add Polygonal Select Tool
Polygonal selection tool allows for the drawing of any arbitrary
polygonal shape. It tracks clicked points in a vector, upon double
clicking we finalize the polygon and generate the selection mask. The
user can press the escape key during selection to cancel.

The mask is generated as follows:

- First we calculate the size of the bounding rect needed to hold the
  polygon
- We add 2 pixels to height/width to allow us a 1 pixel border, the
  polygon will be centered in this bitmap
- Draw the polygon into the bitmap via Gfx::Painter, making sure to
  connect final polygon point to the first to ensure an enclosed shape
- Generate a selection mask the size of the bitmap, with all pixels
  initially selected
- Perform a flood fill from (0,0) which is guaranteed to be outside the
  polygon
- For every pixel reached by the flood fill, we clear the selected pixel
  from the selection mask
- Finally we merge the selection mask like other selection tools.
2022-10-19 23:04:07 +02:00
Timothy Slater
20f6485311 PixelPaint: Pass doubleclick events to tools 2022-10-19 23:04:07 +02:00
Timothy Slater
7b163573e6 PixelPaint: Ensure bitmap contains selected pixel before deleting
This fixes a bug which shows up when a layer is offset and the selection
range includes pixels that are outside the current layer bitmap rect. We
would still try to delete that pixel from the bitmap since there was no
contains() check.
2022-10-19 23:04:07 +02:00
Timothy Slater
53e4cc16ff PixelPaint: Make escape key clear selection for Wand Select Tool 2022-10-19 23:04:07 +02:00
Liav A
e81cf66784 Kernel: Don't assume paths to children PID directories in ProcFS code
Instead of using absolute paths which is considered an abstraction layer
violation between the kernel and userspace, let's not hardcode the path
to children PID directories but instead we can use relative path links
to them.
2022-10-19 16:44:16 -04:00
Moustafa Raafat
092b33c96e LibJS: Remove trivial operations ISO{Year,Month,Day}
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/606d8a2
2022-10-19 22:39:33 +02:00
Moustafa Raafat
69d5368b2a LibJS: Remove trivial operation IsValidISOMonth
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/a08330a
2022-10-19 22:39:33 +02:00
Moustafa Raafat
48cc557dfa LibJS: Merge ISOMonthCode and BuildISOMonthCode
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/a4d17b1
2022-10-19 22:39:33 +02:00
Moustafa Raafat
b69ceae10c LibJS: Improve alias names in ResolveISOMonth
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/01d5fbe
2022-10-19 22:39:33 +02:00
Moustafa Raafat
d758566996 LibJS: Simplify ResolveISOMonth
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/1b83226
2022-10-19 22:39:33 +02:00
Tobias Christiansen
92fd97ed63 WebDriver: Fix old current_window style 2022-10-19 22:34:10 +02:00
Tobias Christiansen
e87456e38f WebDriver: Implement GET /session/{id}/element/{id}/property/{name} 2022-10-19 22:30:06 +02:00
Tobias Christiansen
3db92885cd WebContent+Friends: Add get_element_property IPC and plumbing 2022-10-19 22:30:06 +02:00
Linus Groh
6641c99c80 WebDriver: Implement GET /session/{session id}/window/handles endpoint 2022-10-19 22:23:47 +02:00
Jelle Raaijmakers
91cec51b99 LibGL: Correctly normalize different vertex attribute type pointers
According to the OpenGL 2.0 spec § 2.8, the data for each attribute type
pointer is normalized according to the type. The only exception to this
is `glVertexAttribPointer` which accepts a `normalized` parameter, but
we have not yet implemented that API.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
00b21fba57 LibGL: Return GLboolean value in glIsEnabled 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
fe5419da0f LibGL: Implement state for all pixel store parameters
This implements the state and context parameters for all packing and
unpacking parameters accepted by `glPixelStore*`.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
e2b151812e LibGL: Don't repeat ourselves in read_from_vertex_attribute_pointer 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
5def168f14 LibGL: Implement missing glDeleteLists error conditions 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
2d59c9b6b6 LibGL: Make read_from_vertex_attribute_pointer static 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
01a4d58432 LibGL: Do not return early if client-side vertex array is disabled
According to the spec, enabling the client-side vertex array should
behave as if `glVertex` is executed after all other states such as the
normal, color, etc. have changed. We were not changing these states if
the client-side vertex array was disabled which probably does not affect
a lot of applications, but this seems like the correct thing to do. :^)
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
03258f4c96 LibGL: Add buffer API stubs
No implemented functionality, but this makes it easier to see if
software is using this family of functions.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
1c32d93a12 LibSoftGPU: Call floor_int_range only once in sample_2d_lod
We were invoking `frac_int_range` twice to get the `alpha` and `beta`
values to interpolate between 4 texels, but these call into
`floor_int_range` again. Let's not repeat the work.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
88ca72aa79 LibSoftGPU: Extract argb32_color value in rasterization
This makes it easier to correlate slow instructions in the disassembly
view of ProfileViewer.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
681695a07a LibSoftGPU: Make alpha testing a static function
There is no need to access the Device's members for alpha testing; pass
in the required alpha function and reference value.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
bdb2be8f9e LibGL: Remove context initialization from tests
We are either not using these defaults or they are already the
`GLContext`'s defaults to begin with.
2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
4e63ce231f LibSoftGPU: Clean up Sampler imports 2022-10-19 22:22:58 +02:00
Jelle Raaijmakers
1774fde37c LibSoftGPU: Drop texel Z coordinate from Sampler
We only support 2D indexing into textures at the moment, so don't
perform any work trying to support the Z coordinate.
2022-10-19 22:22:58 +02:00
cflip
75d46e0e96 Ports: Add a ClassiCube port 2022-10-19 22:07:05 +02:00
cflip
fea43a647f Ports/libopenal: Build with SDL2 backend, and disable example programs
This patch fixes libopenal's build by disabling the alsoft-config
utility which required qt6, and disabling the example programs that were
causing compiler errors.

This also forces CMake to build with an SDL2 backend so audio can
actually be played.
2022-10-19 22:07:05 +02:00
cflip
f872d945c3 Ports/SDL2: Add null check to SerenitySDLWidget::paint_event
This was causing a crash when message boxes appeared before the window
painted anything.
2022-10-19 22:07:05 +02:00
cflip
abc0c44f0b LibGL+LibGPU+LibSoftGPU: Report maximum texture size 2022-10-19 22:07:05 +02:00
Linus Groh
04ae4b89a3 WebDriver: Fix Session::close_window() declaration order 2022-10-19 21:11:37 +02:00