Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick 29.75 Ladybird PRs #25345

Merged
merged 43 commits into from
Nov 10, 2024
Merged

Cherry-pick 29.75 Ladybird PRs #25345

merged 43 commits into from
Nov 10, 2024

Commits on Nov 9, 2024

  1. LibWeb: Keep custom properties from all cascade layers

    Before this change, we were cascading custom properties for each layer,
    and then replacing any previously cascaded properties for the element
    with only the set from this latest layer.
    
    The patch fixes the issue by making each pass of the custom property
    cascade add to the same set, and then finally assigning that set of
    properties to the element.
    
    (cherry picked from commit 95bd0602ba079e0bd7608e39bcbc3b0403ed89d1)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    ddabc44 View commit details
    Browse the repository at this point in the history
  2. LibWebView: Do floating-point-error-free zoom calculation using rounding

    The current min/max zoom levels are supposed to be: 30% and 500%.
    Before, due to floating point error accumulation in incremental addition
    of zoom-step into zoom-level, one extra zoom step would get allowed,
    enabling user to zoom 20%-to-510%.
    
    Now, using rounding, the intermediate zoom-level values should be as
    close to the theoretical value as FP32 can represent. E.g. zoom-level of
    70% (theoretical multiplier 0.7) is 0.69... .
    
    (cherry picked from commit 96335f31d5a8c6180a4cc0254585bc01ba6742fa)
    ronak69 authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    d66778f View commit details
    Browse the repository at this point in the history
  3. LibWeb: Implement Range's extension method

    This patch implements `Range::getClientRects` and
    `Range::getBoundingClientRect`. Since the rects returned by invoking
    getClientRects can be accessed without adding them to the Selection,
    `ViewportPaintable::recompute_selection_states` has been updated to
    accept a Range as a parameter, rather than acquiring it through the
    Document's Selection.
    
    With this change, the following tests now pass:
    
    - wpt[css/cssom-view/range-bounding-client-rect-with-nested-text.html]
    - wpt[css/cssom-view/DOMRectList.html]
    
    Note: The test
    "css/cssom-view/range-bounding-client-rect-with-display-contents.html"
    still fails due to an issue with Element::getClientRects, which will
    be addressed in a future commit.
    
    (cherry picked from commit 75c7dbc5d2dd045733a4c319aeab6644b5b7b36d)
    An-n-ya authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    d9f0de7 View commit details
    Browse the repository at this point in the history
  4. LibWeb: Add StyleElementUtils::visit_edges()

    Let's do this instead of making embedders visit every field of this
    helper class.
    
    (cherry picked from commit 2064be708f7318f72553fb210f918fe167e08257)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    4c386e0 View commit details
    Browse the repository at this point in the history
  5. LibWeb: Let style elements remember which StyleSheetList they live in

    Instead of trying to locate the relevant StyleSheetList on style element
    removal from the DOM, we now simply keep a pointer to the list instead.
    
    This fixes an issue where using attachShadow() on an element that had
    a declarative shadow DOM would cause any style elements present to use
    the wrong StyleSheetList when removing themselves from the tree.
    
    (cherry picked from commit 8543b8ad6a4d96bd0c247052572b8c2abf3929a7)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    01a9d5a View commit details
    Browse the repository at this point in the history
  6. LibWeb: Return a WindowProxy from document.defaultView

    This aligns our implementation with the most recent specification steps.
    
    (cherry picked from commit 089139f09dbc78455c5c09916cbc97e33f823ca0)
    tcl3 authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    a2315d8 View commit details
    Browse the repository at this point in the history
  7. LibWeb: Always flush character insertions before exiting HTML parser

    This fixes an issue where document.write() with only text input would
    leave all the character data as unflushed text in the parser.
    
    This fixes many of the WPT tests for document.write().
    
    (cherry picked from commit a0ed12e839f14b3ac80caca0e18a09ca256fd99d)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    77f0c4e View commit details
    Browse the repository at this point in the history
  8. LibWeb: Allow setting shorthand CSS properties via CSSStyleDeclaration

    We now expand shorthands into their respective longhand values when
    assigning to a shorthand named property on a CSSStyleDeclaration.
    
    We also make sure that shorthands can be round-tripped by correctly
    routing named property access through the getPropertyValue() AO,
    and expanding it to handle shorthands as well.
    
    A lot of WPT tests for CSS parsing rely on these mechanisms and should
    now start working. :^)
    
    Note that multi-level recursive shorthands like `border` don't work
    100% correctly yet. We're going to need a bunch more logic to properly
    serialize e.g `border-width` or `border` itself.
    
    (cherry picked from commit e40ad73ae79023f64e250f854d0730c21e0f54fc)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    063123b View commit details
    Browse the repository at this point in the history
  9. LibWeb: Include siblings+descendants when invalidating style

    When an element is invalidated, it's possible for any subsequent sibling
    or any of their descendants to also need invalidation. (Due to the CSS
    sibling combinators, `+` and `~`)
    
    For DOM node insertion/removal, we must also invalidate preceding
    siblings, since they could be affected by :first-child, :last-child or
    :nth-child() selectors.
    
    This increases the amount of invalidation we do, but it's more correct.
    
    In the future, we will implement optimizations that drastically reduce
    the number of elements invalidated.
    
    (cherry picked from commit df048e10f5a84d7fd90b1115c6bb90f45acd75ec)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    ccb85fa View commit details
    Browse the repository at this point in the history
  10. LibWeb: Cache whether there are any :has() selectors present

    As useful as they may be to web developers, :has() selectors complicate
    the style invalidation process quite a lot.
    
    Let's have StyleComputer keep track of whether they are present at all
    in the current set of active style sheets. This will allow us to
    implement fast-path optimizations when there are no :has() selectors.
    
    (cherry picked from commit 8beb7c77002a3359ad2fe73969fc6bb2dbc75413)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    a7bab05 View commit details
    Browse the repository at this point in the history
  11. LibWeb: Don't try to invalidate style for character data nodes

    Character data nodes like text and HTML comments don't have style,
    so let's just exit invalidation immediately for those.
    
    (cherry picked from commit f351f75a34619ad969f660312a2e5486f742f685)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    ffe28eb View commit details
    Browse the repository at this point in the history
  12. LibWeb: Distinguish parent/child on style invalidation for DOM insertion

    (cherry picked from commit 7d644ecd50c57454dfb73b92e59d7112d54a1b1d)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    1cf02e8 View commit details
    Browse the repository at this point in the history
  13. LibWeb: Invalidate less style on textContent change and node removal

    ...unless there are :has() selectors present. Then we have to invalidate
    everything for now.
    
    (cherry picked from commit b8ce34068f5bf8ab8cf049d56b864bff52ef3dff)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    d40f857 View commit details
    Browse the repository at this point in the history
  14. LibWeb: Abort ongoing fetch before starting a new link element fetch

    If we decide to fetch another linked resource, we don't care about the
    earlier fetch and can safely abort it.
    
    This fixes an issue on GitHub where we'd load the same style sheet
    multiple times and invalidate style for the entire document every time
    it finished fetching.
    
    By aborting the ongoing fetch, no excess invalidation happens.
    
    (cherry picked from commit 57e26ed6b9b2c0cf1e4f5ac3e85ca0c7f3647caa)
    awesomekling authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    cbe6f44 View commit details
    Browse the repository at this point in the history
  15. UI/Qt: Move "Open in New Tab" to the top of the link context menu

    (cherry picked from commit 7a2d837c8ab137d8d31b3789dfe7ef377b3b225e)
    rmg-x authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    c676eb6 View commit details
    Browse the repository at this point in the history
  16. LibWeb: Update close_top_level_traversable() to match the spec

    (cherry picked from commit 583eef265fe9ba4f91a08e5ef1b7c7339f2371d7)
    tcl3 authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    aab2670 View commit details
    Browse the repository at this point in the history
  17. LibWeb: Allow WebSockets to be established within workers

    Previously, we would crash when attempting to establish a web socket
    connection from inside a worker, as we were assuming that the ESO's
    global object was a `Window`.
    
    (cherry picked from commit 0c0595bb31db827fc14b5d16b8645bc6aa912d60)
    tcl3 authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    1ce9f6f View commit details
    Browse the repository at this point in the history
  18. LibWeb: Clean up HTMLInputElement-related includes

    This mainly uses forward declarations as appropriate for input element
    related files. This reduces the number of targets being built when we
    change HTMLInputElement.h from 430 to 44.
    
    (cherry picked from commit 57e4fb0caebb0074a23bef70d7558ce5e8a5f357)
    trflynn89 authored and nico committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    3621b29 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2024

  1. LibWeb: Sync with spec in "destroy a document and its descendants"

    The only real change here is that we make the document unsalvageable.
    Everything else is fixing up spec comments.
    
    (cherry picked from commit faf097bb4168208a7c0250280ff07e638be8058a)
    awesomekling authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    60d6668 View commit details
    Browse the repository at this point in the history
  2. LibWeb: Make make_unsalvageable a public field

    (cherry picked from commit 8b4dde0b0911f59512e1c40d19f33f49bdeeb10c)
    dlarocque authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    d22ec94 View commit details
    Browse the repository at this point in the history
  3. LibWeb: Fix "attempt to update a history entry's document"

    This updates our implementation of
    [attempt-to-populate-the-history-entry's-document](https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document)
    after fixes were made to the logic inside the queued task in
    whatwg/html@cdd014a#diff-41cf6794ba4200b839c53531555f0f3998df4cbb01a4d5cb0b94e3ca5e23947dL99534.
    
    (cherry picked from commit ed04124cbffbfe8b850e8e3a1bc0788513ce6a4d)
    dlarocque authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    9487535 View commit details
    Browse the repository at this point in the history
  4. LibJS: Update wording from Console spec

    whatwg/console#240 is an editorial change to use
    the term "implementation-defined" more consistently. This seems to be
    the only instance in the spec text which we quote verbatim.
    
    (cherry picked from commit 51f82c1d939dd28a3e719d7fa495cf9f30d0921c)
    AtkinsSJ authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    2dd7b53 View commit details
    Browse the repository at this point in the history
  5. WebDriver: Do not break WebDriver responses into multiple socket writes

    WPT uses Python's http.client.HTTPConnection to send/receive WebDriver
    messages. For some reason, on Linux, we see an ~0.04s delay between the
    WPT server receiving the WebDriver response headers and its body. There
    are tests which make north of 1100 of these requests, which adds up to
    ~44s.
    
    These connections are almost always going to be over localhost and able
    the be sent in a single write. So let's send the response all at once.
    
    On my Linux machine, this reduces the runtime of /cookies/name/name.html
    from 45-60s down to 3-4s.
    
    (cherry picked from commit e5877cda61eb53cd9c1eebbfaf3c35d084b2973c)
    trflynn89 authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    b9baf79 View commit details
    Browse the repository at this point in the history
  6. LibWeb/HTML: Implement TextTrackCue idl interface

    (cherry picked from commit 0b2449d8d264f58b39ed2a4a69b0afb8eb762011)
    jamierocks authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    01e8508 View commit details
    Browse the repository at this point in the history
  7. LibWeb/HTML: Implement TextTrackCueList idl interface

    (cherry picked from commit cfec88feb312f3fbffe2270009a9ba07e2fd9b3f)
    jamierocks authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    c395b31 View commit details
    Browse the repository at this point in the history
  8. LibWeb/WebVTT: Implement VTTRegion idl interface

    (cherry picked from commit 1a012f279a9791c685781b7189fba6cddb973f96)
    jamierocks authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    82259fc View commit details
    Browse the repository at this point in the history
  9. LibWeb/WebVTT: Implement VTTCue idl interface

    (cherry picked from commit 973f774e56b519964f2f43d965035d9076658096)
    jamierocks authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    9359123 View commit details
    Browse the repository at this point in the history
  10. LibWeb/CSS: Correct behavior of revert inside a @layer

    `revert` is supposed to revert to the previous cascade origin, but we
    previously had it reverting to the previous layer. To support both,
    track them separately during the cascade.
    
    As part of this, we make `set_property_expanding_shorthands()` fall back
    to `initial` if it can't find a previous value to revert to. Previously
    we would just shrug and do nothing if that happened, which only works
    if the value you want to revert to is whatever is currently in `style`.
    That's no longer the case, because `revert` should skip over any layer
    styles that have been applied since the previous origin.
    
    (cherry picked from commit bea47a25545adfb96d83a16a3e4f4435bae05e39)
    AtkinsSJ authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    eb98ccf View commit details
    Browse the repository at this point in the history
  11. LibWeb/CSS: Clarify comment about cascading presentational hints

    The spec allows us to either treat them as part of the UA origin, or as
    its own origin before author styles. This second behaviour turns out to
    be what we are currently doing, which is nice!
    
    Funnily enough this was clarified in the spec barely a month after this
    original comment was written. :^)
    
    (cherry picked from commit dcf55dd4924e5369d75a3533af2b869033a0ebfd)
    AtkinsSJ authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    b427f1b View commit details
    Browse the repository at this point in the history
  12. LibWeb/Fetch: Handle edge cases in 'get, decode, and split'

    See:
    - whatwg/fetch#1769
    - whatwg/fetch@3153e5e
    
    (cherry picked from commit 84351dfa51dc8bd0046c3a9ec3e574c58fe9f790)
    jamierocks authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    30e6442 View commit details
    Browse the repository at this point in the history
  13. LibJS: Don't infinite loop on unknown console.log formatting specifiers

    (cherry picked from commit ef9208047dc8770f6263b483d7a442df703bc42b)
    awesomekling authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    5bc61b6 View commit details
    Browse the repository at this point in the history
  14. LibWeb: Fire error event when script has an execution error

    We now use the "report an exception" AO when a script has an execution
    error. This has mostly replaced the older "report the exception" AO in
    various specifications. Using this newer AO ensures that
    `window.onerror` is invoked when a script has an execution error.
    
    (cherry picked from commit 579a289d3db849657987c3310e7b1d71d290b566)
    tcl3 authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    f89aa4f View commit details
    Browse the repository at this point in the history
  15. Base: Navigate DOM tree with arrows

    (cherry picked from commit 9d82e8112493575f78f66b1a0dc65ae0e791e70b)
    chaseWillden authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    8188edd View commit details
    Browse the repository at this point in the history
  16. LibWeb: Use substring matching for content filters

    (cherry picked from commit 2e5edcf27e7d2a212043a7ac1b906217b357b964)
    Gingeh authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    ebe0797 View commit details
    Browse the repository at this point in the history
  17. LibWeb: Always blockify the root element

    This is what the spec tells us to do:
    
        The root element’s display type is always blockified,
        and its principal box always establishes an independent
        formatting context.
    
        Additionally, a display of contents computes to block
        on the root element.
    
    Spec link: https://drafts.csswg.org/css-display/#root
    
    Fixes SerenityOS#1562
    
    (cherry picked from commit f1be662f683155705f851bcf440fe30d0e606a87)
    awesomekling authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    0eca32b View commit details
    Browse the repository at this point in the history
  18. LibWebSocket: Don't allow a connection to be discarded more than once

    (cherry picked from commit 6095aa3cc5a38367a57c3d734129017104498904)
    tcl3 authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    8b75b85 View commit details
    Browse the repository at this point in the history
  19. LibWeb/WebSocket: Allow sending binary blob data over a websocket

    (cherry picked from commit 4ccc52e921a5b17c6f6ec67dec7c0dff46ac7884)
    tcl3 authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    c2c5eb8 View commit details
    Browse the repository at this point in the history
  20. LibWeb: Forbid reentrancy of style-layout-repaint in EventLoop::process

    Fixes crashing on https://playbiolab.com/ in
    VERIFY(page.client().is_ready_to_paint()) caused by attempting to start
    the next repaint before the ongoing repaint is done.
    
    (cherry picked from commit f341af1d7265eee880355f10ef5d479c9ebceaf2)
    kalenikaliaksandr authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    319f25d View commit details
    Browse the repository at this point in the history
  21. LibWeb/HTML: Re-order promise resolution to match spec

    Applies changes in whatwg/html#10658 and also
    whichever previous change split the step for firing the navigateerror
    into two parts.
    
    (cherry picked from commit ec15f8fa626e5b0faf5b3e420080e944ab31ff11)
    AtkinsSJ authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    473bac0 View commit details
    Browse the repository at this point in the history
  22. LibWeb: Deduplicate attributes when emitting start and end tags

    The HTML tokenizer specification says that we're supposed to do this
    when leaving the Attribute name or when emitting the token, as
    appropriate.
    
    Hopefully 'as appropriate' can mean only when emitting the token, as
    that's the easiest place to insert this logic without complicating the
    tokenizer any more.
    
    (cherry picked from commit 7aa0165fe75bb94b79bc847484c7913d249ce263)
    ADKaster authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    73161fc View commit details
    Browse the repository at this point in the history
  23. UI/Qt: Do not create signal notifiers until after an event loop exists

    We are currently creating a signal socket and socket notifier before the
    Qt event loop itself has been created. Thus, when we receive a signal,
    we are not actually notified when we write that signal number to the
    signal socket.
    
    This was also the source of the following error message being displayed
    on every launch of the browser:
    
        QSocketNotifier: Can only be used with threads started with QThread
    
    (cherry picked from commit 3393a7477103cb2dc2fe970e3559abb34b3a0ce8)
    trflynn89 authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    7119d93 View commit details
    Browse the repository at this point in the history
  24. LibWeb/MimeSniff: Update the MIME type sniffing algo to meet specs

    The spec moved/added the xml and html checks to the beginning and
    removed sniffing resource feeds.
    
    (cherry picked from commit b8a5e18a016dc32ba065417a4d6d32bbc03f101d)
    kemzeb authored and nico committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    2cc7dcb View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    95a99f5 View commit details
    Browse the repository at this point in the history