Handle font-weigths with 'bolder' or 'lighter' values in @font-face rules

'bolder' and 'lighter' values are valid keywords for font-weights except
if they are inside @font-face rules. The patch catches such cases.
(http://www.w3.org/TR/css3-fonts/#descdef-font-weight)

R=eae@chromium.org
BUG=410884

Review URL: https://codereview.chromium.org/542713002

git-svn-id: svn://svn.chromium.org/blink/trunk@181412 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent db9ae3da
Test for a crash when a font-weight property in @font-face contains one of the relative 'lighter' or 'bolder' keywords. PASS if Blink does not crash in debug.
<!DOCTYPE html>
<head>
<style>
@font-face {
font-family: firstFace;
src: local("Helvetica");
font-weight: bolder;
}
@font-face {
font-family: secondFace;
src: local("Helvetica");
font-weight: lighter;
}
</style>
<body>
<p>Test for a crash when a font-weight property in @font-face contains one of the relative 'lighter' or 'bolder' keywords.
PASS if Blink does not crash in debug.
</p>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
</body>
\ No newline at end of file
......@@ -443,10 +443,14 @@ FontTraits FontFace::traits() const
case CSSValue200:
weight = FontWeight200;
break;
case CSSValueLighter:
case CSSValue100:
weight = FontWeight100;
break;
// Although 'lighter' and 'bolder' are valid keywords for font-weights, they are invalid
// inside font-face rules so they are ignored. Reference: http://www.w3.org/TR/css3-fonts/#descdef-font-weight.
case CSSValueLighter:
case CSSValueBolder:
break;
default:
ASSERT_NOT_REACHED();
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment