Skip to content

script: Support all pseudo-elements in getComputedStyle - #49804

Merged
Loirooriol merged 1 commit into
servo:mainfrom
Loirooriol:getComputedStyle-pseudo
Nov 11, 2026
Merged

Loirooriol merged 1 commit into
servo:mainfrom
Loirooriol:getComputedStyle-pseudo

Conversation

@Loirooriol

@Loirooriol Loirooriol commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

We were hardcoding support for just some pseudo-elements. Now the logic will ask Stylo to parse the provided string as a valid pseudo-element. In particular, these are now supported:

  • ::backdrop
  • ::file-selector-button
  • ::first-letter and :first-letter
  • ::first-line and :first-line (requires enabling layout.css.first-line.enabled)
  • ::details-content
  • ::color-swatch
  • ::slider-fill
  • ::slider-thumb
  • ::slider-track
  • ::-moz-progress-bar

Testing: Various tests improve
Fixes: #43095

@Loirooriol Loirooriol added the T-linux-wpt Do a try run of the WPT label Nov 10, 2026
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Nov 10, 2026
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#42924618943) for Linux (WPT)

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from try job (#42924618943):

Flaky unexpected result (12)
  • OK /css/CSS2/normal-flow/nested-inline-boxes-around-block-in-inline-001.html
    • FAIL [expected PASS] subtest: Inline boxes at every nesting level around a block level box report the same height

      assert_equals: middle vs outer expected 100.2 but got 96.91666666666667
      

    • FAIL [expected PASS] subtest: Nesting depth does not offset an inline box around a block level box

      assert_equals: tops match expected -1.65 but got 0.9166666666666666
      

  • FAIL [expected PASS] /css/css-backgrounds/background-size-042.html
  • OK /fetch/content-length/api-and-duplicate-headers.any.worker.html (#35197)
    • FAIL [expected PASS] subtest: fetch() and duplicate Content-Length/Content-Type headers

      promise_test: Unhandled rejection with value: object "TypeError: Network error: HTTP failure: client error (SendRequest)"
      

  • ERROR [expected OK] /focus/focus-event-after-switching-iframes.sub.html (#40368)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/refresh/same-document-refresh.html (#34597)
    • FAIL [expected PASS] subtest: Same-Document Referrer from Refresh

      assert_equals: original page loads expected "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section#section"
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/media-elements/src_object_blob.html (#40340)
    • TIMEOUT [expected PASS] subtest: HTMLMediaElement.srcObject blob

      Test timed out
      

  • TIMEOUT [expected OK] /html/user-activation/navigation-state-reset-sameorigin.html (#45151)
    • TIMEOUT [expected FAIL] subtest: Post-navigation state reset.

      Test timed out
      

  • OK /sanitizer-api/sanitizer-inert-document.html (#45260)
    • FAIL [expected PASS] subtest: Test whether setHTML loads the image.

      promise_test: Unhandled rejection with value: "The server observed a request. It shouldn't have."
      

    • PASS [expected FAIL] subtest: Test whether setHTMLUnsafe loads the image.
  • OK /upgrade-insecure-requests/gen/sharedworker-module-data.meta/unset/fetch.https.html
    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to cross-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-http-downgrade origin and no-redirect redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

    • FAIL [expected PASS] subtest: Upgrade-Insecure-Requests: Expects blocked for fetch to same-https origin and downgrade redirection from https context.

      assert_equals: The resource request should be 'blocked'. expected "blocked" but got "allowed"
      

  • TIMEOUT [expected OK] /webdriver/tests/classic/perform_actions/navigation.py (#38822)
  • OK /webdriver/tests/classic/set_window_rect/user_prompts.py
    • ERROR [expected PASS] subtest: test_accept[alert-None]

      teardown error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept[confirm-True]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept[prompt-]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[confirm-True]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_accept_and_notify[prompt-]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[confirm-False]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss[prompt-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • ERROR [expected PASS] subtest: test_dismiss_and_notify[alert-None]

      setup error: ConnectionRefusedError: [Errno 111] Connection refused
      

    • And 8 more unexpected results...
  • OK [expected TIMEOUT] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.html (#29053)
    • FAIL [expected TIMEOUT] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe

      assert_true: about:blank window opened by 3P iframe does not inherit 3P iframe's StorageKey expected true got false
      

Stable unexpected results that are known to be intermittent (9)
  • OK [expected TIMEOUT] /IndexedDB/idbcursor-request-source.any.worker.html (#48700)
    • PASS [expected TIMEOUT] subtest: IDBObjectStore::openCursor's request source must be the IDBObjectStore instance that opened the cursor
  • CRASH [expected TIMEOUT] /dom/xpath-evaluation-detached-nodes.html (#49715)
  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.https.any.html (#32153)
    • PASS [expected TIMEOUT] subtest: [keepalive][iframe][load] mixed content redirect; setting up
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/cross-origin-top-navigation-with-user-activation-in-parent.window.html (#48205)
    • TIMEOUT [expected FAIL] subtest: Cross-origin top navigation is blocked without user activation, even if the parent has user activation

      Test timed out
      

  • TIMEOUT /html/browsers/history/the-history-interface/001.html (#12580)
    • FAIL [expected PASS] subtest: traversing history must also traverse hash changes

      assert_equals: (this could cause other failures later on) expected "" but got "test"
      

  • CRASH [expected TIMEOUT] /html/browsers/history/the-location-interface/location_replace_session_history.html (#41896)
  • TIMEOUT [expected OK] /html/browsers/windows/consume-user-activation/window-open-multi-global.html (#47399)
    • TIMEOUT [expected FAIL] subtest: window.open() and consuming user activation with multiple globals in play

      Test timed out
      

  • FAIL [expected PASS] /mathml/presentation-markup/operators/mo-single-char-and-children.html (#49318)
  • PASS [expected FAIL] /mathml/presentation-markup/operators/operator-dictionary-empty-and-three-chars.html (#49173)
Stable unexpected results (16)
  • OK /css/css-display/display-first-letter-001.html
    • PASS [expected FAIL] subtest: display of first-letter
  • OK /css/css-position/backdrop-inherit-computed.html
    • PASS [expected FAIL] subtest: Inherit custom property
    • PASS [expected FAIL] subtest: Apply inherited custom property to background-color
    • PASS [expected FAIL] subtest: Implicitly inherited color-scheme
    • PASS [expected FAIL] subtest: Explicitly inherited left
  • OK /css/css-pseudo/file-selector-button-inherit.html
    • PASS [expected FAIL] subtest: ::file-selector-button should inherit from its originating element
  • OK /css/css-pseudo/first-letter-allowed-properties.html
    • PASS [expected FAIL] subtest: backgroundAttachment should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundBlendMode should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundClip should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundColor should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundImage should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundOrigin should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundPosition should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundRepeat should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: backgroundSize should be applied to first-letter pseudo elements.
    • PASS [expected FAIL] subtest: border should be applied to first-letter pseudo elements.
    • And 22 more unexpected results...
  • OK /css/css-shadow/part/interaction-with-pseudo-elements.html
    • PASS [expected FAIL] subtest: ::first-letter in selected host is styled
  • OK /css/css-shadow/part/multiple-scopes.html
    • PASS [expected FAIL] subtest: exported part selector matches from outer scope
    • PASS [expected FAIL] subtest: non-exported part selector does not match from outer scope
    • PASS [expected FAIL] subtest: pseudo-element selector alone does not match from outer scope
    • PASS [expected FAIL] subtest: exported part selector (for outer scope) does not match from middle scope
    • PASS [expected FAIL] subtest: correct part selector matches from middle scope
    • PASS [expected FAIL] subtest: pseudo-element selector alone does not match from middle scope
    • PASS [expected FAIL] subtest: selector with ::part(exported name) does not match from inner scope that exports the part
    • PASS [expected FAIL] subtest: pseudo-element selector alone matches from inner scope
  • OK /css/css-shadow/part/pseudo-elements-after-part.html
    • PASS [expected FAIL] subtest: computed style for ::part()::backdrop
    • PASS [expected FAIL] subtest: computed style for ::part()::file-selector-button
    • PASS [expected FAIL] subtest: computed style for ::part()::first-letter
  • OK /css/css-values/attr-pseudo-elem-invalidation-2.html
    • PASS [expected FAIL] subtest: CSS Values and Units Test: attr() invalidation of pseudo elements 2
    • PASS [expected FAIL] subtest: CSS Values and Units Test: attr() invalidation of pseudo elements 6
    • PASS [expected FAIL] subtest: CSS Values and Units Test: attr() invalidation of pseudo elements 7
    • PASS [expected FAIL] subtest: CSS Values and Units Test: attr() invalidation of pseudo elements 8
  • OK /css/css-values/attr-pseudo-elem-invalidation.html
    • PASS [expected FAIL] subtest: CSS Values and Units Test: attr() invalidation of pseudo elements 1
  • OK /css/css-values/ch-empty-pseudo-recalc-on-font-load.html
    • PASS [expected FAIL] subtest: ch in pseudo-element ::backdrop should be recalculated after loading a web font
  • OK /css/css-variables/variable-first-letter.html
    • PASS [expected FAIL] subtest: color
    • PASS [expected FAIL] subtest: font-size
    • PASS [expected FAIL] subtest: font-weight
    • PASS [expected FAIL] subtest: nested color
  • OK /css/cssom/getComputedStyle-pseudo.html
    • PASS [expected FAIL] subtest: Unknown pseudo-element with a known identifier: backdrop
    • PASS [expected FAIL] subtest: Unknown pseudo-element with a known identifier: file-selector-button
    • PASS [expected FAIL] subtest: ::file-selector-button resolves to the file input button element
  • OK /css/selectors/old-tests/css3-modsel-39.xml
    • PASS [expected FAIL] subtest: ::first-letter pseudo-element background-color should be lime
  • OK /css/selectors/old-tests/css3-modsel-39a.xml
    • PASS [expected FAIL] subtest: ::first-letter on ::before content should be lime
  • OK /css/selectors/old-tests/css3-modsel-39b.xml
    • PASS [expected FAIL] subtest: ::first-letter pseudo-element background-color should be lime
  • OK /css/selectors/old-tests/css3-modsel-39c.xml
    • PASS [expected FAIL] subtest: ::first-letter pseudo-element with ::before pseudo-element

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#42924618943) failed!

@Loirooriol
Loirooriol force-pushed the getComputedStyle-pseudo branch from b88126d to dbd25ce Compare November 11, 2026 00:28
@Loirooriol
Loirooriol marked this pull request as ready for review November 11, 2026 00:35
@Loirooriol
Loirooriol requested a review from gterzian as a code owner November 11, 2026 00:35
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 11, 2026
@Loirooriol
Loirooriol requested a review from mrobinson November 11, 2026 00:35

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff.

Comment thread components/script/dom/window/window.rs Resolved
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 11, 2026
We were hardcoding support for just some pseudo-elements. Now the logic
will ask Stylo to parse the provided string as a valid pseudo-element.

Signed-off-by: Oriol Brufau <[email protected]>
@Loirooriol
Loirooriol force-pushed the getComputedStyle-pseudo branch from dbd25ce to e5c9445 Compare November 11, 2026 00:40
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 11, 2026
@Loirooriol
Loirooriol enabled auto-merge November 11, 2026 00:42
@Loirooriol
Loirooriol added this pull request to the merge queue Nov 11, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 11, 2026
@servo-highfive

Copy link
Copy Markdown

Someone thinks this change could be added to the monthly blog post! To help with this, we need someone to answer the following questions: 😄

  1. Who is most impacted by this change: users, Servo developers, embedders, or some other group?
  2. What observable difference does this change make?
  3. What preferences (if any) need to be enabled to observe this difference?
  4. What (if any) specific URLs are affected?

If this change is part of a broader feature/project please make sure the PR description contains a Fixes: #12345 or Part of: #12345 issue reference.

Please add @servo-highfive monthly update answer when answering these questions so the bot notices your answer (or just quote this comment).

Thanks for helping us prepare the monthly blog post! ❤️

@Loirooriol

Copy link
Copy Markdown
Contributor Author

@servo-highfive monthly update answer

  1. Users
  2. Webpages using getComputedStyle() with a pseudo-element parameter will now work
  3. None
  4. N/A

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 11, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Nov 11, 2026
@Loirooriol
Loirooriol added this pull request to the merge queue Nov 11, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Nov 11, 2026
Merged via the queue into servo:main with commit c685d98 Nov 11, 2026
47 checks passed
@Loirooriol
Loirooriol deleted the getComputedStyle-pseudo branch November 11, 2026 13:13
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

monthly update S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better integration of getComputedStyle with PseudoElement

3 participants