Skip to content

script: ensure that theme changes trigger related media query events - #45222

Merged
jdm merged 4 commits into
servo:mainfrom
webbeef:theme-changed-media-query-event
Jun 9, 2026
Merged

jdm merged 4 commits into
servo:mainfrom
webbeef:theme-changed-media-query-event

Conversation

@webbeef

@webbeef webbeef commented May 29, 2026

Copy link
Copy Markdown
Contributor

Currently the media queries are only re-evaluated at an rendering update turn if there is a viewport resize. This adds tracking for other sources of changes that can warrant a media query evaluation in order to trigger 'change' events.

Testing: this requires embedder changes. I tested with mine in which I can force the dark mode on/off.

@webbeef
webbeef requested a review from gterzian as a code owner May 29, 2026 04:16
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label May 29, 2026
@jdm

jdm commented May 29, 2026

Copy link
Copy Markdown
Member

We could add an automated test for this by adding a testing API from JS that forces a particular theme.

@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.

Nice find. I wonder if this fixes #40268.

Comment thread components/script/script_thread.rs Resolved
@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels May 29, 2026
@mrobinson

Copy link
Copy Markdown
Member

We could add an automated test for this by adding a testing API from JS that forces a particular theme.

Should it also be possible to write a WebView unit test that verifies this?

webbeef added 3 commits June 7, 2026 19:15
Currently the media queries are only re-evaluated at an rendering update turn if
there is a viewport resize. This adds tracking for other sources of changes that
can warrant a media query evaluation in order to trigger 'change' events.

Signed-off-by: webbeef <[email protected]>
Signed-off-by: webbeef <[email protected]>
Signed-off-by: webbeef <[email protected]>
@webbeef
webbeef force-pushed the theme-changed-media-query-event branch from 238d88d to 6de4ec7 Compare June 8, 2026 02:15
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jun 8, 2026
@webbeef

webbeef commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

We could add an automated test for this by adding a testing API from JS that forces a particular theme.

Should it also be possible to write a WebView unit test that verifies this?

I added a WebView unit test.

Signed-off-by: webbeef <[email protected]>

@jdm jdm 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.

Thanks!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Jun 9, 2026
@jdm
jdm dismissed mrobinson’s stale review June 9, 2026 14:57

Addressed.

@jdm
jdm added this pull request to the merge queue Jun 9, 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 Jun 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jun 9, 2026
@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 Jun 9, 2026
@jdm
jdm added this pull request to the merge queue Jun 9, 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 Jun 9, 2026
Merged via the queue into servo:main with commit 92d4d55 Jun 9, 2026
33 checks passed
@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 Jun 9, 2026
niyabits pushed a commit to niyabits/servo that referenced this pull request Jun 11, 2026
…ervo#45222)

Currently the media queries are only re-evaluated at an rendering update
turn if there is a viewport resize. This adds tracking for other sources
of changes that can warrant a media query evaluation in order to trigger
'change' events.

Testing: this requires embedder changes. I tested with mine in which I
can force the dark mode on/off.

---------

Signed-off-by: webbeef <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants