Bug 1855360 - Fix the skip-if syntax. a=bustage-fix
[gecko.git] / widget / TextRecognition.h
blob246c860a88b84eb8f462cba184648fff4878adaa
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_widget_nsTextRecognition__
6 #define mozilla_widget_nsTextRecognition__
8 #include "mozilla/MozPromise.h"
9 #include "mozilla/gfx/Point.h"
10 #include "nsTArray.h"
12 class imgIContainer;
13 namespace mozilla {
15 namespace dom {
16 class ShadowRoot;
17 class TextRecognitionResultOrError;
18 class TextRecognitionResult;
19 } // namespace dom
21 namespace gfx {
22 class SourceSurface;
23 class DataSourceSurface;
24 } // namespace gfx
26 namespace widget {
28 class TextRecognition final {
29 public:
30 using NativePromise = MozPromise<dom::TextRecognitionResult, nsCString,
31 /* IsExclusive = */ true>;
33 TextRecognition() = default;
35 static void FillShadow(dom::ShadowRoot&, const dom::TextRecognitionResult&);
37 static RefPtr<NativePromise> FindText(imgIContainer&,
38 const nsTArray<nsCString>&);
39 static RefPtr<NativePromise> FindText(gfx::DataSourceSurface&,
40 const nsTArray<nsCString>&);
41 static bool IsSupported();
43 protected:
44 // This should be implemented in the OS specific file.
45 static RefPtr<NativePromise> DoFindText(gfx::DataSourceSurface&,
46 const nsTArray<nsCString>&);
48 ~TextRecognition() = default;
51 } // namespace widget
52 } // namespace mozilla
54 #endif