Skip to content

media_query: add match for screen #404

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

Closed
wants to merge 1 commit into from
Closed

Conversation

vgmoose
Copy link

@vgmoose vgmoose commented May 3, 2025

For #359, to match media queries that specify screen type (as opposed to print), such as Wikipedia.

According to the linked media queries doc, screen should be:

Matches all devices that aren’t matched by print.

And print is:

Matches printers, and devices intended to reproduce a printed display, such as a web browser showing a document in “Print Preview”.

So either one or the other should be matched. Screenshots and example HTML are in the original issue (#359).

@vgmoose
Copy link
Author

vgmoose commented May 3, 2025

Nevermind, after trying in litebrowser-linux (following advice in #359), this is already properly working. I did not implement get_media_features correctly.

In it, you set the litehtml::media_features type to litehtml::media_type_screen or litehtml::media_type_print depending on which is desired. This PR would have hardcoded it to always be respond to screen, which is invalid.

@vgmoose vgmoose closed this May 3, 2025
@vgmoose
Copy link
Author

vgmoose commented May 3, 2025

Specifically, this kind of line is what I was missing, in the class that implements document_container:

media.type = litehtml::media_type_screen;

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.

1 participant