-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not simplify calc(0px + 0%) into 0px
Currently, when we create |Length| from calc(), and then create a CSSPrimitiveValue from that |Length|, we may drop the percentage part if it's zero. As discussed at w3c/csswg-drafts#3482, zero percentages in calcs should be preserved. Hence, this part ensures that percentage is perserved in calc(0px + 0%) Note: we may want to preserve 0% in all cases, but that leads to many test failures, so we leave the investigation to future instead. This is also preparation for crrev.com/c/1777025, which switches the implementation of InterpolableLength to a math expression to support min/max. Bug: 991672 Change-Id: I386f42a323079cce3d6ee545fa00ef289406e8bf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779721 Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#693437}
- Loading branch information
1 parent
95a99b8
commit 80cac28
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
third_party/blink/web_tests/external/wpt/css/css-values/calc-zero-percent-height.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<link rel="help" href="https://www.w3.org/TR/css-values-4/#calc-computed-value"> | ||
<link rel="help" href="https://www.w3.org/TR/CSS2/visudet.html#the-height-property"> | ||
<link rel="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org"> | ||
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> | ||
<title>0% in calc() should be preserved</title> | ||
<script> | ||
CSS.registerProperty({ | ||
name: '--custom-height', | ||
syntax: '<length-percentage>', | ||
initialValue: 'calc(0% + 0px)', | ||
inherits: false | ||
}); | ||
</script> | ||
<style> | ||
.height-filler { | ||
height: 100px; | ||
} | ||
|
||
.test { | ||
width: 100px; | ||
height: var(--custom-height); | ||
background-color: green; | ||
} | ||
</style> | ||
<p>Test passes if there is a filled green square.</p> | ||
<div class="test"> | ||
<div class="height-filler"> | ||
</div> | ||
</div> |