source: webkit/trunk/Source/WebCore/css/CSSTimingFunctionValue.h

Last change on this file was 278253, checked in by Darin Adler, 4 years ago

Remove WTF::Optional synonym for std::optional, using that class template directly instead
https://bugs.webkit.org/show_bug.cgi?id=226433

Reviewed by Chris Dumez.

Source/JavaScriptCore:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
  • inspector/scripts/codegen/generate_objc_protocol_types_implementation.py:

(ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead
of Optional<>. Also use * instead of value() and nest the definition of the local inside an if
statement in the case where it's an optional.

  • inspector/scripts/tests/expected/*: Regenerated these results.

Source/WebCore:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebCore/PAL:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebDriver:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebKit:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
  • Scripts/webkit/tests: Regenerated expected results, by running the command "python

Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?)

Source/WebKitLegacy/ios:

  • WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename

Optional<> to std::optional<>.

Source/WebKitLegacy/mac:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WebKitLegacy/win:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.

Source/WTF:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
  • wtf/Optional.h: Remove WTF::Optional.

Tools:

  • <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>.
  • Property svn:eol-style set to native
File size: 4.4 KB
Line 
1/*
2 * Copyright (C) 2007, 2008, 2012, 2016 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "CSSValue.h"
29#include "TimingFunction.h"
30
31namespace WebCore {
32
33class CSSCubicBezierTimingFunctionValue final : public CSSValue {
34public:
35 static Ref<CSSCubicBezierTimingFunctionValue> create(double x1, double y1, double x2, double y2)
36 {
37 return adoptRef(*new CSSCubicBezierTimingFunctionValue(x1, y1, x2, y2));
38 }
39
40 String customCSSText() const;
41
42 double x1() const { return m_x1; }
43 double y1() const { return m_y1; }
44 double x2() const { return m_x2; }
45 double y2() const { return m_y2; }
46
47 bool equals(const CSSCubicBezierTimingFunctionValue&) const;
48
49private:
50 CSSCubicBezierTimingFunctionValue(double x1, double y1, double x2, double y2)
51 : CSSValue(CubicBezierTimingFunctionClass)
52 , m_x1(x1)
53 , m_y1(y1)
54 , m_x2(x2)
55 , m_y2(y2)
56 {
57 }
58
59 double m_x1;
60 double m_y1;
61 double m_x2;
62 double m_y2;
63};
64
65class CSSStepsTimingFunctionValue final : public CSSValue {
66public:
67 static Ref<CSSStepsTimingFunctionValue> create(int steps, std::optional<StepsTimingFunction::StepPosition> stepPosition)
68 {
69 return adoptRef(*new CSSStepsTimingFunctionValue(steps, stepPosition));
70 }
71
72 int numberOfSteps() const { return m_steps; }
73 std::optional<StepsTimingFunction::StepPosition> stepPosition() const { return m_stepPosition; }
74
75 String customCSSText() const;
76
77 bool equals(const CSSStepsTimingFunctionValue&) const;
78
79private:
80 CSSStepsTimingFunctionValue(int steps, std::optional<StepsTimingFunction::StepPosition> stepPosition)
81 : CSSValue(StepsTimingFunctionClass)
82 , m_steps(steps)
83 , m_stepPosition(stepPosition)
84 {
85 }
86
87 int m_steps;
88 std::optional<StepsTimingFunction::StepPosition> m_stepPosition;
89};
90
91class CSSSpringTimingFunctionValue final : public CSSValue {
92public:
93 static Ref<CSSSpringTimingFunctionValue> create(double mass, double stiffness, double damping, double initialVelocity)
94 {
95 return adoptRef(*new CSSSpringTimingFunctionValue(mass, stiffness, damping, initialVelocity));
96 }
97
98 double mass() const { return m_mass; }
99 double stiffness() const { return m_stiffness; }
100 double damping() const { return m_damping; }
101 double initialVelocity() const { return m_initialVelocity; }
102
103 String customCSSText() const;
104
105 bool equals(const CSSSpringTimingFunctionValue&) const;
106
107private:
108 CSSSpringTimingFunctionValue(double mass, double stiffness, double damping, double initialVelocity)
109 : CSSValue(SpringTimingFunctionClass)
110 , m_mass(mass)
111 , m_stiffness(stiffness)
112 , m_damping(damping)
113 , m_initialVelocity(initialVelocity)
114 {
115 }
116
117 double m_mass;
118 double m_stiffness;
119 double m_damping;
120 double m_initialVelocity;
121};
122
123} // namespace WebCore
124
125SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSCubicBezierTimingFunctionValue, isCubicBezierTimingFunctionValue())
126SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSStepsTimingFunctionValue, isStepsTimingFunctionValue())
127SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSSpringTimingFunctionValue, isSpringTimingFunctionValue())
Note: See TracBrowser for help on using the repository browser.