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

Partially fix calc() length unit handling in media queries #17775

merged 1 commit into from Jul 11, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

Partially fix calc() length unit handling in media queries

When a calc() length is passed to media queries, the current code
assumes that there's always a DoubleValue(), and the unit type matches
TypeWithCalcResolved(), which is incorrect.

This patch partially fixes the issue when the calc expression can be
resolved without type conversion. Handling type conversion is more
complicated and hence left broken by this patch (as it's already broken).

Bug: 982542
Change-Id: I258b3d1aeec69fb65fbadd86981e97974239289b
Reviewed-by: Emil A Eklund <>
Commit-Queue: Xiaocheng Hu <>
Cr-Commit-Position: refs/heads/master@{#676452}
  • Loading branch information
xiaochengh authored and chromium-wpt-export-bot committed Jul 11, 2019
commit 56bd2325c6eb1515cafa3c60934bec3e4126723a
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<link rel="author" title="Xiaocheng Hu" href="">
<link rel="help" href="">
<link rel="help" href="">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<meta name="assert" content="The 'in' unit used in calc is not mistaken as 'px'.">
p { font-size: 16px; }
#target {
width: 100px;
height: 100px;
background-color: green;
@media (min-width: calc(100in)) {
/* Should not be selected */
#target { background-color: red }
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id=target></div>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.