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

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

Use std::variant instead of WTF::Variant
https://bugs.webkit.org/show_bug.cgi?id=231629

Patch by Alex Christensen <[email protected]> on 2021-10-12
Reviewed by Chris Dumez.

Source/JavaScriptCore:

  • bytecode/StructureStubClearingWatchpoint.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCallDOM):

  • jit/AssemblyHelpers.cpp:

(JSC::AssemblyHelpers::branchIfValue):

  • jit/AssemblyHelpers.h:

(JSC::AssemblyHelpers::branchIfTruthy):
(JSC::AssemblyHelpers::branchIfFalsey):

  • jit/SnippetReg.h:
  • jsc.cpp:
  • parser/Lexer.h:
  • parser/VariableEnvironment.h:
  • runtime/BytecodeCacheError.h:
  • runtime/CachePayload.cpp:

(JSC::CachePayload::CachePayload):

  • runtime/CachePayload.h:
  • runtime/CacheUpdate.h:
  • runtime/ISO8601.cpp:

(JSC::ISO8601::parseTimeZoneBracketedAnnotation):

  • runtime/ISO8601.h:
  • wasm/WasmLLIntGenerator.cpp:

Source/WebCore:

  • Modules/async-clipboard/ClipboardItemBindingsDataSource.h:
  • Modules/cache/DOMCacheEngine.h:
  • Modules/fetch/FetchBody.h:
  • Modules/fetch/FetchBodyOwner.h:
  • Modules/fetch/FetchHeaders.h:
  • Modules/fetch/FetchRequest.h:
  • Modules/fetch/FetchResponse.h:
  • Modules/indexeddb/IDBCursor.h:
  • Modules/indexeddb/IDBDatabase.h:
  • Modules/indexeddb/IDBKey.h:
  • Modules/indexeddb/IDBKeyData.h:
  • Modules/indexeddb/IDBKeyPath.h:
  • Modules/indexeddb/IDBRequest.h:
  • Modules/mediacontrols/MediaControlsHost.cpp:

(WebCore::MediaControlsHost::showMediaControlsContextMenu):

  • Modules/mediacontrols/MediaControlsHost.h:
  • Modules/mediastream/MediaDevices.cpp:

(WebCore::createMediaConstraints):

  • Modules/mediastream/MediaDevices.h:
  • Modules/mediastream/MediaTrackConstraints.h:
  • Modules/mediastream/RTCIceServer.h:
  • Modules/mediastream/RTCPeerConnection.h:
  • Modules/mediastream/RTCRtpTransform.h:
  • Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
  • Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
  • Modules/paymentrequest/PaymentMethodChangeEvent.h:
  • Modules/paymentrequest/PaymentRequest.h:
  • Modules/push-api/PushEventInit.h:
  • Modules/push-api/PushSubscriptionOptionsInit.h:
  • Modules/speech/SpeechRecognitionUpdate.h:
  • Modules/webaudio/AudioContextOptions.h:
  • Modules/webaudio/AudioNode.h:
  • Modules/webxr/WebXRWebGLLayer.h:
  • accessibility/AXObjectCache.h:
  • accessibility/AccessibilityObjectInterface.h:
  • accessibility/isolatedtree/AXIsolatedTree.h:
  • animation/EffectTiming.h:
  • animation/KeyframeEffect.cpp:

(WebCore::KeyframeEffect::create):

  • animation/KeyframeEffect.h:
  • animation/OptionalEffectTiming.h:
  • bindings/IDLTypes.h:
  • bindings/js/BufferSource.h:
  • bindings/js/JSValueInWrappedObject.h:
  • crypto/CryptoAlgorithm.h:
  • crypto/CryptoKey.h:
  • crypto/SubtleCrypto.h:
  • crypto/parameters/CryptoAlgorithmEcdsaParams.h:
  • crypto/parameters/CryptoAlgorithmHkdfParams.h:
  • crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
  • crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
  • crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
  • crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
  • css/CSSCustomPropertyValue.h:
  • css/DOMMatrix.cpp:

(WebCore::DOMMatrix::create):

  • css/DOMMatrix.h:
  • css/DOMMatrixReadOnly.cpp:

(WebCore::DOMMatrixReadOnly::create):

  • css/DOMMatrixReadOnly.h:
  • css/FontFace.h:
  • css/StyleRule.h:
  • css/parser/CSSPropertyParserHelpers.h:
  • css/typedom/CSSNumericValue.h:
  • css/typedom/CSSUnparsedValue.h:
  • dom/Document.h:
  • dom/DocumentMarker.h:
  • dom/Element.cpp:

(WebCore::Element::scrollIntoView):
(WebCore::Element::animate):

  • dom/Element.h:
  • dom/EventTarget.h:
  • dom/MessageEvent.h:
  • dom/Node.h:
  • editing/AlternativeTextController.h:
  • editing/TextCheckingHelper.cpp:

(WebCore::TextCheckingHelper::findFirstMisspelledWordOrUngrammaticalPhrase const):

  • editing/TextCheckingHelper.h:
  • editing/TextManipulationController.h:
  • fileapi/Blob.h:
  • fileapi/FileReader.cpp:

(WebCore::FileReader::result const):

  • fileapi/FileReader.h:
  • fileapi/NetworkSendQueue.h:
  • html/DOMFormData.h:
  • html/HTMLAllCollection.cpp:

(WebCore::HTMLAllCollection::namedOrIndexedItemOrItems const):
(WebCore::HTMLAllCollection::namedItemOrItems const):

  • html/HTMLAllCollection.h:
  • html/HTMLDocument.cpp:

(WebCore::HTMLDocument::namedItem):

  • html/HTMLDocument.h:
  • html/HTMLFormControlsCollection.cpp:

(WebCore::HTMLFormControlsCollection::namedItemOrItems const):

  • html/HTMLFormControlsCollection.h:
  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::namedItem):

  • html/HTMLFormElement.h:
  • html/HTMLMediaElement.h:
  • html/HTMLOptionsCollection.h:
  • html/HTMLSelectElement.h:
  • html/ImageBitmap.h:
  • html/OffscreenCanvas.h:
  • html/URLSearchParams.cpp:

(WebCore::URLSearchParams::create):

  • html/URLSearchParams.h:
  • html/canvas/CanvasRenderingContext2DBase.h:
  • html/canvas/CanvasStyle.h:
  • html/canvas/WebGL2RenderingContext.h:
  • html/canvas/WebGLAny.h:
  • html/canvas/WebGLMultiDraw.h:
  • html/canvas/WebGLRenderingContextBase.h:
  • html/track/TrackEvent.h:
  • html/track/VTTCue.h:
  • inspector/InspectorCanvas.h:
  • inspector/InspectorShaderProgram.h:
  • layout/integration/InlineIteratorBox.h:
  • layout/integration/InlineIteratorLine.h:
  • page/DiagnosticLoggingClient.h:
  • page/IntersectionObserver.h:
  • page/Page.h:
  • page/Performance.h:
  • page/PerformanceMeasureOptions.h:
  • page/PerformanceUserTiming.cpp:

(WebCore::PerformanceUserTiming::convertMarkToTimestamp const):

  • page/PerformanceUserTiming.h:
  • page/scrolling/ScrollingCoordinator.h:
  • platform/PasteboardCustomData.cpp:

(WebCore::copyPlatformData):
(WebCore::PasteboardCustomData::forEachPlatformStringOrBuffer const):

  • platform/PasteboardCustomData.h:
  • platform/SharedBuffer.h:
  • platform/audio/AudioStreamDescription.h:
  • platform/encryptedmedia/CDMProxy.h:
  • platform/graphics/DecodingOptions.h:
  • platform/graphics/FontCascadeDescription.h:
  • platform/graphics/Gradient.h:
  • platform/graphics/InlinePathData.h:
  • platform/graphics/cocoa/SourceBufferParser.h:
  • platform/graphics/cocoa/SourceBufferParserWebM.h:
  • platform/graphics/displaylists/DisplayListResourceHeap.h:
  • platform/mediastream/mac/DisplayCaptureSourceMac.h:
  • platform/mock/MockMediaDevice.h:
  • platform/network/DNS.h:
  • platform/network/FormData.h:
  • platform/sql/SQLValue.h:
  • platform/xr/PlatformXR.h:
  • rendering/RenderBlockFlow.h:
  • testing/TypeConversions.h:
  • workers/SharedWorker.cpp:

(WebCore::SharedWorker::SharedWorker):

  • workers/SharedWorker.h:
  • workers/service/ExtendableMessageEvent.h:
  • workers/service/ServiceWorkerTypes.h:
  • xml/XMLHttpRequest.h:

Source/WebKit:

  • NetworkProcess/NetworkLoadChecker.h:
  • NetworkProcess/cache/NetworkCacheData.h:
  • Platform/IPC/ArgumentCoders.h:

(IPC::VariantCoder::encode):
(IPC::VariantCoder::decode):

  • Platform/IPC/Attachment.h:
  • Platform/IPC/MessageReceiveQueueMap.h:
  • Shared/SessionState.h:
  • Shared/WebCoreArgumentCoders.h:
  • Shared/WebPreferencesStore.h:
  • Shared/mac/MediaFormatReader/MediaSampleCursor.h:
  • UIProcess/API/APIWebAuthenticationPanel.h:
  • UIProcess/API/C/WKMockMediaDevice.cpp:

(WKAddMockMediaDevice):

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
(-[WKWebView _showSafeBrowsingWarningWithURL:title:warning:detailsWithLinks:completionHandler:]):

  • UIProcess/API/Cocoa/WKWebViewInternal.h:
  • UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:

(-[_WKWebAuthenticationPanel makeCredentialWithChallenge:origin:options:completionHandler:]):
(-[_WKWebAuthenticationPanel getAssertionWithChallenge:origin:options:completionHandler:]):

  • UIProcess/Automation/SimulatedInputDispatcher.h:
  • UIProcess/Automation/WebAutomationSession.cpp:

(WebKit::WebAutomationSession::simulateKeyboardInteraction):

  • UIProcess/Automation/WebAutomationSession.h:
  • UIProcess/Automation/ios/WebAutomationSessionIOS.mm:

(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):

  • UIProcess/Automation/mac/WebAutomationSessionMac.mm:

(WebKit::WebAutomationSession::platformSimulateKeyboardInteraction):

  • UIProcess/Cocoa/SOAuthorization/SubFrameSOAuthorizationSession.h:
  • UIProcess/Cocoa/WKSafeBrowsingWarning.h:
  • UIProcess/Cocoa/WKSafeBrowsingWarning.mm:

(-[WKSafeBrowsingWarning initWithFrame:safeBrowsingWarning:completionHandler:]):

  • UIProcess/Cocoa/WebViewImpl.h:
  • UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::showSafeBrowsingWarning):

  • UIProcess/PageClient.h:

(WebKit::PageClient::showSafeBrowsingWarning):

  • UIProcess/ProcessThrottler.h:
  • UIProcess/WebAuthentication/Authenticator.h:
  • UIProcess/WebAuthentication/AuthenticatorManager.cpp:

(WebKit::WebCore::getRpId):
(WebKit::WebCore::getUserName):

  • UIProcess/WebAuthentication/AuthenticatorManager.h:
  • UIProcess/WebAuthentication/WebAuthenticationRequestData.cpp:

(WebKit::getClientDataType):
(WebKit::getUserVerificationRequirement):

  • UIProcess/WebAuthentication/WebAuthenticationRequestData.h:
  • UIProcess/WebAuthentication/WebAuthenticatorCoordinatorProxy.cpp:

(WebKit::WebAuthenticatorCoordinatorProxy::handleRequest):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::receivedPolicyDecision):

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/PageClientImplIOS.h:
  • UIProcess/ios/PageClientImplIOS.mm:

(WebKit::PageClientImpl::showSafeBrowsingWarning):

  • UIProcess/mac/PageClientImplMac.h:
  • UIProcess/mac/PageClientImplMac.mm:

(WebKit::PageClientImpl::showSafeBrowsingWarning):

  • WebAuthnProcess/WebAuthnConnectionToWebProcess.cpp:

(WebKit::WebAuthnConnectionToWebProcess::handleRequest):

  • WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
  • WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:
  • WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:

Source/WebKitLegacy/mac:

  • DOM/DOMHTMLSelectElement.mm:

(-[DOMHTMLSelectElement add:before:]):

Source/WTF:

  • wtf/LikelyDenseUnsignedIntegerSet.h:
  • wtf/SmallSet.h:
  • wtf/text/TextBreakIterator.cpp:

(WTF::mapModeToBackingIterator):

  • wtf/text/TextBreakIterator.h:
  • wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp:

(WTF::mapModeToBackingIterator):

File size: 9.9 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#include "config.h"
27#include "DOMMatrix.h"
28
29#include "ScriptExecutionContext.h"
30#include <JavaScriptCore/Float32Array.h>
31#include <cmath>
32#include <limits>
33
34namespace WebCore {
35
36// https://drafts.fxtf.org/geometry/#dom-dommatrixreadonly-dommatrixreadonly
37ExceptionOr<Ref<DOMMatrix>> DOMMatrix::create(ScriptExecutionContext& scriptExecutionContext, std::optional<std::variant<String, Vector<double>>>&& init)
38{
39 if (!init)
40 return adoptRef(*new DOMMatrix);
41
42 return WTF::switchOn(init.value(),
43 [&scriptExecutionContext](const String& init) -> ExceptionOr<Ref<DOMMatrix>> {
44 if (!scriptExecutionContext.isDocument())
45 return Exception { TypeError };
46
47 auto parseResult = parseStringIntoAbstractMatrix(init);
48 if (parseResult.hasException())
49 return parseResult.releaseException();
50
51 return adoptRef(*new DOMMatrix(parseResult.returnValue().matrix, parseResult.returnValue().is2D ? Is2D::Yes : Is2D::No));
52 },
53 [](const Vector<double>& init) -> ExceptionOr<Ref<DOMMatrix>> {
54 if (init.size() == 6) {
55 return adoptRef(*new DOMMatrix(TransformationMatrix {
56 init[0], init[1], init[2], init[3], init[4], init[5]
57 }, Is2D::Yes));
58 }
59 if (init.size() == 16) {
60 return adoptRef(*new DOMMatrix(TransformationMatrix {
61 init[0], init[1], init[2], init[3],
62 init[4], init[5], init[6], init[7],
63 init[8], init[9], init[10], init[11],
64 init[12], init[13], init[14], init[15]
65 }, Is2D::No));
66 }
67 return Exception { TypeError };
68 }
69 );
70}
71
72DOMMatrix::DOMMatrix(const TransformationMatrix& matrix, Is2D is2D)
73 : DOMMatrixReadOnly(matrix, is2D)
74{
75}
76
77DOMMatrix::DOMMatrix(TransformationMatrix&& matrix, Is2D is2D)
78 : DOMMatrixReadOnly(WTFMove(matrix), is2D)
79{
80}
81
82// https://drafts.fxtf.org/geometry/#create-a-dommatrix-from-the-dictionary
83ExceptionOr<Ref<DOMMatrix>> DOMMatrix::fromMatrix(DOMMatrixInit&& init)
84{
85 return fromMatrixHelper<DOMMatrix>(WTFMove(init));
86}
87
88ExceptionOr<Ref<DOMMatrix>> DOMMatrix::fromFloat32Array(Ref<Float32Array>&& array32)
89{
90 if (array32->length() == 6)
91 return DOMMatrix::create(TransformationMatrix(array32->item(0), array32->item(1), array32->item(2), array32->item(3), array32->item(4), array32->item(5)), Is2D::Yes);
92
93 if (array32->length() == 16) {
94 return DOMMatrix::create(TransformationMatrix(
95 array32->item(0), array32->item(1), array32->item(2), array32->item(3),
96 array32->item(4), array32->item(5), array32->item(6), array32->item(7),
97 array32->item(8), array32->item(9), array32->item(10), array32->item(11),
98 array32->item(12), array32->item(13), array32->item(14), array32->item(15)
99 ), Is2D::No);
100 }
101
102 return Exception { TypeError };
103}
104
105ExceptionOr<Ref<DOMMatrix>> DOMMatrix::fromFloat64Array(Ref<Float64Array>&& array64)
106{
107 if (array64->length() == 6)
108 return DOMMatrix::create(TransformationMatrix(array64->item(0), array64->item(1), array64->item(2), array64->item(3), array64->item(4), array64->item(5)), Is2D::Yes);
109
110 if (array64->length() == 16) {
111 return DOMMatrix::create(TransformationMatrix(
112 array64->item(0), array64->item(1), array64->item(2), array64->item(3),
113 array64->item(4), array64->item(5), array64->item(6), array64->item(7),
114 array64->item(8), array64->item(9), array64->item(10), array64->item(11),
115 array64->item(12), array64->item(13), array64->item(14), array64->item(15)
116 ), Is2D::No);
117 }
118
119 return Exception { TypeError };
120}
121
122// https://drafts.fxtf.org/geometry/#dom-dommatrix-multiplyself
123ExceptionOr<Ref<DOMMatrix>> DOMMatrix::multiplySelf(DOMMatrixInit&& other)
124{
125 auto fromMatrixResult = DOMMatrix::fromMatrix(WTFMove(other));
126 if (fromMatrixResult.hasException())
127 return fromMatrixResult.releaseException();
128 auto otherObject = fromMatrixResult.releaseReturnValue();
129 m_matrix.multiply(otherObject->m_matrix);
130 if (!otherObject->is2D())
131 m_is2D = false;
132 return Ref<DOMMatrix> { *this };
133}
134
135// https://drafts.fxtf.org/geometry/#dom-dommatrix-premultiplyself
136ExceptionOr<Ref<DOMMatrix>> DOMMatrix::preMultiplySelf(DOMMatrixInit&& other)
137{
138 auto fromMatrixResult = DOMMatrix::fromMatrix(WTFMove(other));
139 if (fromMatrixResult.hasException())
140 return fromMatrixResult.releaseException();
141 auto otherObject = fromMatrixResult.releaseReturnValue();
142 m_matrix = otherObject->m_matrix * m_matrix;
143 if (!otherObject->is2D())
144 m_is2D = false;
145 return Ref<DOMMatrix> { *this };
146}
147
148// https://drafts.fxtf.org/geometry/#dom-dommatrix-translateself
149Ref<DOMMatrix> DOMMatrix::translateSelf(double tx, double ty, double tz)
150{
151 m_matrix.translate3d(tx, ty, tz);
152 if (tz)
153 m_is2D = false;
154 return *this;
155}
156
157// https://drafts.fxtf.org/geometry/#dom-dommatrix-scaleself
158Ref<DOMMatrix> DOMMatrix::scaleSelf(double scaleX, std::optional<double> scaleY, double scaleZ, double originX, double originY, double originZ)
159{
160 if (!scaleY)
161 scaleY = scaleX;
162 translateSelf(originX, originY, originZ);
163 // Post-multiply a non-uniform scale transformation on the current matrix.
164 // The 3D scale matrix is described in CSS Transforms with sx = scaleX, sy = scaleY and sz = scaleZ.
165 m_matrix.scale3d(scaleX, scaleY.value(), scaleZ);
166 translateSelf(-originX, -originY, -originZ);
167 if (scaleZ != 1 || originZ)
168 m_is2D = false;
169 return *this;
170}
171
172// https://drafts.fxtf.org/geometry/#dom-dommatrix-scale3dself
173Ref<DOMMatrix> DOMMatrix::scale3dSelf(double scale, double originX, double originY, double originZ)
174{
175 translateSelf(originX, originY, originZ);
176 // Post-multiply a uniform 3D scale transformation (m11 = m22 = m33 = scale) on the current matrix.
177 // The 3D scale matrix is described in CSS Transforms with sx = sy = sz = scale. [CSS3-TRANSFORMS]
178 m_matrix.scale3d(scale, scale, scale);
179 translateSelf(-originX, -originY, -originZ);
180 if (scale != 1)
181 m_is2D = false;
182 return *this;
183}
184
185// https://drafts.fxtf.org/geometry/#dom-dommatrix-rotateself
186Ref<DOMMatrix> DOMMatrix::rotateSelf(double rotX, std::optional<double> rotY, std::optional<double> rotZ)
187{
188 if (!rotY && !rotZ) {
189 rotZ = rotX;
190 rotX = 0;
191 rotY = 0;
192 }
193 m_matrix.rotate3d(rotX, rotY.value_or(0), rotZ.value_or(0));
194 if (rotX || rotY.value_or(0))
195 m_is2D = false;
196 return *this;
197}
198
199// https://drafts.fxtf.org/geometry/#dom-dommatrix-rotatefromvectorself
200Ref<DOMMatrix> DOMMatrix::rotateFromVectorSelf(double x, double y)
201{
202 m_matrix.rotateFromVector(x, y);
203 return *this;
204}
205
206// https://drafts.fxtf.org/geometry/#dom-dommatrix-rotateaxisangleself
207Ref<DOMMatrix> DOMMatrix::rotateAxisAngleSelf(double x, double y, double z, double angle)
208{
209 m_matrix.rotate3d(x, y, z, angle);
210 if (x || y)
211 m_is2D = false;
212 return *this;
213}
214
215// https://drafts.fxtf.org/geometry/#dom-dommatrix-skewxself
216Ref<DOMMatrix> DOMMatrix::skewXSelf(double sx)
217{
218 m_matrix.skewX(sx);
219 return *this;
220}
221
222// https://drafts.fxtf.org/geometry/#dom-dommatrix-skewyself
223Ref<DOMMatrix> DOMMatrix::skewYSelf(double sy)
224{
225 m_matrix.skewY(sy);
226 return *this;
227}
228
229// https://drafts.fxtf.org/geometry/#dom-dommatrix-invertself
230Ref<DOMMatrix> DOMMatrix::invertSelf()
231{
232 auto inverse = m_matrix.inverse();
233 if (inverse)
234 m_matrix = *inverse;
235 else {
236 m_matrix.setMatrix(
237 std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(),
238 std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(),
239 std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(),
240 std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()
241 );
242 m_is2D = false;
243 }
244 return Ref<DOMMatrix> { *this };
245}
246
247ExceptionOr<Ref<DOMMatrix>> DOMMatrix::setMatrixValueForBindings(const String& string)
248{
249 auto result = setMatrixValue(string);
250 if (result.hasException())
251 return result.releaseException();
252 return Ref<DOMMatrix> { *this };
253}
254
255} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.