Commit Graph

12185 Commits

Author SHA1 Message Date
Jelle Raaijmakers
1aa1c89afa LibGL+LibGPU+LibSoftGPU: Report texture clamp to edge support 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
087f565700 LibSoftGPU: Divide texture coordinates by Q
Up until now, we have only dealt with games that pass Q = 1 for their
texture coordinates. PrBoom+, however, relies on proper homogenous
texture coordinates for its relatively complex sky rendering, which
means that we should perform this per-fragment division.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
72782d845d LibGL: Ensure texture coordinate Q is set to 1 by default
When using vertex attribute pointers, we default the Q coordinate for
textures to 0 causing issues if the 4th coordinate is not passed in the
vertex data.

Clean up these defaults and make sure that Q is always set to `1.f`.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
af217b0c3a LibGL: Implement GL_(CLIENT_)?ACTIVE_TEXTURE context parameters 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
00d46e5d77 LibGL+LibGPU+LibSoftGPU: Implement matrix stack per texture unit
Each texture unit now has its own texture transformation matrix stack.
Introduce a new texture unit configuration that is synced when changed.
Because we're no longer passing a silly `Vector` when drawing each
primitive, this results in a slightly improved frames per second :^)
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
1540c56e6c LibGL+LibGPU+LibSoftGPU: Implement GL_GENERATE_MIPMAP
We can now generate texture mipmaps on the fly if the client requests
it. This fixes the missing textures in our PrBoom+ port.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
dda5987684 LibGL+LibGPU+LibSoftGPU: Remove concept of layer in favor of depth
Looking at how Khronos defines layers:

  https://www.khronos.org/opengl/wiki/Array_Texture

We both have 3D textures and layers of 2D textures, which can both be
encoded in our existing `Typed3DBuffer` as depth. Since we support
depth already in the GPU API, remove layer everywhere.

Also pass in `Texture2D::LOG2_MAX_TEXTURE_SIZE` as the maximum number
of mipmap levels, so we do not allocate 999 levels on each Image
instantiation.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
44953a4301 LibGL+LibGPU+LibSoftGPU: Implement glCopyTex(Sub)?Image2d
These two methods copy from the frame buffer to (part of) a texture.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
d7f1dc146e LibGL: Calculate maximum log2 of texture size 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
eb81b66b4e LibGL+LibGPU+LibSoftGPU: Rename blit_color_buffer_to
This makes it consistent with our other `blit_from_color_buffer` and
paves the way for a third method that will be introduced in one of the
next commits.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
1d36bfdac1 LibGL+LibSoftGPU: Implement fixed pipeline support for GL_COMBINE
`GL_COMBINE` is basically a fixed function calculator to perform simple
arithmetics on configurable fragment sources. This patch implements a
number of texture env parameters with support for the RGBA internal
format.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
494024b70e LibGL: Verify Texture2D existence
The code currently guarantees that we always have a target texture.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
72b4f95f71 LibGL: Implement glMultiTexCoord2fv(ARB)? APIs 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
789d871892 LibGL: Define GL_NO_ERROR as 0
This conforms to the Khronos enum value listing and prevents a
redefinition warning when compiling with SDL_opengl.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
6d8dd0ee61 LibGL: Remove unused/default includes from GLContext 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
07e94b3ec1 LibGL: Implement GL_CURRENT_COLOR context parameter 2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
759ef82e75 LibSoftGPU: Convert width and height to f32x4 just once
We were passing along a `u32x4` only for it to be converted to `f32x4`
as soon as we'd use it.
2022-09-11 22:37:07 +01:00
Jelle Raaijmakers
b62dba6bbf LibSoftGPU: Remove unused alias truncate_int_range 2022-09-11 22:37:07 +01:00
networkException
9ff6c1e692 LibWeb: Avoid copying viewport rect when converting length to pixels
See https://github.com/SerenityOS/serenity/pull/3433#discussion_r484570948
2022-09-11 22:08:38 +01:00
networkException
2612d23032 LibGUI: Implement rubber band selection in table view
This patch implements rubber band selection in table view while clamping
the rubber band rect to the widget inner rect, matching the behavior of
IconView and ColumnsView.
2022-09-11 21:39:32 +01:00
networkException
e0353c405d LibGUI: Limit column view rubber band rect to widget inner rect
Previously when selecting a column that was partially scrolled out of
view the rubber band rect would extend outside the widget inner rect.

This patch rewrites the implementation to be more readable and clamps
the rubber band rect to the widget inner rect to match the behavior of
IconView.
2022-09-11 21:39:32 +01:00
networkException
e42a9cf957 LibGUI: Properly limit the icon view rubber band rect to the widget
Previously the rubber band rect of IconView was not properly constrained
to the widget inner rect, leaving a one pixel gap on the bottom and
right side. This patch removes the gap by inflating the constraint rect
by one pixel on each axis.
2022-09-11 21:39:32 +01:00
Timothy Flynn
5190f4e605 LibGUI: Support emoji with multiple code points in EmojiInputDialog 2022-09-11 20:33:57 +01:00
Timothy Flynn
31b2d93038 LibGUI+LibVT: Notify widgets of emoji selection with a callback
Currently, LibGUI modifies the Ctrl+Alt+Space key event to instead
represent the emoji that was selected through EmojiInputDialog. This is
limited to a single code point.

For multiple code point emoji support, individual widgets now set a hook
to be notified of the emoji selection with a UTF-8 encoded string. This
replaces the previous set_accepts_emoji_input() method.
2022-09-11 20:33:57 +01:00
Timothy Flynn
8190120f95 LibGUI: Use discovered emoji files as the EmojiInputDialog button icons
Rather than rendering the emoji as text, use the emoji icons themselves.
2022-09-11 20:33:57 +01:00
Timothy Flynn
a2eb42a9c0 LibGUI: Add an emoji category filter for SerenityOS custom emojis
Most of the emoji are 7x10px (or close to that). But some are larger, on
the order of 128x128px. The icon used for the SerenityOS category is one
such large emoji, and must be scaled down to an appropriate size for
rendering.
2022-09-11 20:33:57 +01:00
Timothy Flynn
4cb9472f97 LibGUI: Ensure unknown emoji have a set display order
Currently, we use code point values as a tie break when sorting emoji by
display order. When multiple code point emoji are supported, this will
become a bit awkward. Rather than dealing with varying code point length
while sorting, just set a maximum display order to ensure these are
placed at the end.
2022-09-11 20:33:57 +01:00
Timothy Flynn
b7ef36aa36 LibUnicode: Parse and generate custom emoji added for SerenityOS
Parse emoji from emoji-serenity.txt to allow displaying their names and
grouping them together in the EmojiInputDialog.

This also adds an "Unknown" value to the EmojiGroup enum. This will be
useful for emoji that aren't found in the UCD, or for when UCD downloads
are disabled.
2022-09-11 20:33:57 +01:00
davidot
b6094b7a3d LibTest: Extract some useful functions from TestRunner.h
This allows other test like programs to use these without needing to
link to LibTest.
2022-09-11 20:25:51 +01:00
networkException
08f465a47d LibGUI: Blit brightened icon when try item is hovered 2022-09-10 20:40:05 +01:00
davidot
d4736d17ae LibJS: Allow negative pointers in Value
Also ensure that all a nullptr input gives null object and you don't
accidentally dereference a nullptr.
2022-09-10 00:05:32 +01:00
Jelle Raaijmakers
325263f0e8 LibC: Consume all whitespace in scanf if present in format
We were consuming all whitespace from the format, but not the input
lexer - that was left to the actual format parsing code. It so happened
that we did not account for whitespace with the conversion specifier
'[', causing whitespace to end up in the output variables.

Fix this by always consuming all whitespace and removing the whitespace
logic from the conversion code.
2022-09-09 22:54:25 +01:00
Luke Wilde
875ca2fb68 LibWeb: Set prototype for both TextDecoder and AbortSignal
These were forgotten to be set during the GC heap conversion.
2022-09-09 20:47:43 +02:00
networkException
75ac47dbd8 LibWeb: Resolve two document-tree child browsing context count FIXMEs
This patch makes use of helpers implemented for window.length to resolve
two FIXMEs in WindowProxy previously simply assuming no child browsing
contexts :^)
2022-09-09 17:42:30 +01:00
networkException
e377e28fd2 LibWeb: Implement window.length 2022-09-09 17:42:30 +01:00
thankyouverycool
b70e4e9909 Spreadsheet+LibGUI: Set EmojiInputDialog as a CaptureInput modal
This has two advantages: First the picker no longer changes the active
window state of its parent. Visually this is an additional hint that the
dialog is "fragile" and will close on loss of focus. Second, because
it contains a search box, its own input won't be preempted by global
application shortcuts when typing (pending #15129). This is a problem
in apps like PixelPaint which use shortcuts without modifiers.
2022-09-09 11:27:38 -04:00
thankyouverycool
2f6fd56631 LibGUI: Set EmojiInputDialog's FrameShape to "Window" 2022-09-09 11:27:38 -04:00
thankyouverycool
0bcd360266 LibGUI: Add ellipsis to Insert Emoji action
Requires further user input
2022-09-09 11:27:38 -04:00
thankyouverycool
f8e65d24cf LibGUI: Allow blocking CommandPalette/EmojiInput on a per Window basis
Instead of having to negate every focusable widget or textbox, let
windows override all their widgets. These two Dialogs now block
themselves and each other.
2022-09-09 11:27:38 -04:00
Andreas Kling
bfcb4d88cf LibWeb: Treat percentage heights as "auto" if unresolvable
If the containing block has indefinite height, we can't resolve
percentage heights against it. Instead of treating it as 0 by accident,
let's treat it as "auto" on purpose.

This brings back the cheek borders on Acid2.
2022-09-09 15:20:10 +02:00
Andreas Kling
b7d8fbbd70 LibWeb: Update layout in Element.client{Left,Top}
We have to flush any pending layout changes before getting metrics.
2022-09-09 15:20:10 +02:00
Andreas Kling
67b3af8025 LibWeb: Avoid layout in Element.client{Width,Height} if possible
When querying the HTML element (in strict mode) or the BODY element
(in quirks mode), we return the viewport dimensions.

Layout doesn't change the size of the viewport, so we can actually
reorder the steps here and avoid performing layout in some cases.

This removes a bunch of synchronous layouts on pages with reCAPTCHA.
2022-09-09 15:20:10 +02:00
Andreas Kling
3f960781fd LibWeb: Don't collapse vertical margins between floats
Just stack floats at their vertical margin edge instead of letting their
border boxes rub up against each other.
2022-09-09 15:20:10 +02:00
Andreas Kling
524ec95bcd LibWeb: Keep CSS sheets sorted in document tree order
This ensures that style is applied consistently, even if the document
has external CSS resources that don't always arrive in the same order.
2022-09-09 15:20:10 +02:00
faxe1008
d91469ebb1 LibGUI: CommandPalette: Fix key event capture for actions
This patch fixes an issue for applications that contain actions without
a modifier (e.g. PixelPaint). Previously when pressing any key bound to
an action while the CommandPalette was visible the action was forwarded
to the parent instead of the CommandPalette.
2022-09-09 15:15:09 +02:00
demostanis
1c5f6003d7 LibCore: Add File::open_file_or_standard_stream() 2022-09-09 14:11:52 +01:00
thankyouverycool
51006930da LibGUI: Only react on KeyDown when escaping a Dialog
Both KeyEvents aren't necessary and erroneously close two
Dialogs at once.
2022-09-08 23:21:54 +01:00
thankyouverycool
463aff827e LibGUI+WindowServer: Notify Windows on input preemption
Previously Menus set themselves as active input solely to make
sure CaptureInput modals would close, but this is a functional
half-truth. Menus don't actually use the active input role; they
preempt normal Windows during event handling instead.

Now the active input window is notified on preemption and Menus
can remain outside the active input concept. This lets us make
more granular choices about modal behavior. For now, the only
thing clients care about is menu preemption on popup.

Fixes windows which close on changes to active input closing
on their own context menus.
2022-09-08 23:21:54 +01:00
Timothy Flynn
7c9ad6cc2f LibGUI: Add Unicode emoji group filters to the EmojiInputDialog
This allows users to filter the list of displayed emoji by the group to
which the emoji belong.
2022-09-08 23:12:31 +01:00
Timothy Flynn
273045d40e LibGUI: Display emoji in the EmojiInputDialog in Unicode display order 2022-09-08 23:12:31 +01:00
Timothy Flynn
c2148c7dde LibGUI: Add placeholder text to the emoji picker search box
Co-authored-by: electrikmilk <brandonjordan124@gmail.com>
2022-09-08 23:12:31 +01:00
Timothy Flynn
b61eca0a1e LibUncode: Parse and generate emoji code point data
According to TR #51, the "best definition of the full set [of emojis] is
in the emoji-test.txt file". This defines not only the emoji themselves,
but the order in which they should be displayed, and what "group" of
emojis they belong to.
2022-09-08 23:12:31 +01:00
electrikmilk
6a09d89329 Base+LibGUI: Add insert emoji common action
This adds a common action to invoke the emoji picker.
2022-09-08 23:08:54 +01:00
Jelle Raaijmakers
b42feb76a0 LibSoftGPU: Use approximation for maximum depth slope
OpenGL allows GPUs to approximate a triangle's maximum depth slope
which prevents a number computationally expensive instructions. On my
machine, this gives me +6% FPS in Quake III.

We are able to reuse `render_bounds` here since it is the containing
rect of the (X, Y) window coordinates of the triangle, thus its width
and height are the maximum delta X and delta Y, respectively.
2022-09-08 12:07:03 -04:00
Jelle Raaijmakers
08204efe1f LibGL: Set correct color material mode for GL_AMBIENT_AND_DIFFUSE
This was a silly mistake :^)
2022-09-08 12:05:54 -04:00
Andreas Kling
7ba6eb37fc LibWeb: Rename confusing parameter to layout_block_level_box()
It wasn't the content height, but rather the the bottom edge of the
lowest margin box.
2022-09-08 15:03:55 +02:00
Andreas Kling
af73a5d921 LibWeb: Use correct box edge when looking for space between floats 2022-09-08 15:03:55 +02:00
Andreas Kling
8f0a48ef23 LibWeb: Make default CSS font settings match other browsers better
Let's make 16px the default font size instead of 10px. This makes our
layout results match those of other engines in many more cases.

Also make the h1-h6 element styles use relative (em) font sizes, also
matching other browsers.
2022-09-08 12:43:49 +02:00
Andreas Kling
3dc82d2fa5 LibGfx: Add API for loading more directories into Gfx::FontDatabase
Also make the font discovery algorithm search subdirectories as well.
This will be used by Ladybird to discover more fonts on non-Serenity
systems. :^)
2022-09-08 12:30:25 +02:00
Andreas Kling
5c2e3d1637 LibWeb+WebContent: Add abstraction layer for generic font families
Instead of hard-coding the names of system fonts to use for the CSS
generic fonts (like "sans-serif", "monospace", etc.) we now call out
to a Platform::FontPlugin and ask for the generic names.
2022-09-08 11:57:03 +02:00
Andreas Kling
26544f559c LibWeb: Make anonymous wrapper blocks actually have "display: block"
We didn't set their display at all before, and since CSS display is not
inherited, anonymous block wrappers were actually "display: inline", but
it kinda worked anyway because we positioned blocks based on their C++
class (BlockContainer) rather than their CSS display value.

Now that we position based on CSS display value, this broke positioning
of anonymous wrapper blocks, and this fixes that.
2022-09-08 11:54:13 +02:00
thankyouverycool
35e557c657 Browser+LibGUI+WindowServer: Open Button menus uniformly
Instead of letting buttons determine the relative position
of their menus, a workaround only used by Statusbar segments,
open them all uniformly for a nice, consistent UI.

Passing a rect to popup() now routes to open_button_menu(), an
analog to open_menubar_menu(), which adjusts the menu's popup
position in the same way. Fixes button menus obscuring the buttons
which spawn them and jutting out at odd corners depending on screen
position.
2022-09-08 10:17:27 +01:00
thankyouverycool
0fc1925cd7 LibGUI: Simulate a click on arrow key events for AbstractButtons
in exclusive, checkable groups. Instead of merely setting the
button checked, call click() so buttons with registered actions
can activate. Fixes ActionGroups like FileManager's view type
checkables not activating when cycled with the keyboard.
2022-09-08 10:17:27 +01:00
thankyouverycool
12ee92004d LibGUI+Taskbar: Don't immediately repaint checkable Buttons
Unlike regular buttons, unchecked checkables don't need to repaint
on MouseUp to feel responsive when clicking rapidly. In fact, this
can lead to a flickering effect when a bogus unchecked state gets
painted again before the button's checked one.
2022-09-08 10:17:27 +01:00
Andreas Kling
9e39f51fd3 LibWeb: Position blocks after previous block-level box, ignoring type
Before this change, block-level boxes were laid out vertically by
placing them after the nearest previous BlockContainer sibling. This
only worked if the preceding block-level box happened to be a
BlockContainer.

This fixes an issue where the screenshot on netsurf-browser.org was not
being laid out properly (it was `img { display: block }` which creates
a block-level ImageBox, and ImageBox is not a BlockContainer but a
ReplacedBox, so the following block-level box was skipping over the
ImageBox and being placed next to whatever was before the ImageBox..)
2022-09-08 01:42:25 +02:00
Andreas Kling
7b0dd98103 LibJS+LibWeb: Spin event loop via VM::CustomData abstraction
Instead of calling Core::EventLoop directly, LibJS now has a virtual
function on VM::CustomData for customizing this behavior.

We use this in LibWeb to plumb the spin request through to the
PlatformEventPlugin.
2022-09-08 00:13:39 +02:00
Andreas Kling
9567e211e7 LibWeb+WebContent: Add abstraction layer for event loop and timers
Instead of using Core::EventLoop and Core::Timer directly, LibWeb now
goes through a Web::Platform abstraction layer instead.

This will allow us to plug in Qt's event loop (and QTimer) over in
Ladybird, to avoid having to deal with multiple event loops.
2022-09-07 20:30:31 +02:00
Andreas Kling
9018b58875 LibWeb: Only schedule ImageStyleValue resource load once
load_any_resources() may get called multiple times during layout, but
once we've started a resource load, we don't need to do it again.
2022-09-07 17:47:33 +02:00
Andreas Kling
faf9746244 LibWeb: Cache width of "alt" text in ImageBox
We were constantly measuring and re-measuring the "alt" attribute text
of ImageBox layout nodes, even when the alt text didn't change. By
caching this, we avoid a *lot* of repeated text measurement work.
2022-09-07 17:47:33 +02:00
Andreas Kling
514fa83708 LibWeb: Improve float: right behavior
- Use the border box of the floated element when testing if something
  needs to flow around it.
- Take the floated element's containing block size into account (instead
  of the BFC root) when calculating available space on a line where a
  right-side float intrudes.
2022-09-07 17:47:33 +02:00
Andreas Kling
a42506c8b9 LibWeb: Fix three accidental float truncations
We were doing this:

    max(0, some_floating_point_value)

This returns an `int` result based on the type of `0`, oops!
2022-09-07 17:47:33 +02:00
Timothy Flynn
21a89b65fc LibGUI: Set a tooltip on the emojis' buttons to their code point names 2022-09-07 14:34:02 +01:00
Timothy Flynn
eeb7b153a2 LibGUI: Add a search box to filter EmojiInputDialog by code point names 2022-09-07 14:34:02 +01:00
Timothy Flynn
a885406511 LibGUI: Disable EmojiInputDialog updates while re-displaying emoji
To prevent lag when the displayed code points are redrawn in support of
a search box, disable updates while re-adding the emoji buttons.
2022-09-07 14:34:02 +01:00
Timothy Flynn
1c32823dd8 LibGUI: Create the emoji buttons only once for EmojiInputDialog
To prevent lag when the displayed code points are redrawn in support of
a search box, only create the GUI::Button objects for the emoji a single
time. Re-use those buttons when adding them to the dialog.
2022-09-07 14:34:02 +01:00
Timothy Flynn
a511dec5ca LibGUI: Move code to display emoji buttons to a helper function
For a search box to be added, this code will need to be re-invoked as
the search query updates.
2022-09-07 14:34:02 +01:00
Timothy Flynn
3aaaacdb3a LibGUI: Wrap the EmojiInputDialog in a scrollable container
This will prevent the dialog from growing endlessly as emoji are added.
2022-09-07 14:34:02 +01:00
Timothy Flynn
11d29bc2ea LibGUI: Convert EmojiInputDialog to GML
This will allow easily adding components such as a search box. Also,
increase the number of emoji per row. This does not fix the issue where
too many emoji will cause the dialog to grow limitlessly, but it looks a
bit more reasonable now with the number of emoji that we have.
2022-09-07 14:34:02 +01:00
Jelle Raaijmakers
15a9fca461 LibGfx: Correctly shift pixels during bilinear blend
Our bilinear scaling logic worked well for upscaling, but during
downscaling the bitmap was often shifted one pixel to the bottom right.

This is a common problem, described here in more detail:

  https://bartwronski.com/2021/02/15/bilinear-down-upsampling-pixel-grids-and-that-half-pixel-offset/

Fix it by calculating coordinate shift values that align the pixel's
boundaries between the source and target pixels before selecting the
source pixels to interpolate.
2022-09-06 18:00:50 +01:00
networkException
5b46d16b4d LibGUI: Update {in,de}crement buttons when setting a new spin box range 2022-09-06 17:37:44 +01:00
Andreas Kling
43f87c67f2 LibWeb: Remove unused WindowObject.h 2022-09-06 13:54:49 +02:00
electrikmilk
1ab510c4bb Base+LibGUI: Add Git folder icons
This adds icons for folder paths ending in ".git". This adds 16x16 and
32x32 versions of a folder with a Git logo for both the closed and open
versions of the folder icon.
2022-09-06 07:38:09 +01:00
Andreas Kling
d13d571844 LibJS: Make sure JS::Script visits its HostDefined object
This allows JS::Script to mark its corresponding HTML::Script, even if
it's a little roundabout looking. Fixes an issue where the JS::Script
was kept alive by the execution stack, but the HTML::Script was gone.

This was originally part of 8f9ed415a0
but got lost in a merging accident.
2022-09-06 01:21:09 +02:00
Andreas Kling
88f2f50c55 LibWeb: Don't use the internal window object when parsing HTML fragments
Instead, use the window object from the context element. This fixes an
issue where activating event handlers during fragment parsing would try
to set up callbacks using the internal window object's ESO.

This caused a verify_cast crash on Google Maps, since the internal realm
doesn't have an associated ESO. Perhaps it should, but in this specific
case, it makes more sense for fragment parsing to fully adopt the
context provided.
2022-09-06 01:12:44 +02:00
Andreas Kling
4c665c3749 LibWeb: Remove some unnecessary use of the internal realm in EventTarget
Now that EventTarget is GC-allocated, it can find the GC heap by just
calling heap() on itself, no need to get this via the internal realm.
2022-09-06 01:07:59 +02:00
Andreas Kling
8f9ed415a0 LibJS+LibWeb: Make HTML::Script GC-allocated
This allows the garbage collector to keep HTML::Script objects alive and
fixes a bug where a HTMLScriptElement could get GC'd while its code was
executing.
2022-09-06 00:27:09 +02:00
Andreas Kling
00c8f07192 LibJS: Make Script and Module GC-allocated
This ensures that code currently in any active or saved execution stack
always stays alive.
2022-09-06 00:27:09 +02:00
Andreas Kling
cb15132146 LibWeb: Always allow scripting in workers for now
Workers don't have a document, so we can't ask them if scripting is
enabled or not. This is not the right long-term fix, but it fixes an
assertion when trying to query the missing responsible document of a
web worker.
2022-09-06 00:27:09 +02:00
Andreas Kling
e97cc671ea LibWeb: Give web workers a (totally hacky) Window object
This is *not* according to spec, however we currently store prototypes
and constructors on Window, so the only way for objects in a worker
context to become fully formed is to make a Window.

Long-term we should clean this up and remove the worker window object,
but for now it allows workers to exist without asserting.
2022-09-06 00:27:09 +02:00
Andreas Kling
8f110e0fb1 LibWeb: Remove the NoInstanceWrapper extended IDL attribute
No interfaces require wrappers anymore, so we can just make this the
default mode.
2022-09-06 00:27:09 +02:00
Andreas Kling
1bd4ad8b6d LibWeb: Remove now-unused Bindings::wrap() 2022-09-06 00:27:09 +02:00
Andreas Kling
9176a0de99 LibWeb: Stop using Bindings::wrap() in a bunch of places
wrap() is now basically a no-op so we should stop using it everywhere
and eventually remove it. This patch removes uses of wrap() in
non-generated code.
2022-09-06 00:27:09 +02:00
Andreas Kling
45425de849 LibWeb: Use the WRAPPER_HACK() macro instead of hand-coding wrap()
This macro will soon go away, but let's start by replacing all the
hand-coded versions of wrap() with this macro that expands to the same
exact thing.
2022-09-06 00:27:09 +02:00
Andreas Kling
39660a8680 LibWeb: Remove now-unused Bindings::Wrapper class 2022-09-06 00:27:09 +02:00
Andreas Kling
3768743a0a LibWeb: Remove now-unused Bindings::Wrappable class 2022-09-06 00:27:09 +02:00
Andreas Kling
ac274eee72 LibWeb: Remove the NO_INSTANCE option now that all wrappers are gone 2022-09-06 00:27:09 +02:00
Andreas Kling
497ead37bc LibWeb: Make DOMException GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
0e47754ac8 LibWeb: Make LocationObject a PlatformObject 2022-09-06 00:27:09 +02:00
Andreas Kling
2fe97fa8db LibWeb: Make WorkerNavigator GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
9da72cdaba LibWeb: Make WorkerLocation GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
25daa14a05 LibWeb: Make IntersectionObserver GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
fe9c5395d4 LibWeb: Make URL, URLSearchParams & URLSearchParamsIterator GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
0dc2c27fa3 LibWeb: Make ResizeObserver GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
915a240944 LibWeb: Make IdleDeadline GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
8f2a711132 LibWeb: Make Selection GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
be9d3860b9 LibWeb: Make Crypto GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
96f6c7fae5 LibWeb: Make Headers and HeadersIterator GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
647ac1bdba LibWeb: Make Blob and File GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
018d236439 LibWeb: Make TextDecoder GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
7e508456a0 LibWeb: Make TextEncoder GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
57db2529cf LibWeb: Make DOMRect, DOMRectReadOnly and DOMRectList GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
44415af428 LibWeb: Make DOMPoint and DOMPointReadOnly GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
a9cae56f8e LibWeb: Remove unused HTML::Window::create_with_document() 2022-09-06 00:27:09 +02:00
Andreas Kling
7a9b8ced38 LibWeb: Make SubtleCrypto GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
2ac8e3db3a LibWeb: Make Storage GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
d7c6298d8b LibWeb: Use target's global object when creating focus/blur events 2022-09-06 00:27:09 +02:00
Andreas Kling
05dcf3b2f8 LibWeb: Don't allocate DOMStringMap in HTMLElement constructor
Allocations go in initialize().
2022-09-06 00:27:09 +02:00
Andreas Kling
b30e95eb27 LibWeb: Don't allocate NamedNodeMap in Element constructor
Allocations should happen in the initialize() virtual, so move it there.
2022-09-06 00:27:09 +02:00
Andreas Kling
ffad902c07 LibWeb: Use cached_web_prototype() as much as possible
Unlike ensure_web_prototype<T>(), the cached version doesn't require the
prototype type to be fully formed, so we can use it without including
the FooPrototype.h header. It's also a bit less verbose. :^)
2022-09-06 00:27:09 +02:00
Andreas Kling
a85542958c LibWeb: Add some missing constructors to the Window object 2022-09-06 00:27:09 +02:00
Andreas Kling
dd9cd3050b LibWeb: Use correct Window object when dispatching Document load event 2022-09-06 00:27:09 +02:00
Andreas Kling
1029ea4b32 LibWeb: Use correct relevant settings object in Document initialization
The code was not in line with the spec comment right above it.
2022-09-06 00:27:09 +02:00
Andreas Kling
5724a04553 LibWeb: Make StyleSheet mark its owner node
The garbage collector will take care of cycles.
2022-09-06 00:27:09 +02:00
Andreas Kling
36085676d2 LibWeb: Make CSSImportList mark its document
We don't need to use a WeakPtr here anymore, since the garbage collector
will resolve any cycles.
2022-09-06 00:27:09 +02:00
Andreas Kling
a835f313f7 LibWeb: Make Document::is_fully_active() more robust
We were missing a check for null browsing context container documents.
2022-09-06 00:27:09 +02:00
Andreas Kling
4901f69345 LibWeb: Don't capture raw ptr in Document::completely_finish_loading()
It's not safe to capture a raw pointer in a HTML task, as the garbage
collector doesn't have visibility into the task captures.
2022-09-06 00:27:09 +02:00
Andreas Kling
233208b640 LibWeb: Make XMLSerializer GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
6b7a1d13e9 LibWeb: Make TextMetrics GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
2704bcdaaa LibWeb: Make Path2D GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
0d2fee351a LibWeb: Make CanvasGradient GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
369dd42d67 LibWeb: Make ImageData GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
4452b5ca09 LibWeb: Make 2D and 3D canvas rendering contexts GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
b8d485e6f0 LibWeb: Make AbortController GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
3905d54a9c LibWeb: Make SVGLength and SVGAnimatedLength GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
16fbb91aa1 LibWeb: Make History GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
abfb73f2e7 LibWeb+LibJS: Let JS::Realm::HostDefined objects mark things during GC
This allows us to mark the HTML::Window from our window environment
settings object.
2022-09-06 00:27:09 +02:00
Andreas Kling
2ff7e37048 LibWeb: Make MessageChannel GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
2bba97964b LibWeb: Make HTMLCollection and subclasses GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
4c887bf6c3 LibWeb: Remove Document::interpreter()
Nobody needs this anymore, so we can finally remove it. :^)
2022-09-06 00:27:09 +02:00
Andreas Kling
2d72abc3d4 LibWeb+WebContent: Store Realm instead of Interpreter in ConsoleClient 2022-09-06 00:27:09 +02:00
Andreas Kling
905eb8cb4d LibWeb: Make MutationObserver GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
43ec0f734f LibWeb: Make MutationRecord GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
48e0066371 LibWeb: Make NodeList GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
8f4ea4e308 LibWeb: Don't use a JS::Handle for XHR response object 2022-09-06 00:27:09 +02:00
Andreas Kling
c7ac82ec33 LibWeb: Make HTML::Timer GC-allocated
These are the timers used internally by setTimeout() and setInterval().
2022-09-06 00:27:09 +02:00
Andreas Kling
c569c88e63 LibWeb: Don't have Handle<Realm> in WindowEnvironmentSettingsObject
This was preventing window realms from ever being garbage collected.
2022-09-06 00:27:09 +02:00
Andreas Kling
5f4d4ffe39 LibWeb: Make PerformanceTiming GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
8c90e08e0b LibWeb: Make CSS::Screen GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
d5e831988e LibWeb: Make DOMParser GC-allocated 2022-09-06 00:27:09 +02:00
Andreas Kling
8341f142ea LibWeb: Add HTML::Window::cached_web_prototype()
This is a simpler version of ensure_web_prototype<T>(). This new version
assumes that we already have a cached instance of the prototype.
2022-09-06 00:27:09 +02:00