Commit de932e6e authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

[Code health] Do static_cast in ApplyStandardPropertyValue

Currently at ApplyStandardPropertyValue, we give a double to
FontVariationAxis which is supposed to take a float, and this could cause
float-cast-overflow in corner cases.

This CL does static_cast on the double value before given that to the
FontVariationAxis.

Bug: 900493
Change-Id: Ia4cc4b97bd81296ea1721affead42a2f482b58c0
Reviewed-on: https://chromium-review.googlesource.com/c/1309879Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Xida Chen <xidachen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604292}
parent 1e290717
...@@ -212,7 +212,8 @@ void CSSFontVariationSettingsInterpolationType::ApplyStandardPropertyValue( ...@@ -212,7 +212,8 @@ void CSSFontVariationSettingsInterpolationType::ApplyStandardPropertyValue(
wtf_size_t length = numbers.length(); wtf_size_t length = numbers.length();
for (wtf_size_t i = 0; i < length; ++i) { for (wtf_size_t i = 0; i < length; ++i) {
settings->Append(FontVariationAxis( settings->Append(FontVariationAxis(
tags[i], ToInterpolableNumber(numbers.Get(i))->Value())); tags[i],
static_cast<float>(ToInterpolableNumber(numbers.Get(i))->Value())));
} }
state.GetFontBuilder().SetVariationSettings(settings); state.GetFontBuilder().SetVariationSettings(settings);
} }
......
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