summaryrefslogtreecommitdiff
path: root/Userland/Libraries
AgeCommit message (Collapse)Author
2023-05-24LibVideo: Rename BooleanDecoder::initialize paramNico Weber
...from "bytes" to "size_in_bytes". I thought at first that `bytes` meant the variable contained bytes that the decoder would read from. Also, this variable is called `sz` (for `size`) in the spec. No behavior change.
2023-05-24LibVideo: Remove unused BooleanDecoder::bits_remaining()Nico Weber
2023-05-24LibWeb: Honor the font-size even if the font-family is not foundAndreas Kling
2023-05-24LibWeb: Avoid full tree traversal in Node::compare_document_position()Aliaksandr Kalenik
Introduce optimization that determines if one node is preceding, following, ancestor or descdendant of another node by comparing ancestors chains of both nodes which is much cheaper than using Node::is_before() that can walk whole subtree in the worst case.
2023-05-24LibGfx: Prevent out of bounds access when scaling small BitmapsDarius Arnold
Since the color interpolation requires two pixels in the horizontal and vertical direction to work, 1 pixel wide or high bitmaps would cause a crash when scaling. Fix this by clamping the index into the valid range. Fixes #16047.
2023-05-24LibWeb: Resolve CSS variables if present in SVG presentation attributesAndreas Kling
SVG presentation attributes are parsed as CSS values, so we also need to handle CSS variable expansion when handling them. This (roughly) matches the behavior of other engines. It's also used on the web, for example on https://stripe.com/ :^)
2023-05-24LibWeb: Add fast way to check if a DOM node is an SVG elementAndreas Kling
2023-05-23LibWeb: Reject invalid tokens in `calc()` expressionsSam Atkins
If we finish parsing a calculation tree and it still contains UnparsedCalculationNodes, then it's not valid, and we shouldn't create a StyleValue from it.
2023-05-23LibWeb: Make LiveNodeList faster when it only cares about childrenAndreas Kling
Same optimization as HTMLCollection, ported to LiveNodeList.
2023-05-23LibWeb: Don't draw text fragments that would be clipped by the painterAndreas Kling
This avoids a ton of work when painting large documents. Even though it would eventually get clipped by the painter anyway, by bailing out earlier, we avoid a lot more work (UTF-8 iteration, OpenType lookups, etc). It would be even nicer if we could skip entire line boxes, but we don't have a fast way to get the bounding rect of a line box at the moment.
2023-05-23LibWeb: Make HTMLCollection faster when it only cares about childrenAndreas Kling
Some of the live HTMLCollection only ever contain children of their root node. When we know that's the case, we can avoid doing a full subtree traversal of all descendants and only visit children. This cuts the ECMA262 spec loading time by over 10 seconds. :^)
2023-05-23LibVideo/PlaybackManager: Use a function to start the internal timerZaggy1024
In addition, this renames the internal timer to better suit its new purpose since the playback state handlers were added. Not only is it used to time frame presentations, but also to poll the queue when seeking or buffering.
2023-05-23LibVideo/PlaybackManager: Decode frames off the main threadZaggy1024
Running decoding on the main thread can cause frames to be delayed due to the presentation timer waiting for a decode to finish. If a frame takes too long to decode, this delay can be quite visible. Therefore, decoding has been moved to a separate thread, with frames sent to the main thread through a thread-safe queue. This results in frame times going from being late by up to 16ms to a very consistent ~1-2ms.
2023-05-23LibVideo: Fallibly construct playback manager fieldsZaggy1024
2023-05-23LibWeb: Simplify margin & border box construction in `LayoutState`Jelle Raaijmakers
2023-05-23LibGfx: Get rid of `Gfx::Rect<float>` area workaround in `Painter`Jelle Raaijmakers
We can now trust `Gfx::Rect<T>` to correctly calculate rectangle intersections when `T = float`.
2023-05-23LibGfx+Everywhere: Change `Gfx::Rect` to be endpoint exclusiveJelle Raaijmakers
Previously, calling `.right()` on a `Gfx::Rect` would return the last column's coordinate still inside the rectangle, or `left + width - 1`. This is called 'endpoint inclusive' and does not make a lot of sense for `Gfx::Rect<float>` where a rectangle of width 5 at position (0, 0) would return 4 as its right side. This same problem exists for `.bottom()`. This changes `Gfx::Rect` to be endpoint exclusive, which gives us the nice property that `width = right - left` and `height = bottom - top`. It enables us to treat `Gfx::Rect<int>` and `Gfx::Rect<float>` exactly the same. All users of `Gfx::Rect` have been updated accordingly.
2023-05-23LibWeb: Make LayoutState use HashMap instead of potentially huge VectorAndreas Kling
Before this change, LayoutState essentially had a Vector<UsedValues*> resized to the exact number of layout nodes in the current document. When a nested layout is performed (to calculate the intrinsic size of something), we make a new LayoutState with its own Vector. If an entry is missing in a nested LayoutState, we check the parent chain all the way up to the root. Because each nested LayoutState had to allocate a new Vector with space for all layout nodes, this could get really nasty on very large pages (such as the ECMA262 specification). This patch replaces the Vector with a HashMap. There's now a small cost to lookups, but what we get in return is the ability to handle huge layout trees without spending eternity in page faults.
2023-05-23LibWeb: Use the right DOM node when placing cursor on double-clickAndreas Kling
This fixes a null pointer dereference when double-clicking in text content on some pages.
2023-05-23LibWeb: Don't create mutation record node lists if nobody is interestedAndreas Kling
By deferring allocation of StaticNodeList objects until we know somebody actually wants the MutationRecord, we avoid a *lot* of allocation work. This shaves several seconds off of loading https://tc39.es/ecma262/ At least one other engine (WebKit) skips creating mutation records if nobody is interested, so even if this is observable somehow, we would at least match the behavior of a major engine.
2023-05-23test-fuzz: Add all the missing fuzzersTim Schumacher
2023-05-23LibWeb: Avoid rebuilding layout tree unless CSS display property changesAndreas Kling
Before this, any style change that mutated a property we consider "layout-affecting" would trigger a complete teardown and rebuild of the layout tree. This isn't actually necessary for the vast majority of CSS properties, so this patch makes the invalidation a bit finer, and we now only rebuild the layout tree when the CSS display property changes. For other layout-affecting properties, we keep the old layout tree (if we have one) and run the layout algorithms over that once again. This is significantly faster, since we don't have to run all the CSS selectors all over again.
2023-05-23LibGfx: Fix parsing of rgba valuesAndi Gallo
Trim whitespace of the alpha component before calling parse_first_floating_point, which doesn't handle it.
2023-05-23LibWeb: Preserve case for key eventsAndi Gallo
Case-preserving behavior matches observed behavior of other browsers and the specification.
2023-05-23Base+Userland: Apply Human Interface Guidelines to Object textthankyouverycool
Corrects a slew of titles, buttons, labels, menu items and status bars for capitalization, ellipses and punctuation. Rewords a few actions and dialogs to use uniform language and punctuation.
2023-05-23LibGUI: Adjust size and layout of InputBoxthankyouverycool
Increases default dimensions of InputBox, giving it slightly more divine proportions. Prompt text now always appears above the editor.
2023-05-23LibC: Fix incorrect string length calculation in getsignalbyname()Tim Ledbetter
This makes `kill` and `killall` work correctly with signal names.
2023-05-22WebP: Let ALPH replace alpha channel instead of augmenting itNico Weber
Pixels will leave the lossy decoder with alpha set to 255. The old code would be a no-op in that case. No observable behavior change yet, since there still is no decoder for lossy webp.
2023-05-22LibWeb: Wait for media candidates without endlessly queueing microtasksTimothy Flynn
Rather than queueing microtasks ad nauseam to check if a media element has a new source candidate, let the media element tell us when it might have a new child to inspect. This removes endless CPU churn in cases where there is never a candidate that we can play.
2023-05-22LibWeb: Make sure collapsed margins are not ignored if box creates FCAliaksandr Kalenik
Fixes a bug that if box creates new formatting context then all already collapsed margins are ignored and only margin_top is used.
2023-05-22LibWeb: Propagate children_are_inline in wrap_in_anonymousAndi Gallo
This fixes a crash in box_baseline, due to cells created for display: table expecting a box child and getting the inline node wrapper instead. Fixes #18972.
2023-05-22LibGfx: Add search path to debug output in `FontDatabase`Jelle Raaijmakers
This helps with debugging why fonts cannot be found.
2023-05-22LibWeb: Set grid-auto-columns/rows in NodeWithStyle::apply_style()Aliaksandr Kalenik
2023-05-22LibWeb: Stub AudioContext constructorLuke Wilde
This is enough to make Discord not throw up "Well this is awkward" on login.
2023-05-22LibJS: Add "Month dd, yy hh:mm:ss" Date formatLuke Wilde
Required by Discord's Birthday page.
2023-05-22LibWeb: Fire the contextmenu event on right click (if not holding shift)Luke Wilde
This now allows websites such as Discord, YouTube and your favourite "Right Click" xkcd comic to open a custom context menu when you right click. You can bypass this by holding shift, just like Firefox.
2023-05-22LibWeb: Tidy up apply_clip_overflow_rect() a littleMacDue
Avoid possible null optional dereference when creating border radius clipper, and avoid creating clipper if the clip rect is empty (which prevents some debug spam). Also remove an unnecessary lambda.
2023-05-22LibWeb: Support grid-auto-columns and grid-auto-rows properties in GFCAliaksandr Kalenik
Implements assignment of sizes specified in grid-auto-columns/rows for implicitly created tracks.
2023-05-22LibWeb/CSS: Implement parsing of grid-auto-columns and grid-auto-rowsAliaksandr Kalenik
2023-05-22LibWeb: Check if line name is present in GridTrackSizeList::to_string()Aliaksandr Kalenik
Fixes crash in GridTrackSizeList::to_string() when line names are missing.
2023-05-22Revert "LibGfx: Add NearestFractional scaling type to painter"Sam Atkins
This reverts commit df304401178dc4e82edccdbe6e7a7a7d12eecfe9. This scaling type is now unused, and has issues with painting outside of the Painter's clip-rect.
2023-05-21LibWeb: Don't assume response object isn't null in fetch abort algorithmAndreas Kling
The callee that we're passing it to expects a GCPtr anyway, so there's no need to explicitly dereference this. Fixes a crash when loading https://spotify.com/
2023-05-21LibWeb: Represent OccupationGrid using HashTable in GFCAliaksandr Kalenik
Using HashTable of grid positions to represent OccupationGrid allows to simplify positioning code. For example maybe_add_row() and maybe_add_column() calls are not needed anymore because there is no Vector<Vector<bool>> that need to be resized. No observable changes in grid layout are expected :)
2023-05-21LibWeb: Move SVGElement's dataset construction to initialize()Andreas Kling
It's not safe to allocate new cells while in a cell constructor.
2023-05-21LibWeb: Fix unsafe capture of stack variables in main_fetch()Andreas Kling
2023-05-21LibJS: Don't dereference well-known symbols when gathering rootsAndreas Kling
This fixes an issue where very early GC would crash trying to dereference not-yet-initialized entries in the well-known symbol set.
2023-05-21LibWeb+LibJS: Don't lazily construct web prototypes in cell constructorsAndreas Kling
It's not safe to allocate from the GC heap while in the constructor of a GC heap cell. (Because if this ends up triggering a collection, we may end up trying to call through an uninitialized vtable). This was already done safely in the initialize() virtual in much of LibJS and LibWeb. This patch moves the logic for prototypes, mixins, and CSSStyleDeclaration as well. Fixes a long-standing GC crash that was pretty easy to reproduce by refreshing https://vercel.com/
2023-05-21LibWeb: Implement table rowspanAndi Gallo
Adjust computing the table height and positioning of cells to account for the rowspan property. Fixes #18952.
2023-05-21LibWeb: Don't crash on percentage values for CSS stroke-widthAndreas Kling
Fixes a crash when loading https://vercel.com/
2023-05-21LibWeb: Use code to size spanning tracks for non-spanning tracks in GFCAliaksandr Kalenik
Since the specifications indicate that the algorithm for sizing tracks without any spanning items is a simplified version of the more general algorithm used for sizing tracks with spanning items, we can reuse the code to size both cases.