Skip to content

Commit 568135a

Browse files
andypaicuchromium-wpt-export-bot
authored andcommitted
[PEPC] Restrict font-weight and font-style CSS properties
font-weight is restricted to be at least 200 font-style is restricted to only be either 'normal' or 'italic' Bug: 1462930 Change-Id: I5a73de43de965f620d5e77d115e8d53dea80f5e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5335110 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/main@{#1271193}
1 parent 1932994 commit 568135a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<meta charset=utf-8>
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
<body>
6+
<!--The permission element should have some limits for specific properties:
7+
* font-weight is adjusted to be at least 200.
8+
* font-style should only have "normal" or "italic" values.
9+
-->
10+
<style>
11+
#id1 {
12+
font-weight: 100;
13+
font-style: oblique 30deg;
14+
}
15+
#id2 {
16+
font-weight: 300;
17+
font-style: italic;
18+
}
19+
</style>
20+
21+
22+
<permission id="id1" type="geolocation">
23+
<permission id="id2" type="camera">
24+
25+
<script>
26+
test(function(){
27+
var el_outside_bounds = document.getElementById("id1");
28+
assert_equals(getComputedStyle(el_outside_bounds).fontWeight, "200", "font-weight");
29+
assert_equals(getComputedStyle(el_outside_bounds).fontStyle, "normal", "font-style");
30+
}, "Properties with out-of-bounds values should be corrected");
31+
32+
test(function(){
33+
var el_inside_bounds = document.getElementById("id2");
34+
assert_equals(getComputedStyle(el_inside_bounds).fontWeight, "300", "font-weight");
35+
assert_equals(getComputedStyle(el_inside_bounds).fontStyle, "italic", "font-style");
36+
}, "Properties with values in bounds should not be modified");
37+
</script>
38+
</body>

0 commit comments

Comments
 (0)