Commit Graph

18495 Commits

Author SHA1 Message Date
Andreas Kling
c04b107e26 LibWeb: Treat replaced % sizes as 0 if containing block is indefinite 2022-09-24 14:41:18 +02:00
Andreas Kling
416fa7bd4f LibWeb: Bring flex basis calculation a little closer to spec
This ends up having a big impact on performance, as we now correctly
treat a used flex-basis of `content` as `max-content` which means
we can use cacheable intrinsic sizes for flex items in the majority
of cases.
2022-09-24 14:09:56 +02:00
Andreas Kling
f0ac687823 LibWeb: Remove awkward BFC::compute_theoretical_height() function
This was used by FFC to estimate the height of flex items after
performing layout inside them.

Now that we have automatic_content_height(), we no longer need this
awkward API and we can fold it into BFC's own height calculation.
2022-09-24 13:53:23 +02:00
MacDue
4d7e4e5da8 LibWeb: Avoid overflow and OOB indexing in get_buffer_source_copy()
Previously, this would overflow when both length and offset were
zero, leading to an OOB index into es_array_buffer. This would lead to
a crash on a few MDN pages.
2022-09-24 13:49:15 +02:00
Andreas Kling
ba065faa54 LibWeb: Remove unused capture in queue_a_microtask() 2022-09-24 13:48:38 +02:00
Andreas Kling
a8e1599ae1 LibWeb: Use automatic_content_height() in flex item internal layouts 2022-09-24 13:47:58 +02:00
Andreas Kling
5656173e00 LibWeb: Use automatic_content_height() when computing intrinsic heights 2022-09-24 13:47:17 +02:00
Andreas Kling
62974160da LibWeb: Add FormattingContext::automatic_content_height()
This function should return the automatic height of the formatting
context's root box.

Until now, we've been relying on some magical handshakes between parent
and child context, when negotiating the height of child context root
boxes. This is a step towards something more reasonable.
2022-09-24 13:41:08 +02:00
Andreas Kling
b52165c5d7 LibWeb+LibGfx: Move the blit image through 2D transfrom to Gfx::Painter
Even though this code is obnoxiously slow, it still belongs in LibGfx
and should not be hidden away in LibWeb's CanvasRenderingContext2D.
2022-09-24 13:00:53 +02:00
Andreas Kling
37ea6de772 LibWeb: Remove now-unnecessary JS::Handles in microtask capture lists 2022-09-24 12:23:29 +02:00
Andreas Kling
874e64d664 LibWeb: Make queue_an_element_task() use JS::SafeFunction 2022-09-24 12:23:29 +02:00
Andreas Kling
2ccb9bef49 LibWeb: Remove now-unnecessary JS::Handles in HTML task capture lists
JS::SafeFunction will protect anything captures for HTML tasks now.
2022-09-24 12:23:29 +02:00
Andreas Kling
d505192014 LibWeb: Use JS::SafeFunction in the HTML task queues
This means that HTML tasks automatically protect anything in their
capture lists, and we no longer need to jump through hoops with
JS::Handle etc.
2022-09-24 12:23:29 +02:00
Andreas Kling
131c3f50de LibJS: Add JS::SafeFunction, like Function but protects captures from GC
SafeFunction automatically registers its closure memory area in a place
where the JS garbage collector can find it.

This means that you can capture JS::Value and arbitrary pointers into
the GC heap in closures, as long as you're using a SafeFunction, and the
GC will not zap those values!

There's probably some performance impact from this, and there's a lot of
things that could be nicer/smarter about it, but let's build something
that ensures safety first, and we can worry about performance later. :^)
2022-09-24 12:23:29 +02:00
MacDue
f5052e5017 LibWeb: Don't trigger page_did_layout() on non-active documents
PageHost assumes page_did_layout() to be called when the layout
of the active document changes, however, it seems that sometimes
the layout can change on another document before the layout of
the active document has been calculated. This leads to a VERIFY()
being hit.

This commit now makes it so page_did_layout() is only called when
the document is the active document.

Fixes #15328
2022-09-24 00:38:10 +02:00
Luke Wilde
7b8a6b8e7a LibWeb: Set HTMLParser::m_scripting_enabled as according to the spec
This allows <noscript> elements to display their content as proper HTML
instead of raw text when scripting is disabled.
2022-09-23 22:25:09 +01:00
Luke Wilde
dfe57543a4 LibWeb: Keep message alive in postMessage task callback lambda
Tasks can run at any time in the future and GC can run in the time
between postMessage and running the task, meaning the message can be
reaped if we don't keep a handle to it.

Fixes Google Syndication ads crashing 100% of the time on rpcs3.net
2022-09-23 17:23:55 +01:00
Liav A
36f2e85823 WindowServer: Fix mapping the correct framebuffer size
If we don't support double buffering for a certain type of hardware,
don't try to map with size calculated with (pitch * height * 2), as it
will result in trying to map more memory than is available in the
framebuffer memory range.
2022-09-23 14:04:00 +01:00
Linus Groh
76ace3629a LibWeb: Make Fetch::Infrastructure::Body::stream() const 2022-09-22 21:01:13 +01:00
Linus Groh
c7c6d7d9e1 LibWeb: Make FileAPI::Blob::create() buffer/type overload infallible 2022-09-22 21:01:13 +01:00
Linus Groh
54a987ad45 LibWeb: Update extract_body() to use BodyInit 2022-09-22 21:01:13 +01:00
Linus Groh
8f5620b5d9 LibWeb: Add BodyInit union type 2022-09-22 21:01:13 +01:00
Linus Groh
571f4e3ebb LibWeb: Move extract_body() into Fetch 2022-09-22 21:01:13 +01:00
Linus Groh
f98ce156c4 LibWeb: Remove ReadableStreamDummy in favor of ReadableStream 2022-09-22 21:01:13 +01:00
Linus Groh
87654f5b51 LibWeb: Start fleshing out the ReadableStream interface
This is so we can just assume it exists in Fetch APIs (while still
skipping functionality that relies on a full implementation, of
course).
2022-09-22 21:01:13 +01:00
Linus Groh
1ace80235b LibWeb: Move XMLHttpRequestBodyInit into Fetch
https://fetch.spec.whatwg.org/#typedefdef-xmlhttprequestbodyinit
2022-09-22 21:01:13 +01:00
thankyouverycool
1bba8589fe LibGUI: Hide unnecessary Scrollbars in ComboBox windows
And simplify rect calculations using content size.
2022-09-22 21:37:26 +02:00
thankyouverycool
7858f885fe LibGUI: Update ListView content size on relevant layout changes
Fixes incorrect content sizing when unnecessary scrollbars are hidden.
2022-09-22 21:37:26 +02:00
thankyouverycool
8b4bf96db3 LibGUI: Apply horizontal padding evenly for ListView items 2022-09-22 21:37:26 +02:00
thankyouverycool
930e5c27df ClockSettings: Increase max visible items for time zone ComboBox 2022-09-22 21:37:26 +02:00
thankyouverycool
f86c5b1fa7 LibGUI: Allow setting max visible items for ComboBoxes
This will govern the maximum number of items ComboBox windows display
before scrolling content.
2022-09-22 21:37:26 +02:00
thankyouverycool
aa8e7aba42 LibGUI: Don't show empty ComboBox windows 2022-09-22 21:37:26 +02:00
thankyouverycool
a0de3860cc LibGUI: Make ListView item_count() public 2022-09-22 21:37:26 +02:00
thankyouverycool
04a9562601 LibGUI: Don't open windows for editable ComboBoxes when typing
Fixes inability to type custom values into ComboBox editors.

CaptureInput preempts typing while the ListView window is open.
For now, searching can still be done by manually opening the window.
2022-09-22 21:37:26 +02:00
thankyouverycool
7c2edd232d LibGUI: Reset Windows as visible for timer purposes on show()
Fixes scrolling timers failing to fire if a ComboBox window
had previously become occluded.
2022-09-22 21:37:26 +02:00
thankyouverycool
db2a1d3620 LibGUI: Always activate ComboBox ListView selections on MouseUp
Fixes having to doubleclick selected items to activate them if
the selection index hasn't changed since last activation.
2022-09-22 21:37:26 +02:00
thankyouverycool
7ac30f53a0 LibGUI: Block ComboBox windows from using CommandPalette 2022-09-22 21:37:26 +02:00
Andrew Kaster
8f38367d46 LibCore: Only include Account.h on Serenity in EventLoop and System
Core::Acount is only used within ``#ifdef __serenity__`` blocks in these
files, so guard the inclusion of Account.h in the same way.

This fixes the Android build of these files.
2022-09-22 11:07:21 -04:00
Andreas Kling
a52d346839 LibWeb: Take coordinate spaces into account when clearing past floats
We were forgetting to convert to and from BFC root relative coordinates
when calculating how much clearance was needed to get past floats.

This fixes the last remaining issue on Acid1, which is now perfect. :^)
2022-09-22 17:06:49 +02:00
Andreas Kling
5efd63741f LibWeb: Perform horizontal inline alignment based on available space
Previously, we were using the full containing block width as a reference
for text-align values "right" and "center". This didn't take intruding
floats into account.
2022-09-22 17:06:48 +02:00
Andreas Kling
d43ef27761 LibWeb: Only include containing blocks in coordinate space translation
Layout box offset coordinates are always relative to their containing
block. Therefore, the functions that convert between coordinate spaces
should only visit containing blocks and apply their offsets, not *every*
box in the parent chain.

This fixes an issue where some floating boxes were unexpectedly far away
from their containing block.
2022-09-22 16:54:12 +02:00
Andreas Kling
54fb5af9ee LibWeb: Use entire margin box of floats when testing for intrusions 2022-09-22 16:54:12 +02:00
Andreas Kling
389f47f6fe LibWeb: Check both top and bottom of float position when looking for fit
We have to check that there's enough space at both the top and bottom of
the float's margin box, otherwise we risk overlapping existing content.
2022-09-22 16:54:12 +02:00
Timothy Flynn
82e730eba1 LibJS: Change default time display options to "always" for digital style
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/d28076b
2022-09-22 14:39:24 +01:00
Timothy Flynn
73fcaaeda4 Taskbar: Add a context menu to open clock settings from the clock widget 2022-09-22 11:46:53 +01:00
Sam Atkins
c64a5ccf29 LibWeb: Avoid unnecessary copies in CSS Parser 2022-09-22 02:04:23 +02:00
Sam Atkins
a211c06e99 LibWeb: Use llroundf() when rounding floats 2022-09-22 02:04:23 +02:00
Sam Atkins
188d9f1326 LibWeb: Resolve some trivial clang-tidy warnings in the CSS Parser
Issues resolved:
- Unnecessary `move()`s
- `else` after `return`
- `auto&` that could be `auto const&`

Why yes, I did just get clang-tidy set up. :^)
2022-09-22 02:04:23 +02:00
Linus Groh
edfef8e2f5 Everywhere: Rename WrapperGenerator to BindingsGenerator
This code generator no longer creates JS wrappers for platform objects
in the old sense, instead they're JS objects internally themselves.
Most of what we generate now are prototypes - which can be seen as
bindings for the internal C++ methods implementing getters, setters, and
methods - as well as object constructors, i.e. bindings for the internal
create_with_global_object() method.

Also tweak the naming of various CMake glue code existing around this.
2022-09-21 23:06:08 +01:00
Linus Groh
4270ede7c4 LibWeb: Remove WRAPPER_HACK() macro
We no longer access Bindings::FooWrapper anywhere for a Foo platform
object, so these can be removed :^)
2022-09-21 21:12:24 +01:00