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

Last change on this file was 291937, checked in by [email protected], 3 years ago

Use unary static_assert
https://bugs.webkit.org/show_bug.cgi?id=238412

Reviewed by Mark Lam.

Source/bmalloc:

  • bmalloc/Algorithm.h:

(bmalloc::isPowerOfTwo):

  • bmalloc/Gigacage.h:
  • bmalloc/IsoHeapImpl.h:

Source/JavaScriptCore:

Replace static_assert(..., ""); with static_assert(...);

  • assembler/ARM64Assembler.h:

(JSC::ARM64Assembler::linkJumpOrCall):
(JSC::ARM64Assembler::relinkJumpOrCall):

  • assembler/AssemblerBuffer.h:

(JSC::AssemblerBuffer::putIntegralUnchecked):

  • assembler/MacroAssemblerCodeRef.h:
  • bytecode/AdaptiveInferredPropertyValueWatchpointBase.h:
  • bytecode/ArrayProfile.h:
  • bytecode/CodeBlockHash.cpp:

(JSC::CodeBlockHash::CodeBlockHash):

  • bytecode/ParseHash.cpp:

(JSC::ParseHash::ParseHash):

  • bytecode/Watchpoint.h:
  • dfg/DFGNode.h:
  • dfg/DFGOperations.cpp:

(JSC::DFG::JSC_DEFINE_JIT_OPERATION):

  • dfg/DFGSpeculativeJIT.cpp:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileArrayPush):

  • jit/RegisterSet.cpp:

(JSC::RegisterSet::llintBaselineCalleeSaveRegisters):
(JSC::RegisterSet::dfgCalleeSaveRegisters):
(JSC::RegisterSet::ftlCalleeSaveRegisters):

  • runtime/CachedBytecode.cpp:

(JSC::CachedBytecode::commitUpdates const):

  • runtime/ClonedArguments.h:
  • runtime/DirectArguments.h:
  • runtime/DirectEvalExecutable.h:
  • runtime/ErrorConstructor.h:
  • runtime/IndirectEvalExecutable.h:
  • runtime/JSArrayBufferView.cpp:
  • runtime/JSBoundFunction.h:
  • runtime/JSLexicalEnvironment.h:

(JSC::JSLexicalEnvironment::subspaceFor):

  • runtime/JSString.cpp:

(JSC::JSRopeString::RopeBuilder<RecordOverflow>::expand):

  • runtime/JSString.h:
  • runtime/NativeFunction.h:
  • runtime/Operations.h:

(JSC::jsString):

  • runtime/RegExpObject.h:
  • runtime/ScopedArguments.h:
  • runtime/ScopedArgumentsTable.cpp:
  • runtime/TypedArrayAdaptors.h:

(JSC::IntegralTypedArrayAdaptor::toJSValue):

  • runtime/TypedArrayType.h:
  • runtime/WeakMapImpl.h:
  • wasm/WasmAirIRGenerator.cpp:

(JSC::Wasm::AirIRGenerator::addCallIndirect):
(JSC::Wasm::AirIRGenerator::emitChecksForModOrDiv):
(JSC::Wasm::AirIRGenerator::emitModOrDiv):

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::Interpreter::DisjunctionContext::allocationSize):
(JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::allocationSize):

Source/WebCore:

  • Modules/entriesapi/FileSystemDirectoryEntry.h:
  • Modules/entriesapi/FileSystemFileEntry.h:
  • css/DOMMatrix.h:
  • cssjit/SelectorCompiler.cpp:

(WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelation):

  • dom/DOMPoint.h:
  • dom/DOMRect.h:
  • html/HTMLAllCollection.h:
  • html/track/AudioTrackList.h:
  • html/track/VideoTrackList.h:
  • layout/formattingContexts/inline/InlineItem.cpp:
  • layout/formattingContexts/inline/InlineTextItem.cpp:
  • platform/KeyedCoding.h:

(WebCore::KeyedDecoder::decodeBytes):

  • xml/XMLHttpRequestEventTarget.h:

Source/WebKit:

  • Shared/API/c/WKContextMenuItem.cpp:
  • UIProcess/mac/LegacySessionStateCoding.cpp:

(WebKit::HistoryEntryDataEncoder::encodeArithmeticType):
(WebKit::HistoryEntryDataDecoder::decodeArithmeticType):

Source/WTF:

  • wtf/CompactPointerTuple.h:
  • wtf/FastMalloc.h:
  • wtf/FunctionTraits.h:

(WTF::slotsForCCallArgument):

  • wtf/Int128.cpp:
  • wtf/MallocPtr.h:
  • wtf/Markable.h:

(WTF::std::underlying_type<EnumType>::type>::max):

  • wtf/PtrTag.h:

(WTF::tagInt):

  • wtf/Seconds.h:
  • wtf/StdLibExtras.h:

(WTF::roundUpToMultipleOf):

  • wtf/SystemFree.h:
  • wtf/UnalignedAccess.h:

(WTF::unalignedLoad):
(WTF::unalignedStore):

  • wtf/UniqueArray.h:

(WTF::makeUniqueArray):

  • wtf/WTFAssertions.cpp:
  • wtf/text/StringConcatenate.h:

(WTF::tryMakeStringFromAdapters):

  • wtf/text/StringImpl.h:
  • wtf/text/SymbolImpl.h:

Tools:

  • TestWebKitAPI/Tests/WTF/EnumTraits.cpp:
  • TestWebKitAPI/Tests/WTF/HashMap.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WTF/Int128.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WTF/Packed.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WTF/RobinHoodHashMap.cpp:

(TestWebKitAPI::TEST):

File size: 5.3 KB
Line 
1/*
2 * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#include "DOMMatrixReadOnly.h"
29
30namespace WebCore {
31
32class ScriptExecutionContext;
33
34class DOMMatrix : public DOMMatrixReadOnly {
35public:
36 static ExceptionOr<Ref<DOMMatrix>> create(ScriptExecutionContext&, std::optional<std::variant<String, Vector<double>>>&&);
37
38 static Ref<DOMMatrix> create(const TransformationMatrix& matrix, Is2D is2D)
39 {
40 return adoptRef(*new DOMMatrix(matrix, is2D));
41 }
42
43 static Ref<DOMMatrix> create(TransformationMatrix&& matrix, Is2D is2D)
44 {
45 return adoptRef(*new DOMMatrix(WTFMove(matrix), is2D));
46 }
47
48 static ExceptionOr<Ref<DOMMatrix>> fromMatrix(DOMMatrixInit&&);
49
50 static ExceptionOr<Ref<DOMMatrix>> fromFloat32Array(Ref<Float32Array>&&);
51 static ExceptionOr<Ref<DOMMatrix>> fromFloat64Array(Ref<Float64Array>&&);
52
53 ExceptionOr<Ref<DOMMatrix>> multiplySelf(DOMMatrixInit&& other);
54 ExceptionOr<Ref<DOMMatrix>> preMultiplySelf(DOMMatrixInit&& other);
55 Ref<DOMMatrix> translateSelf(double tx = 0, double ty = 0, double tz = 0);
56 Ref<DOMMatrix> scaleSelf(double scaleX = 1, std::optional<double> scaleY = std::nullopt, double scaleZ = 1, double originX = 0, double originY = 0, double originZ = 0);
57 Ref<DOMMatrix> scale3dSelf(double scale = 1, double originX = 0, double originY = 0, double originZ = 0);
58 Ref<DOMMatrix> rotateSelf(double rotX = 0, std::optional<double> rotY = std::nullopt, std::optional<double> rotZ = std::nullopt); // Angles are in degrees.
59 Ref<DOMMatrix> rotateFromVectorSelf(double x = 0, double y = 0);
60 Ref<DOMMatrix> rotateAxisAngleSelf(double x = 0, double y = 0, double z = 0, double angle = 0); // Angle is in degrees.
61 Ref<DOMMatrix> skewXSelf(double sx = 0); // Angle is in degrees.
62 Ref<DOMMatrix> skewYSelf(double sy = 0); // Angle is in degrees.
63 Ref<DOMMatrix> invertSelf();
64
65 ExceptionOr<Ref<DOMMatrix>> setMatrixValueForBindings(const String&);
66
67 void setA(double f) { m_matrix.setA(f); }
68 void setB(double f) { m_matrix.setB(f); }
69 void setC(double f) { m_matrix.setC(f); }
70 void setD(double f) { m_matrix.setD(f); }
71 void setE(double f) { m_matrix.setE(f); }
72 void setF(double f) { m_matrix.setF(f); }
73
74 void setM11(double f) { m_matrix.setM11(f); }
75 void setM12(double f) { m_matrix.setM12(f); }
76 void setM13(double f);
77 void setM14(double f);
78 void setM21(double f) { m_matrix.setM21(f); }
79 void setM22(double f) { m_matrix.setM22(f); }
80 void setM23(double f);
81 void setM24(double f);
82 void setM31(double f);
83 void setM32(double f);
84 void setM33(double f);
85 void setM34(double f);
86 void setM41(double f) { m_matrix.setM41(f); }
87 void setM42(double f) { m_matrix.setM42(f); }
88 void setM43(double f);
89 void setM44(double f);
90
91private:
92 DOMMatrix() = default;
93 DOMMatrix(const TransformationMatrix&, Is2D);
94 DOMMatrix(TransformationMatrix&&, Is2D);
95};
96static_assert(sizeof(DOMMatrix) == sizeof(DOMMatrixReadOnly));
97
98inline void DOMMatrix::setM13(double f)
99{
100 m_matrix.setM13(f);
101 if (f)
102 m_is2D = false;
103}
104
105inline void DOMMatrix::setM14(double f)
106{
107 m_matrix.setM14(f);
108 if (f)
109 m_is2D = false;
110}
111
112inline void DOMMatrix::setM23(double f)
113{
114 m_matrix.setM23(f);
115 if (f)
116 m_is2D = false;
117}
118
119inline void DOMMatrix::setM24(double f)
120{
121 m_matrix.setM24(f);
122 if (f)
123 m_is2D = false;
124}
125
126inline void DOMMatrix::setM31(double f)
127{
128 m_matrix.setM31(f);
129 if (f)
130 m_is2D = false;
131}
132
133inline void DOMMatrix::setM32(double f)
134{
135 m_matrix.setM32(f);
136 if (f)
137 m_is2D = false;
138}
139
140inline void DOMMatrix::setM33(double f)
141{
142 m_matrix.setM33(f);
143 if (f != 1)
144 m_is2D = false;
145}
146
147inline void DOMMatrix::setM34(double f)
148{
149 m_matrix.setM34(f);
150 if (f)
151 m_is2D = false;
152}
153
154inline void DOMMatrix::setM43(double f)
155{
156 m_matrix.setM43(f);
157 if (f)
158 m_is2D = false;
159}
160
161inline void DOMMatrix::setM44(double f)
162{
163 m_matrix.setM44(f);
164 if (f != 1)
165 m_is2D = false;
166}
167
168} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.