Previously, `SVGSVGBox` would have a natural aspect ratio of 0 if it
had a viewbox with zero width. This led to a division by zero, causing
a crash.
Found by Domato.
(cherry picked from commit 4cdafea36334bcff8c4bbb083076ae55b599177c)
Previously calling `PaintableBox::set_scroll_offset()` with a
PaintableBox whose content size was larger than its scrollble overflow
rect would cause a crash.
Found by Domato.
(cherry picked from commit 604f6040a180ac409cf338045c8709a171d920d5)
This method accepts a namespace URI as an argument and returns true if
the given URI is the default namespace on the given node, false
otherwise.
(cherry picked from commit 055c902a375bb34b8c0e31f015c2815fe935c6a9)
This method takes a prefix and returns the namespace URI associated
with it on the given node, or null if no namespace is found.
(cherry picked from commit 27d429a85f359b9c87bf9807e4dea33f7092308a)
- Change min track sizing function to be "auto" when flex size is
specified.
- Never check if min track sizing funciton is flexible, because only
max is allowed to be flexible.
- Address FIXME in automatic_minimum_size to avoid regressions after
making two fixes mentioned above.
(cherry picked from commit 3270df476dd46b140e1b9de1e8328647744b56ab)
Areas are disassembled into boundary lines on `build_grid_areas()` step,
so we can always use them to find grid item's position during placement.
This way we support both ways to define area: `grid-template-areas` and
implicitly using `-start` and `-end` boundary line names.
(cherry picked from commit 7a1f3f7ae3af2744e2f99df29baf09153d631b24)
We're expected to handle this situation gracefully, and certainly not
by falling apart like we were.
Found by Domato.
(cherry picked from commit 33207174a9c1c87657e2ae0875cc85cbf41075f8)
If the anchor and focus nodes are not within the same document, we can't
use them for a selection range.
Found by Domato.
(cherry picked from commit 416c4788763baa778465d1d004080d322462c0bf)
Instead of allowing arbitrarily large values (which could eventually
overflow an i32), let's just cap them at the same limit as Firefox does.
Found by Domato.
(cherry picked from commit 4e0edd42b95abf8ad707c64414dbe618313ce89e)
We were incorrectly assuming that setAttribute() could never fail here,
even when passed an invalid name.
Found by Domato.
(cherry picked from commit 093f1dd805f699801079f55d0d490d80b463ccbb)
We had a const and non-const version of this function, with slightly
different behavior (oops!)
This patch consolidates the implementations and keeps only the correct
behavior in there.
Fixes an issue where comments were not collapsible on Hacker News.
(cherry picked from commit 98f88d49de852e1e524655accb39724f1134a23f)
When traversing the layout tree to find an appropriate box child to
derive the baseline from. Only the child's margin and offset was being
applied. Now we sum each offset on the recursive call.
(cherry picked from commit 3c897e7cf3594f02f559599e1bf28747c9edba13)
When the min option is given the read will only be fulfilled when there
are min or more elements available in the readable byte stream.
When the min option is not given the default value for min is 1.
(cherry picked from commit 907dc84c1e8c3c236ade581f46dabdb144915c1d)
This property is now correctly parsed.
Ladybird always uses overlay scrollbars so this property does nothing.
(cherry picked from commit 662317726549cd2dde4c7902b99f0b83397a3396)
Following the rules in the algorithm from
https://webidl.spec.whatwg.org/#js-platform-objects, "To Internally
create a new object implementing the interface interface", this change
incorporates the steps to load a prototype from new.target, and write
it to the created instance returned from constructor_impl(). This
mirrors the code for generate_html_constructor(), which incorporates
additional steps needed by Custom Elements.
Bug LadybirdBrowser/ladybird#334
(cherry picked from commit 80cd3712c2c52bf749a19cbd21af0c5c479a87c9)
Previously the input element was displayed with value 0, when no value
was set in the HTML. Now it uses `value_sanitization_algorithm()`, which
will calculate the default value.
In `value_sanitization_algorithm()` there was a logical mistake/typo.
The comment from the spec says "unless the maximum is less than the
minimum".
The added layout test would fail without the code changes.
Fixes#520
(cherry picked from commit 191531b7b18d2edf97dc7bf88a9c19903eeae2d5)
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.
(cherry picked from commit 34b987366449313c96a73ec1d70e88e60f2c4510)
Previously, setting CSS `line-height: 0` on an `input` element would
result in no text being displayed.
Other browsers handle this by setting the minimum height to the
"normal" value for single line inputs.
(cherry picked from commit 629068c2a7eb02db37ffb4fe8d536306ee71e156)
This method puts the given node and all of its sub-tree into a
normalized form. A normalized sub-tree has no empty text nodes and no
adjacent text nodes.
(cherry picked from commit 0a0651f34ea927a0ca44dc5d2c7786f3dcf8da25)
Solving using the unconstrained height, when solving for bottom, would
either leave a gap over overflow its container.
(cherry picked from commit bee42160c5e2cdb949e6057f029391ee7e0fa9fa)
The first time Document learns its viewport size, we now suppress firing
of the resize event.
This fixes an issue on multiple websites that were not expecting resize
events to fire so early in the loading process.
(cherry picked from commit 4e7558c88b7a993686bb3dc173731e677efe5e26)
From https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:
When a script element el that is not parser-inserted experiences one
of the events listed in the following list, the user agent must
immediately prepare the script element el:
- [...]
- The script element is connected and has a src attribute set where
previously the element had no such attribute.
(cherry picked from commit d890be6e0f7db08ab39ba546cb3421b50b687cda)
Like 1132c858e9, out-of-flow elements such
as float elements would get inserted into block level `::before` and
`::after` pseudo-element nodes when they should instead be inserted as a
sibling to the pseudo element. This change fixes that.
This fixes a few layout issues on the swedish tax agency website
(skatteverket.se). :^)
(cherry picked from commit 9ed2669fc801a3475c9f383ae7221b6a2b1a7fa5)
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.
Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.
After:
- Page's scrollbar is painted on WebContent side using the same style as
currently used for elements with `overflow: scroll` and
`overflow: auto`. A nice side effects: scrollbars are now painted for
iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
(cherry picked from commit 5285e22f2aa09152365179865f135e7bc5d254a5)
Co-authored-by: Jamie Mansfield <jmansfield@cadixdev.org>
Co-authored-by: Nico Weber <thakis@chromium.org>