When we compute style for elements inside a UA-internal shadow tree that
represent a pseudo-element (e.g ::placeholder), we actually run the
StyleComputer machinery for (host element :: pseudo-element).
While that lets us match the correct selectors, it was incorrectly
applying CSS inheritance, since we'd also then inherit from whatever was
above the host element in the tree.
This patch fixes the issue by introducing an inheritance override in
AbstractElement and then using that to force inheritance from whatever
is actually directly above in the DOM for these elements instead of
jumping all the way up past the host.
This fixes an issue where `text-align: center` on input type=text
elements would render the main text centered but placeholder text was
still left-aligned.
Unbreaks Windows build. resolve_integer returns an i64 making creation
of a StepsEasingFunction with its result a narrowing conversion before
this change as a long is 32 bits on Windows.
Steps 4 and 5 were swapped since marking all the nodes between the start
and end of the selection now also marks the end node as full, even if it
should be marked as End.
There could be extra logic to avoid marking it if it is a text node, but
this seems easier.
As a whole, this fixes partially selected non-text nodes. In such cases,
where the selection starts or ends inside a node with descendants, it is
impossible to just select from the start node to the end node since that
would select all descendants of the start node and none of the end node.
Previously, this was only half considered and only if the start node was
a descendant of the end node.
After we bind the surface to the context for the first time when
allocating the backing image, it internally has a permanent reference
count above 0.
If we switch to a different context and back, the switch back will fail
because the surface has a reference count, which makes ANGLE think
we're trying to use it on a different thread.
However, we can avoid this by using surfaceless contexts, since we
don't use the default framebuffer.
Fixes multiple WebGL contexts on the page freezing.
- Return `PeerEOF` enum instead of `Error` containing string from
`drain_messages_from_peer()`. There are no other error types to return
from this function, so boolean-like enum is sufficient.
- Don't override read hook in `ConnectionFromClient` constructor. It was
previously redefined only to suppress EOF error returned by
`drain_messages_from_peer()`.
To consistently update the backing stores in reallocate_backing_stores()
the variables storing the backing stores need to be set to nullptr at
the start so that they are properly update later on near the end of the
function.
There are some non-math functions (such as tree counting functions)
which we should allow within `calc()`s . This commit implements the
initial infrastructure for this.
We don't yet parse any of these non-math functions in
`parse_a_calculation` so there is no functional change.
Adds support for `sibling-index()` and `sibling-count()` when parsing
`<number>` and `<integer>`. This is achieved by a new
`TreeCountingFunctionStyleValue` class which is converted within
`absolutized` to `NumberStyleValue` and `IntegerStyleValue` respectively
There are still a few kinks to work out in order to support these
everywhere, namely:
- There are some `StyleValue`s which aren't absolutized (i.e. those
which are stored within another `StyleValue` without an
`absolutize()` method.
- We don't have a way to represent this new `StyleValue` within
`{Number,Integer}OrCalculated`. This would be fixed if we were to
instead just use the `StyleValue` classes until style computation at
which time they would be absolutized into their respective
primitives (double, i64, etc) bypassing the need for *OrCalculated
entirely.
Tree counting functions should be resolved at style computation time -
to do this we will need to know the element's sibling count and index.
This commit computes that information and propagates it to the various
`StyleValue::to_computed_value` methods.
Some contexts (e.g. descriptors, media conditions) don't allow tree
counting functions, this commit adds an easy way to check if the current
value context is one of those.
This deduplicates a lot of sensitive pointer math by using Span, which
performs this math for us with more safety checks and with type
information.
This also allows us to use the correctly typed Span for typed arrays,
which automatically fixes srcOffset to now offset by the number of
elements instead of bytes. This goes for srcLengthOverride too.
Fixes the Rive animations on Shopify's homepage not appearing.
Fixes some Unity applications such as ArcViewer having missing
graphics.
This allows you to reinterpret a Span to any given type, maintaining
the original data and working out the new size for you.
The target type must evenly fit into the Span's original type, ensuring
bytes are not dropped.
Peek is used to determine if the current chunk is
the last and if so, add trailing box metrics.
For this to work correctly, it must be done only
after calling next(), otherwise peek gives us the
current chunk.