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

LibWeb: Add word spacing to tab size correctly #1999

Conversation

kostyafarber
Copy link
Contributor

We should be adding the computed value for word spacing not letter spacing twice.

@awesomekling
Copy link
Member

Oops! Can we add a test?

@kostyafarber
Copy link
Contributor Author

Yeah I was surprised that this didn't change the existing layout tests but the extra word spacing didn't actually affect where the next glyph went as the next tab stop didn't change with the extra width 😄

I'll add a test where the extra spacing does push the glyph to the subsequent tab stop!

@yyny
Copy link
Contributor

yyny commented Oct 27, 2024

Shouldn't there have been an unused variable error for this?

@kostyafarber
Copy link
Contributor Author

erm good point, it did not seem to trigger it that in linting, it is indeed unused before this patch.

kostyafarber added a commit to kostyafarber/ladybird that referenced this pull request Oct 28, 2024
This is the default font size used in Chrome and Firefox and my theory
is some WPT tests make the same assumption. As an example,
https://wpt.live/css/css-text/tab-size/tab-size-spacing-001.html will
pass once PR LadybirdBrowser#1999 is merged if we explicitly set the font-size to be
13px.

I figured this out when comparing the size of the space character across
Chrome and Ladybird, which we were sizing to large and hence
overshooting the
red square in the aforementioned WPT test. I'd like to think that this
is true across all WPT tests that measure pixels and use monospace as
their font-family :^) but this is unsubstantiated.
We should be adding the computed value for word spacing not letter
spacing twice.
@kostyafarber
Copy link
Contributor Author

@awesomekling test added, I yoinked it from wpt, although it's not passing there (see why I think in the discussion on #2020) but it's a good test for this bug.

@awesomekling awesomekling merged commit 2f41be7 into LadybirdBrowser:master Oct 28, 2024
6 checks passed
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.

3 participants