There are a number of script-provided stream callbacks for various
stream operations, such as `start`, `pull`, `cancel`, etc. Out of all of
these, only the `start` callback can actually throw. And when it does,
the exception is realized immediately in the corresponding stream
constructor.
All other callbacks have spec text of the form:
Throwing an exception is treated the same as returning a rejected
promise.
And indeed this is internally handled by the streams spec. Thus all of
those callbacks can be specified as returning only a promise, rather
than a WebIDL::ExceptionOr<Promise>.
Previously, we would apply any adopted style sheet to the document if
its alternate flag was not set. This meant that all adopted style
sheets would be applied, since constructed style sheets never have this
flag set.
Changes compute_absolute_padding_rect_with_css_transform_applied() to
use cached absolute rect and CSS transform instead of doing expensive
containing block chain traversal.
Reduces refresh_clip_state() from 4% to 2% in Discord profiles.
This was resulting in a whole lot of rebuilding whenever a new IDL
interface was added.
Instead, just directly include the prototype in every C++ file which
needs it. While we only really need a forward declaration in each cpp
file; including the full prototype header (which itself only includes
LibJS/Object.h, which is already transitively brought in by
PlatformObject) - it seems like a small price to pay compared to what
feels like a full rebuild of LibWeb whenever a new IDL file is added.
Given all of these includes are only needed for the ::initialize
method, there is probably a smart way of avoiding this problem
altogether. I've considered both using some macro trickery or generating
these functions somehow instead.
Before this change we were recording and executing sample/blit commands
for each painting phase, even if there are no painting commands
in-between sample and blit that produce result visible on a canvas.
This change adds an optimization pass that goes through recorded
painting commands list and marks sample and blit commands that could
be skipped.
Reduces sample and blit corners executing from 17% to 8% on Discord.
Introduces separate layout and paintable type for foreign element.
It is necessary to inherit SVGForeignObjectPaintable from SVGMaskable
in upcoming changes.
Preparation work before adding support for SVGForeignObjectElement
masking.
Having a mixin makes possible sharing mask calculation between
SVGForeignObjectElement's paintable and SVGGraphicsPaintable.
Both has to support masking:
- PaintableWithLines (from SVGForeignObjectElement) -> PaintableBox
- SVGGraphicsPaintable -> SVGPaintable -> PaintableBox
After this change it will be possible to introduce a new paintable type
for foreignObject that inherits from both PaintableWithLines and
SVGMaskable.
Fetched bodies can be on the order of gigabytes, so rather than crashing
when we hit OOM here, we can simply invoke the error callback with a DOM
exception. We use "UnknownError" here as the spec directly supports this
for OOM errors:
UnknownError: The operation failed for an unknown transient reason
(e.g. out of memory).
This is still an ad-hoc implementation. We should be using streams, and
we do have the AOs available to do so. But they need to be massaged to
be compatible with callers of Body::fully_read. And once we do use
streams, this function will become infallible - so making it infallible
here is at least a step in the right direction.
Previously, [Global] interfaces were not excluded from the
`internal_own_property_keys()` call. This caused a crash when iterating
over the properties of the Window object.
Fixes bug when CSS transform is applied twice to clip rect:
- While calculating absolute clip rectangles in `refresh_clip_state()`
- While executing `PushStackingContext` painting command.
Duplicated transform is already removed for PaintableBox and this change
adds this for InlinePaintable.
This change moves WebAssembly related data that was previously globally
accessible into the `WebAssemblyCache` object and creates one of these
per global object. This ensures that WebAssembly data cannot be
accessed across realms.
Previously we would look for a matching ID, and then for a matching
name. If there was an element in the collection which had a matching ID
as well as an element with a matching name, we would always return the
element with a matching ID irrespective of what order that element was
in.
Link elements that aren't "browsing-context connected" should not
trigger a resource fetch when their attributes change.
This fixes an issue where we'd waste time by loading every style sheet
twice! :^)