Previously we were kinda sorta resolving the reference cycle, but let's
just keep the requests in a hashtable instead of relying on hard to
track refcount tricks.
Fixes#7314.
A weakly held XHR object is not guaranteed to remain alive after
running arbitrary JavaScript, so let's make sure we take a strong
reference in the ResourceLoader callbacks here.
The HTML spec tells has some special rules for <body> and <frameset>
elements' onfoo event handler attributes. In some cases, the implicitly
generated event listeners should end up on the relevant global object
instead of the element itself.
This patch implements the first part of that behavior.
This logic was kept in the GlobalEventHandlers mixing for sharing
between Document and HTMLElement, but there are other interfaces who
need to support `onfoo` attribute event listeners as well.
We were computing the padded rect of the box during every paint phase,
despite only needing it in the Overlay phase.
Since this is an expensive call, let's take care not to make it
unnecessarily.
This is a hack, but it seems to do quite okay.
What we should do is to find the largest size the Box could want in its
main axis. To do that we have to layout the Box according to the needed
LayoutMode. For flex-rows we do as requested and try to make the Box as
wide as we want.
However, for flex-columns we simply assume the Box is a Block and we
calculate their height according to this.
Instead of trying to layout SVG boxes as if they are regular CSS boxes,
let's invent an "SVG formatting context" and let it manage SVG boxes.
To facilitate this, Layout::SVGBox no longer inherits from ReplacedBox,
and is instead a simple, "inline-block" style BlockBox.
If our parent in the FlexFormattingContext also was a flex-container, we
didn't give our children any meaningful width to play with into
layout_inside(), which resulted in way too narrow layouting.
Now the width of the parent gets borrowed if the own width isn't
specified.
The previous VERIFY_NOT_REACHED() could be reached when there were equal
coodinates. This could be the case for a small radius which lead to
rounding making the two coordinates equal.
This now uses the values in `InitialValues`, which is not ideal, but
it's better to have our defaults defined in two places, than in 3.
The default for `border-colors` is `currentcolor`, so we shortcut that
here and just grab the value of the `color` property. As noted, this is
not perfect, but it's somewhat better.
- The `text-decoration-foo` values now match the spec.
- Added values for `border-foo` since those are needed soon.
- Make `color`'s initial value be `-libweb-palette-base-text`.
This was specifically causing the string "0" to be parsed as an invalid
Dimension token with no units, instead of as a Number. That then caused
out generated `property_initial_value()` function to fail for those
values.
Shorthand properties were only checking for `ColorStyleValue`s, which
excludes identifier colors. Now they accept them too, including the
various `-libweb-foo` colors. :^)
The `currentcolor` identifier represents the current value of the
`color` property. This is the default value for `border-color` and
`text-decoration-color`, and is generally useful to have. :^)
This prevents flickering by ensuring that WebContent is only ever
painting into the back buffer bitmap. Without this change, it was
possible for WebContent to paint into the front buffer bitmap.
In the spec, `fill` and `stroke` are supposed to be a shorthands for
various properties. But since the spec is still a working draft, and
neither Firefox or Chrome support the `fill-color` or `stroke-color`
properties, we'll stick with `fill` and `stroke` as simple colors for
now.
Also, note that SVG expects things in "user units", and we are assuming
that 1px = 1 user unit for now.