Commit df5ec60e authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Adjust weight ranges in FontDescription::Lighter/BolderWeight

Since the (CSS) parser allows numeric weight values in the range
[1, 1000], adjust the ranges in FontDescription::Lighter/BolderWeight
to match that.
Also factor in that the values can have fractions (by implicitly
truncating them) and simplify the range check since there's now a
set of adjacent intervals in practice.

Bug: 828747
Change-Id: I5fe3405ca45ed8016530d995976e36a6ebbcf366
Reviewed-on: https://chromium-review.googlesource.com/995452Reviewed-by: default avatarDominik Röttsches <drott@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#548448}
parent 61ec932c
...@@ -2911,7 +2911,7 @@ crbug.com/666993 external/wpt/requestidlecallback/callback-idle-periods.html [ T ...@@ -2911,7 +2911,7 @@ crbug.com/666993 external/wpt/requestidlecallback/callback-idle-periods.html [ T
# Crashes with DCHECK enabled, but not on normal Release builds. # Crashes with DCHECK enabled, but not on normal Release builds.
crbug.com/809935 external/wpt/css/css-fonts/variations/font-style-interpolation.html [ Timeout ] crbug.com/809935 external/wpt/css/css-fonts/variations/font-style-interpolation.html [ Timeout ]
crbug.com/828748 external/wpt/css/css-fonts/variations/font-weight-lighter-bolder.html [ Pass Crash Failure ] crbug.com/809956 external/wpt/css/css-fonts/variations/font-weight-lighter-bolder.html [ Failure ]
crbug.com/626703 external/wpt/css/css-ui/text-overflow-011.html [ Failure Crash Pass ] crbug.com/626703 external/wpt/css/css-ui/text-overflow-011.html [ Failure Crash Pass ]
crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout ] crbug.com/626703 external/wpt/workers/opaque-origin.html [ Failure Crash Timeout ]
crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ] crbug.com/626703 external/wpt/html/rendering/non-replaced-elements/margin-collapsing-quirks/multicol-quirks-mode.html [ Pass Crash ]
......
...@@ -114,22 +114,26 @@ bool FontDescription::operator==(const FontDescription& other) const { ...@@ -114,22 +114,26 @@ bool FontDescription::operator==(const FontDescription& other) const {
} }
FontSelectionValue FontDescription::LighterWeight(FontSelectionValue weight) { FontSelectionValue FontDescription::LighterWeight(FontSelectionValue weight) {
if (weight >= FontSelectionValue(100) && weight <= FontSelectionValue(500)) // TODO(fs): Adjust to match table in
// https://drafts.csswg.org/css-fonts-4/#font-weight-prop
if (weight < FontSelectionValue(501))
return FontSelectionValue(100); return FontSelectionValue(100);
if (weight >= FontSelectionValue(600) && weight <= FontSelectionValue(700)) if (weight < FontSelectionValue(701))
return FontSelectionValue(400); return FontSelectionValue(400);
if (weight >= FontSelectionValue(800) && weight <= FontSelectionValue(900)) if (weight <= FontSelectionValue(1000))
return FontSelectionValue(700); return FontSelectionValue(700);
NOTREACHED(); NOTREACHED();
return NormalWeightValue(); return NormalWeightValue();
} }
FontSelectionValue FontDescription::BolderWeight(FontSelectionValue weight) { FontSelectionValue FontDescription::BolderWeight(FontSelectionValue weight) {
if (weight >= FontSelectionValue(100) && weight <= FontSelectionValue(300)) // TODO(fs): Adjust to match table in
// https://drafts.csswg.org/css-fonts-4/#font-weight-prop
if (weight < FontSelectionValue(301))
return FontSelectionValue(400); return FontSelectionValue(400);
if (weight >= FontSelectionValue(400) && weight <= FontSelectionValue(500)) if (weight < FontSelectionValue(501))
return FontSelectionValue(700); return FontSelectionValue(700);
if (weight >= FontSelectionValue(600) && weight <= FontSelectionValue(900)) if (weight <= FontSelectionValue(1000))
return FontSelectionValue(900); return FontSelectionValue(900);
NOTREACHED(); NOTREACHED();
return NormalWeightValue(); return NormalWeightValue();
......
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