Commit f0d679ac authored by Alice Boxhall's avatar Alice Boxhall Committed by Commit Bot

[Devtools] Compute large font threshold correctly for contrast ratio

Bug: 820761
Change-Id: I910fede13345b2159aca28a418887d75e5c2b201
Reviewed-on: https://chromium-review.googlesource.com/958643Reviewed-by: default avatarPaul Irish <paulirish@chromium.org>
Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543261}
parent 3567dcda
...@@ -162,18 +162,7 @@ ColorPicker.ContrastInfo = class extends Common.Object { ...@@ -162,18 +162,7 @@ ColorPicker.ContrastInfo = class extends Common.Object {
const fontSizePx = parseFloat(fontSize.replace('px', '')); const fontSizePx = parseFloat(fontSize.replace('px', ''));
const isBold = (boldWeights.indexOf(fontWeight) !== -1); const isBold = (boldWeights.indexOf(fontWeight) !== -1);
if (bodyFontSize) { const fontSizePt = fontSizePx * 72 / 96;
const bodyFontSizePx = parseFloat(bodyFontSize.replace('px', ''));
if (isBold) {
if (fontSizePx >= (bodyFontSizePx * 1.2))
return true;
} else if (fontSizePx >= (bodyFontSizePx * 1.5)) {
return true;
}
return false;
}
const fontSizePt = Math.ceil(fontSizePx * 72 / 96);
if (isBold) if (isBold)
return fontSizePt >= 14; return fontSizePt >= 14;
else else
......
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