Skip to content

Commit

Permalink
Replace calls to GetDoubleValue for Media Queries parsing
Browse files Browse the repository at this point in the history
Bug: 40946458
Change-Id: I59020d16a477edba85f9ded8caef6c58a9b13c2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5666802
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Commit-Queue: Daniil Sakhapov <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1323686}
  • Loading branch information
danielsakhapov authored and chromium-wpt-export-bot committed Jul 5, 2024
1 parent 54100d5 commit b62a0d3
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 0 deletions.
22 changes: 22 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-001.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
}

@media (width > calc(1px * (1 + sign(16px - 1rem)))) {
div {
background-color: green;
}
}
</style>

<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>
21 changes: 21 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-002.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
}

@media (width > calc(-1px * sign(15px - 1rem))) {
div {
background-color: green;
}
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>
21 changes: 21 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-003.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
}

@media screen and (aspect-ratio > calc(sign(17px - 1rem) * 59) / calc(79 * sign(17px - 1rem))) {
div {
background-color: green;
}
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>
21 changes: 21 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-004.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
}

@media (resolution > calc(-1dppx * sign(17px - 1rem))) {
div {
background-color: green;
}
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>
21 changes: 21 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-005.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: red;
}

@media (grid: calc(2 * sign(16px - 1rem))) {
div {
background-color: green;
}
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>
21 changes: 21 additions & 0 deletions css/mediaqueries/mq-calc-sign-function-006.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<title>Test: support for calc with sign() in Media Queries</title>
<link rel="author" title="Daniil Sakhapov" href="mailto:[email protected]">
<link rel="help" href="http://www.w3.org/TR/css3-values/#calc-notation">
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#units">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
div {
width: 100px;
height: 100px;
background-color: green;
}

@media (grid: calc(2 * sign(17px - 1rem))) {
div {
background-color: red;
}
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div></div>

0 comments on commit b62a0d3

Please sign in to comment.