style: Fix ex computation with more than one operand.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-10 18:10:55 +02:00
parent 826352ab4c
commit 90ee40f43f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 56 additions and 1 deletions

View file

@ -372,7 +372,7 @@ impl CalcNode {
ret.em = Some(ret.em.unwrap_or(0.) + em * factor); ret.em = Some(ret.em.unwrap_or(0.) + em * factor);
} }
FontRelativeLength::Ex(ex) => { FontRelativeLength::Ex(ex) => {
ret.ex = Some(ret.em.unwrap_or(0.) + ex * factor); ret.ex = Some(ret.ex.unwrap_or(0.) + ex * factor);
} }
FontRelativeLength::Ch(ch) => { FontRelativeLength::Ch(ch) => {
ret.ch = Some(ret.ch.unwrap_or(0.) + ch * factor); ret.ch = Some(ret.ch.unwrap_or(0.) + ch * factor);

View file

@ -139305,6 +139305,18 @@
{} {}
] ]
], ],
"css/css-values-3/ex-calc-expression-001.html": [
[
"/css/css-values-3/ex-calc-expression-001.html",
[
[
"/css/css-values-3/ex-calc-expression-001-ref.html",
"=="
]
],
{}
]
],
"css/css-values-3/initial-background-color.html": [ "css/css-values-3/initial-background-color.html": [
[ [
"/css/css-values-3/initial-background-color.html", "/css/css-values-3/initial-background-color.html",
@ -245196,6 +245208,11 @@
{} {}
] ]
], ],
"css/css-values-3/ex-calc-expression-001-ref.html": [
[
{}
]
],
"css/css-values-3/reference/200-200-green.html": [ "css/css-values-3/reference/200-200-green.html": [
[ [
{} {}
@ -528644,6 +528661,14 @@
"f9080ef8e6db6888e9d53b30c36e5a6234ecf0b1", "f9080ef8e6db6888e9d53b30c36e5a6234ecf0b1",
"reftest" "reftest"
], ],
"css/css-values-3/ex-calc-expression-001-ref.html": [
"82d289ca9e58621c22249c5d5517933b3e5a2f82",
"support"
],
"css/css-values-3/ex-calc-expression-001.html": [
"86a53c6f9609456824c134d4c4834669adddae49",
"reftest"
],
"css/css-values-3/iframe/vh-support-transform-origin-iframe.html": [ "css/css-values-3/iframe/vh-support-transform-origin-iframe.html": [
"e295875de4bc58b51c45db9a87648749bdfc7e8d", "e295875de4bc58b51c45db9a87648749bdfc7e8d",
"visual" "visual"

View file

@ -0,0 +1,11 @@
<!doctype html>
<title>CSS Test Reference</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<style>
div {
width: 2ex;
height: 2ex;
background: green;
}
</style>
<div></div>

View file

@ -0,0 +1,19 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: Calc expression using multiple ex operands</title>
<link rel="match" href="ex-calc-expression-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-values/#funcdef-calc">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<style>
/*
This is a regression test for:
https://github.com/servo/servo/pull/18807
https://bugzilla.mozilla.org/show_bug.cgi?id=1407092
*/
div {
width: calc(1ex + 1ex);
height: calc(1ex + 1ex);
background: green;
}
</style>
<div></div>