Skip to content

Commit

Permalink
Resolve font-weight values with CSSLengthResolver
Browse files Browse the repository at this point in the history
This CL adds clamping to [1, 1000] interval as per spec
https://drafts.csswg.org/css-fonts/#font-weight-prop in style builder
converter, as we now resolve calc() there as well.

This CL leaves TODO for interpolation code, as now it resolves
units before interpolation.

Bug: 40946458
Fixed: 386860174
Change-Id: I12092088aa21a001bbcd9ae4241a1dae8ca07825
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6172306
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Commit-Queue: Daniil Sakhapov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1408543}
  • Loading branch information
danielsakhapov authored and chromium-wpt-export-bot committed Jan 20, 2025
1 parent 55e0dc1 commit 1a4683e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions css/css-fonts/font-weight-sign-function.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Fonts test: font-weight with CSS sign() function</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-weight-prop">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
<style>
:root {
font-size: 16px;
}
</style>
<div id="target"></div>
<script>
test_computed_value("font-weight", "calc(sign(1rem - 1px) * 10)", "10");
test_computed_value("font-weight", "calc(sign(1rem - 1px) * -10000)", "1");
test_computed_value("font-weight", "calc(sign(1rem - 1px) * 10000)", "1000");
</script>

0 comments on commit 1a4683e

Please sign in to comment.