summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/css/cssom/css_skew.h
blob: 9fddbe914714fe81413d6002345e62b59b3c313b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2016 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.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSS_SKEW_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_CSSOM_CSS_SKEW_H_

#include "base/macros.h"
#include "third_party/blink/renderer/core/css/cssom/css_numeric_value.h"
#include "third_party/blink/renderer/core/css/cssom/css_transform_component.h"

namespace blink {

class DOMMatrix;
class ExceptionState;

// Represents a skew value in a CSSTransformValue used for properties like
// "transform".
// See CSSSkew.idl for more information about this class.
class CORE_EXPORT CSSSkew final : public CSSTransformComponent {
  DEFINE_WRAPPERTYPEINFO();

 public:
  // Constructor defined in the IDL.
  static CSSSkew* Create(CSSNumericValue*, CSSNumericValue*, ExceptionState&);
  static CSSSkew* Create(CSSNumericValue* ax, CSSNumericValue* ay) {
    return MakeGarbageCollected<CSSSkew>(ax, ay);
  }

  // Internal ways of creating CSSSkew.
  static CSSSkew* FromCSSValue(const CSSFunctionValue&);

  CSSSkew(CSSNumericValue* ax, CSSNumericValue* ay);

  // Getters and setters for the ax and ay attributes defined in the IDL.
  CSSNumericValue* ax() { return ax_.Get(); }
  CSSNumericValue* ay() { return ay_.Get(); }
  void setAx(CSSNumericValue*, ExceptionState&);
  void setAy(CSSNumericValue*, ExceptionState&);

  // From CSSTransformComponent
  // Setting is2D for CSSSkew does nothing.
  // https://drafts.css-houdini.org/css-typed-om/#dom-cssskew-is2d
  void setIs2D(bool is2D) final {}

  DOMMatrix* toMatrix(ExceptionState&) const final;

  // Internal methods - from CSSTransformComponent.
  TransformComponentType GetType() const override { return kSkewType; }
  const CSSFunctionValue* ToCSSValue() const override;

  void Trace(blink::Visitor* visitor) override {
    visitor->Trace(ax_);
    visitor->Trace(ay_);
    CSSTransformComponent::Trace(visitor);
  }

 private:
  Member<CSSNumericValue> ax_;
  Member<CSSNumericValue> ay_;
  DISALLOW_COPY_AND_ASSIGN(CSSSkew);
};

}  // namespace blink

#endif