// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// CSSNumericValue is the base class for numeric and length typed CSS Values.
// https://drafts.css-houdini.org/css-typed-om/#numeric-objects
typedef (double or CSSNumericValue) CSSNumberish;

[
  Exposed(Window CSSTypedOM, PaintWorklet CSSTypedOM)
] interface CSSNumericValue : CSSStyleValue {
  [RaisesException, NewObject] CSSNumericValue add(CSSNumberish... values);
  [RaisesException, NewObject] CSSNumericValue sub(CSSNumberish... values);
  [RaisesException, NewObject] CSSNumericValue mul(CSSNumberish... values);
  [RaisesException, NewObject] CSSNumericValue div(CSSNumberish... values);
  [RaisesException, NewObject] CSSNumericValue min(CSSNumberish... values);
  [RaisesException, NewObject] CSSNumericValue max(CSSNumberish... values);

  boolean equals(CSSNumberish... values);

  [RaisesException, NewObject] CSSUnitValue to(DOMString unit);
  [RaisesException, NewObject] CSSMathSum toSum(DOMString... units);

  // Putting Exposed=Window in the next line makes |parse| not exposed to PaintWorklet.
  [RaisesException, NewObject, Exposed=Window] static CSSNumericValue parse(DOMString cssText);
};
