chromium/third_party/blink/renderer/core/css/cssom/css_numeric_value.idl

// Copyright 2017 The Chromium Authors
// 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,LayoutWorklet,PaintWorklet)
] 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(CSSOMString unit);
  [RaisesException, NewObject] CSSMathSum toSum(CSSOMString... units);
  CSSNumericType type();

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