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

Add a lang IDL Attribute to CanvasTextDrawingStyles, and clarify "direction" on same #10873

Merged
merged 24 commits into from
Mar 4, 2025

Conversation

schenney-chromium
Copy link
Contributor

@schenney-chromium schenney-chromium commented Dec 19, 2024

There is no way to localize the fonts used in HTML Canvas text rendering and metrics when using an OffscreenCanvas, and there is no information in the spec about how to determine the primary language even for regular 2D canvas (though implementations seem to agree to use the canvas element's lang attribute and use the default locale from the HTTP header for Offscreen). This proposal adds a lang IDL attribute to CanvasTextDrawingStyles, which is mixed into both CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D.

The changes in this PR define how the language for font resolution should be chosen for canvas contexts and applies the same treatment to the inherit value for the direction IDL attribute which is currently not well defined.

See the discussion in issue #10862.


/acknowledgements.html ( diff )
/canvas.html ( diff )
/dom.html ( diff )
/infrastructure.html ( diff )

@schenney-chromium schenney-chromium marked this pull request as draft December 19, 2024 00:49
@schenney-chromium
Copy link
Contributor Author

@AndresRPerez12, @annevk, @fserb, @Kaiido
Hoping to take an initial look at this in the Dec 19 meeting. Failing that, the first meeting in January that I can attend.

Note that currently Chromium does not resolve direction: "inherit" in the manner I have proposed. It just looks at the direction style property on the canvas element, not the dir attribute on the canvas. This seems wrong given the preference for using the dir attribute to specify document writing mode rather than style.

Copy link
Member

@Kaiido Kaiido left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this!

I personally think it's great this hidden inheritance is finally made explicit, and having a way to set it on the context directly is a big plus.

@schenney-chromium
Copy link
Contributor Author

Thanks for the very quick first round of review. I'll make the changes and update the PR.

@schenney-chromium schenney-chromium self-assigned this Dec 20, 2024
@schenney-chromium
Copy link
Contributor Author

I plan to get this updated in the coming week. One issue is a lack of testing coverage for offscreen canvas objects transferred from HTML canvas, needed to the the "inherit" attribute value. I filed web-platform-tests/wpt#49987 to get that added to wpt, and I think I'll try to do the work for it.

@schenney-chromium
Copy link
Contributor Author

I've finally updated the PR. Please take another look. The WHATNOT meeting 2 weeks from now is my target to discuss this, and hopefully approve the algorithms, if not the exact language.

@Kaiido
Copy link
Member

Kaiido commented Jan 22, 2025

The whole snapshot thing seems super complex and probably surprising for web-authors.
I, for one, would definitely expect that if I set it explicitly to "inherit" at some point and the <canvas>'s lang changes afterwards, the context's inner value would get updated, just like it is for direction.

Given that "inherit" doesn't really inherit but instead does ctx.lang = getComputedStyle(ctx.canvas)?.lang, I wonder how useful it is to have it at all. If the issue is to have a default value, maybe we can set it at creation time to the inherited value, if any, and let the getter return that value.

Note: The current default behavior doesn't seem interoperable, where Chrome actually uses the updated lang value, while Firefox and Safari seem to keep the one at creation time. I take it that Chrome is fine changing to the inherit-at-creation behavior.

@schenney-chromium
Copy link
Contributor Author

The whole snapshot thing seems super complex and probably surprising for web-authors. I, for one, would definitely expect that if I set it explicitly to "inherit" at some point and the <canvas>'s lang changes afterwards, the context's inner value would get updated, just like it is for direction.

I agree it's somewhat confusing, but every time I tried to come up with something more intuitive I failed. In particular, for things that affect the font, Chromium currently re-resolves the font each time one of those things changes. Hence Chrome is currently updating for the lang value (though I would have to look at how invalidation works in that case in the current code). Codifying that is hard because there's no definitive time when the font gets resolved. Maybe "changes in the inherited lang must be applied before the font is next used to render text or metrics" which is essentially the direction behavior.

Given that "inherit" doesn't really inherit but instead does ctx.lang = getComputedStyle(ctx.canvas)?.lang, I wonder how useful it is to have it at all. If the issue is to have a default value, maybe we can set it at creation time to the inherited value, if any, and let the getter return that value.

There is no easy way for authors to get the "computed value" for the language of an element. That's Issue #7039 that Anne linked to. In practice , WebKit and Chromium both have the CSS -webkit-locale property that can be queried, but that's not even close to standardized (though I guess we could).

Removing "inherit" gets into a problem with initial values. We want sane initial values for direction and the language, and "inherit" is the best initial value in my opinion. So if we were to remove it as a valid value to set for lang or direction, we would still need the spec text for how to compute the initial value. The CSS direction attribute has this problem where the spec does not match any browser implementation, because browsers all push the directionality of the element into the direction property for the initial value, not ltr as the spec says. I plan to put up a PR clarifying that behavior.

And then if you allow a special initial value, then how do you reset to that initial value? Drop "inherit" and add "initial"? I could get behind that.

Note: The current default behavior doesn't seem interoperable, where Chrome actually uses the updated lang value, while Firefox and Safari seem to keep the one at creation time. I take it that Chrome is fine changing to the inherit-at-creation behavior.

I just changed Chrome to use inherit-at-creation for direction in offscreen, but left the element canvas behavior the same. There's no real performance cost to Chromium's behavior for direction because changing it does not change the font. But for lang there's the performance hit of re-resolving the font that apparently Chromium is willing to take.

@schenney-chromium
Copy link
Contributor Author

New version up. Thanks, as always, for the reviews.

@schenney-chromium
Copy link
Contributor Author

Next round of edits are done. This process will help me a lot when doing my next PR.

source Outdated
Comment on lines 66733 to 66734
<li><p>Change the current value to the new value.</p></li>
<li><p>If the value is "<code data-x="dom-context-2d-direction-inherit">inherit</code>", then</p>
Copy link
Member

Choose a reason for hiding this comment

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

This should probably perform the same checks as in https://whatpr.org/html/10873/dom.html#the-lang-and-xml:lang-attributes so that it's limited to BCP 47 allowed values and the special inherit value (, and maybe ""?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it says it must be valid, but then it says:
If the resulting value is not a recognized language tag, then it must be treated as an unknown language having the given language tag, distinct from all other languages. For the purposes of round-tripping or communicating with other services that expect language tags, user agents should pass unknown language tags through unmodified, and tagged as being BCP 47 language tags, so that subsequent services do not interpret the data as another type of language description. [[BCP47]](https://whatpr.org/html/10873/references.html#refsBCP47)

So maybe say it must be valid but the UA must still pass invalid values through unmodified?

@Kaiido
Copy link
Member

Kaiido commented Jan 24, 2025

It starts to look a lot better to me (modulo the internal value used by the getter and setter, I guess).

I still think that "inherit" isn't correct as a value though.

The CSS direction attribute has this problem where the spec does not match any browser implementation

I'm not sure how relevant it is for the canvas context lang though. The ctx.direction = "inherit" seems quite interoperable and does update whenever the directionality of the <canvas> element changes. Having a different behavior for the same keyword value on the same interface seems bad to me. "initial" might indeed look better.

@Kaiido
Copy link
Member

Kaiido commented Feb 27, 2025

Looking good!
Just one little thing, should the value "" for lang be handled explicitly? I don't think CSS side expects this value, but rather the explicitly unknown one. In the DOM attribute it's currently handled through "Setting the attribute to the empty string indicates that the primary language is unknown.", but I'm not sure it's normative enough.

Copy link
Contributor Author

@schenney-chromium schenney-chromium left a comment

Choose a reason for hiding this comment

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

Thanks folks. Next version on the way.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

I think I found the final newline to add. Nice work!

One thing I'd like to understand a bit better before merging this is the test situation as currently OP links to too many tests for this change. What tests are specifically covering what is being defined here? (Links to PRs written for this change are fine as well.)

</li>
</ol>
</li>
<li><p>If <var>language</var> is the empty string, then set <var>language</var> to
Copy link
Member

Choose a reason for hiding this comment

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

Newline before this list item.

Copy link
Contributor Author

@schenney-chromium schenney-chromium Feb 27, 2025

Choose a reason for hiding this comment

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

Done.

Regarding tests ...

For direction and lang values, in wpt/html/canvas/element/text and wpt/html/canvas/offscreen/text

  • 2d.text.direction.default.tentative.html
  • 2d.text.direction.invalid.html
  • 2d.text.direction.valid.tentative.html
  • 2d.text.lang.default.tentative.html

For the behavior of direction in DOM canvas, in wpt/html/canvas/element/manual/text:

  • canvas.2d.direction.inherit.canvas.html
  • canvas.2d.direction.inherit.disconnected.canvas.html
  • canvas.2d.direction.inherit.document.html
  • canvas.2d.direction.inherit.dynamic.canvas.html
  • canvas.2d.direction.inherit.style.html

For the behavior of lang in DOM canvas, in wpt/html/canvas/element/manual/text:

  • canvas.2d.lang.dynamic.html
  • canvas.2d.lang.empty.canvas.tentative.html
  • canvas.2d.lang.inherit.canvas.tentative.html
  • canvas.2d.lang.inherit.disconnected.canvas.tentative.html
  • canvas.2d.lang.inherit.document.disconnected.canvas.tentative.html
  • canvas.2d.lang.inherit.document.tentative.html
  • canvas.2d.lang.tentative.html

For the behavior of direction in offscreen canvas and workers, in wpt/html/canvas/offscreen/manual/text:

  • canvas.2d.offscreen.direction.html
  • canvas.2d.offscreen.transferred.direction.inherit.document.html
  • canvas.2d.offscreen.transferred.direction.inherit.html
  • canvas.2d.offscreen.worker.direction.html
  • canvas.2d.offscreen.worker.direction.inherit.html

For the behavior of lang in offscreen canvas and workers, in wpt/html/canvas/offscreen/manual/text:

  • canvas.2d.offscreen.lang.inherit.tentative.html
  • canvas.2d.offscreen.lang.tentative.html
  • canvas.2d.offscreen.transferred.lang.inherit.document.tentative.html
  • canvas.2d.offscreen.transferred.lang.inherit.tentative.html
  • canvas.2d.offscreen.transferred.lang.tentative.html
  • canvas.2d.offscreen.worker.lang.inherit.tentative.html
  • canvas.2d.offscreen.worker.lang.tentative.html

Note I'll remove the "tentative" once this PR lands. There may also be an issue on Mac with the fonts used for distinguishing languages, which I'll also be addressing in a follow up CL.

And I'll be doing the MDN work in the next week or so.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks! Normally there's a WPT PR up to rename tentative tests. (The HTML standard PR template also asks for this.)

For MDN all that's required is that you file an issue which you did.

@schenney-chromium
Copy link
Contributor Author

Thanks for all your patience.

I've listed all the tests in the comment above.

Does the "Merging is Blocked" "This branch must not contain merge commits." something that's going to cause problems?

@annevk
Copy link
Member

annevk commented Feb 28, 2025

@schenney-chromium thanks! "Merging is Blocked" does not appear for me so I think that's fine. Two more things:

  1. It seems a bit concerning that many of the language tests are already passing in all browsers (except Edge for some reason). Are they actually testing anything?
  2. In order to merge this we'll need the test PR to rename away from tentative up as well as I tried to explain above. Not sure if that registered.

@schenney-chromium
Copy link
Contributor Author

Locally on Firefox the tests don't pass, so I need to look at what's going on on WPT.

For Safari the tests may be passing due to font choices, such that the references don't work as expected. I'll modify the tests to address that particular issue.

I'll remove the tentative too. The ordering of actions was not clear to me.

Sorry I didn't understand the pre-requisites for testing before landing. I'll try to get the tests updated today.

@annevk
Copy link
Member

annevk commented Feb 28, 2025

Well that's not quite the order either. A PR should be up that the editor then merges (and can review) together with the specification PR. It's probably okay to do it like this though.

@schenney-chromium
Copy link
Contributor Author

Ahh, now I understand the testing thing.

The issue with the Safari and Firefox passing the WPT appears to be due to different default language choices compared to Chrome and Edge. That is, they use "zh-CN" by default, not "ja". Given the tests all assume "ja" is default and test setting the lang to "zh-CN" the browsers pass by default. The fix is to render two languages in each test or maybe use languages that no browser is likely to consider default.

@annevk
Copy link
Member

annevk commented Feb 28, 2025

Yeah, or duplicate the tests so you have cover both zh-CN and ja.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 28, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 28, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Feb 28, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Feb 28, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 1, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <jpgravelchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870

UltraBlame original commit: 5e5efe6c3eeefb3e6842b11ecf09c86ed8b0e921
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 1, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <andresrperezchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969

UltraBlame original commit: 95c6e5bb08ff14626bab0ee8d8ffb3bdc502947f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 1, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <jpgravelchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870

UltraBlame original commit: 5e5efe6c3eeefb3e6842b11ecf09c86ed8b0e921
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 1, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <andresrperezchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969

UltraBlame original commit: 95c6e5bb08ff14626bab0ee8d8ffb3bdc502947f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 1, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <jpgravelchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870

UltraBlame original commit: 5e5efe6c3eeefb3e6842b11ecf09c86ed8b0e921
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 1, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <andresrperezchromium.org>
Commit-Queue: Stephen Chenney <schenneychromium.org>
Cr-Commit-Position: refs/heads/main{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969

UltraBlame original commit: 95c6e5bb08ff14626bab0ee8d8ffb3bdc502947f
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 4, 2025
Remove the tentative naming for whatwg/html#10873.

And make all the tests verify two languages, because browsers differ in which language they consider the default.
@annevk annevk merged commit aa586d0 into whatwg:main Mar 4, 2025
2 checks passed
@annevk
Copy link
Member

annevk commented Mar 4, 2025

Thanks @schenney-chromium!

jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 5, 2025
…ribute, a=testonly

Automatic update from web-platform-tests
Implement the Canvas TextStyles lang attribute

The HTML canvas textStyle "lang" attribute provides control over the
locale when using text features in a canvas. The default is "inherit"
that takes the language from the host document element. Other strings
are used directly as a locale.

Spec PR: whatwg/html#10873

Bug: 385006131
Change-Id: I624c1ddc8bf550d17307affc8aa6a97544cf0c53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6150170
Reviewed-by: Jean-Philippe Gravel <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1423150}

--

wpt-commits: 5b42b1c845eef3989b4390a0c943099210ee2aad
wpt-pr: 50870
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 5, 2025
…estonly

Automatic update from web-platform-tests
Cleanup Canvas text direction tests

Fix various style issues. And add tests for default, valid and invalid
values. The tests for valid and default values fail because we never
report `inherit`, but report the computed value instead.

A spec issue was filed for the round-tripping of `direction` and it was
resolved to return "inherit" rather than the computed value. See
whatwg/html#10884 and the spec PR at
whatwg/html#10873.

The code will not be changed to pass these tests until the results of
UseCounters have been reviewed to identify how often this change might
affect sites. A search of HTTP Archive did not find failure cases,
mostly because Firefox already returns "inherit" so sites check for
that.

Change-Id: I39645acd997786c22d4983f84a9d17c7b976797b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277644
Reviewed-by: Andres Ricardo Perez <[email protected]>
Commit-Queue: Stephen Chenney <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1425228}

--

wpt-commits: e0a8cfa0bbb879d889e2ddf8b2b4161feb6a2204
wpt-pr: 50969
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 11, 2025
Automatic update from web-platform-tests
Update canvas language tests

Remove the tentative naming for whatwg/html#10873.

And make all the tests verify two languages, because browsers differ in which language they consider the default.
--

wpt-commits: 20365259dffd3f467b695c4ed0d03006fe50ce23
wpt-pr: 51041
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Mar 13, 2025
Automatic update from web-platform-tests
Update canvas language tests

Remove the tentative naming for whatwg/html#10873.

And make all the tests verify two languages, because browsers differ in which language they consider the default.
--

wpt-commits: 20365259dffd3f467b695c4ed0d03006fe50ce23
wpt-pr: 51041
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

7 participants