Commit 171b69ee authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

DCHECK valid unit type in CSSNumericLiteralValue constructor

We should never construct a CSSNumericLiteralValue with kUnknown
unit type. This patch ensures that with a DCHECK.

Bug: 979895
Change-Id: I690259554857c826a4172b4a0c4c30a41ca67774
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1693943
Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#675939}
parent d27ed2f8
......@@ -24,6 +24,7 @@ void CSSNumericLiteralValue::TraceAfterDispatch(blink::Visitor* visitor) {
CSSNumericLiteralValue::CSSNumericLiteralValue(double num, UnitType type)
: CSSPrimitiveValue(kNumericLiteralClass), num_(num) {
DCHECK(std::isfinite(num));
DCHECK_NE(UnitType::kUnknown, type);
numeric_literal_unit_type_ = static_cast<unsigned>(type);
}
......
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