Age | Commit message (Collapse) | Author |
|
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.
|
|
This fixes a null pointer dereference when double-clicking in text
content on some pages.
|
|
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.
|
|
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.
|
|
Case-preserving behavior matches observed behavior of other browsers and
the specification.
|
|
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.
|
|
Fixes a bug that if box creates new formatting context then all already
collapsed margins are ignored and only margin_top is used.
|
|
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.
|
|
|
|
This is enough to make Discord not throw up "Well this is awkward" on
login.
|
|
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.
|
|
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.
|
|
Implements assignment of sizes specified in grid-auto-columns/rows for
implicitly created tracks.
|
|
|
|
Fixes crash in GridTrackSizeList::to_string() when line names are
missing.
|
|
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/
|
|
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 :)
|
|
It's not safe to allocate new cells while in a cell constructor.
|
|
|
|
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/
|
|
Adjust computing the table height and positioning of cells to account
for the rowspan property.
Fixes #18952.
|
|
Fixes a crash when loading https://vercel.com/
|
|
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.
|
|
Implements more parts of sizing algorithm for tracks with spanning
items to archive parity with implementation for sizing of tracks
with non-spanning items.
|
|
|
|
This allows us to see the inside of SVG-as-image in layout tests. :^)
|
|
We have to special-case these, otherwise our normal CSS layout algorithm
will see that some SVG roots have width/height assigned, and make those
the used width/height.
When used in an SVG-as-image context, the outermost viewport must be the
authoritative root size.
|
|
This finally makes SVG-as-image show up visually! :^)
We should find a way to share this logic with Layout::SVGSVGBox, but
that will require some finesse since they have to work at different
points in the layout/paint timeline.
|
|
In order to separate the SVG content from the rest of the engine, it
gets its very own Page, PageClient, top-level browsing context, etc.
Unfortunately, we do have to get the palette and CSS/device pixel ratios
from the host Page for now, maybe that's something we could refactor in
the future.
Note that this doesn't work visually yet, since we don't calculate the
intrinsic sizes & ratio for SVG images. That comes next. :^)
|
|
This allows the painting subsystem to request a bitmap with the exact
size needed for painting, instead of being limited to "just give me a
bitmap" (which was perfectly enough for raster images, but not for
vector graphics).
|
|
This class will implement isolated SVG layout and rendering.
|
|
This paves the way for ImageProvider to have something vector-based
underneath. :^)
|
|
The existing implementation moves down into a new subclass called
AnimatedBitmapDecodedImageData.
The purpose of this change is to create an extension point where we can
plug in an SVG renderer. :^)
|
|
This implements the stop-opacity, fill-opacity, and stroke-opacity
properties (in CSS). This replaces the existing more ad-hoc
fill-opacity attribute handling.
|
|
There are a couple of things that went into this:
- We now calculate the intrinsic width/height and aspect ratio of <svg>
elements based on the spec algorithm instead of our previous ad-hoc
guesswork solution.
- Replaced elements with automatic size and intrinsic aspect ratio but
no intrinsic dimensions are now sized with the stretch-fit width
formula.
- We take care to assign both used width and used height to <svg>
elements before running their SVG formatting contexts. This ensures
that the inside SVG content is laid out with knowledge of its
viewport geometry.
- We avoid infinite recursion in tentative_height_for_replaced_element()
by using the already-calculated used width instead of calling the
function that calculates the used width (since that may call us right
back again).
|
|
|
|
As a heuristic, either the width or height of the scaled image should
decrease for box sampling to be used. Otherwise, we use bilinear
scaling.
|
|
Fixes a crash seen on YouTube channel pages.
|
|
In order to fix this, I also had to reorganize the code so that we
create an independent formatting context even for block-level boxes
that don't have any children. This accidentally improves a table
layout test as well (for empty tables).
|
|
This reverts commit b79fd3d1a90f959d71e8d1b56ad9f8c088681e78.
|
|
If linking fails, we throw a JS exception, and if there's no execution
context on the VM stack at that time, we assert in VM::current_realm().
This is a hack to prevent crashing on failed module loads. Long term we
need to rewrite module loading since it has been refactored to share
code differently between HTML and ECMA262.
|
|
This allows JS module loads to fail and throw without crashing the
WebContent process due to a TODO() assertion.
|
|
As a heuristic, either the width or height of the scaled image should
decrease for box sampling to be used. Otherwise, we use bilinear
scaling.
|
|
Adds support for grid items with fixed size paddings. Supporting
percentage paddings will probably require to do second pass of tracks
layout: second pass is needed to recalculate tracks sizes when final
items sizes are known when percentage paddings are already resolved.
|
|
|
|
For flex items with a calc() value for a main size, we can just convert
them to a calculation-backed LengthPercentage.
|
|
This change addresses the incorrect assumption that the available width
inside a grid item is equal to the width of the track it belongs to.
For instance, if a grid item has a width of 200px, the available width
inside that item is also 200px regardless of its column(s) base size.
To solve this issue, it was necessary to move the final resolution of
grid items to occur immediately after the final column track sizes are
determined. By doing so, it becomes possible to obtain correct
available width inside grid items while resolving the row track sizes.
|
|
A list of every property that has this quirk is available here:
https://quirks.spec.whatwg.org/#the-unitless-length-quirk
|
|
This fixes a GC crash that happened after a while on the Steam store.
|
|
DOM elements don't always have a corresponding layout node. This fixes a
crash soon after loading the Steam store.
|