|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef MOZILLA_GEOMETRYUTILS_H_ |
|
7 #define MOZILLA_GEOMETRYUTILS_H_ |
|
8 |
|
9 #include "mozilla/ErrorResult.h" |
|
10 #include "nsTArray.h" |
|
11 #include "nsCOMPtr.h" |
|
12 |
|
13 /** |
|
14 * This file defines utility functions for converting between layout |
|
15 * coordinate systems. |
|
16 */ |
|
17 |
|
18 class nsINode; |
|
19 class nsIDocument; |
|
20 |
|
21 namespace mozilla { |
|
22 |
|
23 namespace dom { |
|
24 struct BoxQuadOptions; |
|
25 struct ConvertCoordinateOptions; |
|
26 class DOMQuad; |
|
27 class DOMRectReadOnly; |
|
28 class DOMPoint; |
|
29 class DOMPointInit; |
|
30 class OwningTextOrElementOrDocument; |
|
31 class TextOrElementOrDocument; |
|
32 } |
|
33 |
|
34 typedef dom::TextOrElementOrDocument GeometryNode; |
|
35 typedef dom::OwningTextOrElementOrDocument OwningGeometryNode; |
|
36 |
|
37 /** |
|
38 * Computes quads for aNode using aOptions, according to GeometryUtils.getBoxQuads. |
|
39 * May set an error in aRv. |
|
40 */ |
|
41 void GetBoxQuads(nsINode* aNode, |
|
42 const dom::BoxQuadOptions& aOptions, |
|
43 nsTArray<nsRefPtr<dom::DOMQuad> >& aResult, |
|
44 ErrorResult& aRv); |
|
45 |
|
46 already_AddRefed<dom::DOMQuad> |
|
47 ConvertQuadFromNode(nsINode* aTo, dom::DOMQuad& aQuad, |
|
48 const GeometryNode& aFrom, |
|
49 const dom::ConvertCoordinateOptions& aOptions, |
|
50 ErrorResult& aRv); |
|
51 |
|
52 already_AddRefed<dom::DOMQuad> |
|
53 ConvertRectFromNode(nsINode* aTo, dom::DOMRectReadOnly& aRect, |
|
54 const GeometryNode& aFrom, |
|
55 const dom::ConvertCoordinateOptions& aOptions, |
|
56 ErrorResult& aRv); |
|
57 |
|
58 already_AddRefed<dom::DOMPoint> |
|
59 ConvertPointFromNode(nsINode* aTo, const dom::DOMPointInit& aPoint, |
|
60 const GeometryNode& aFrom, |
|
61 const dom::ConvertCoordinateOptions& aOptions, |
|
62 ErrorResult& aRv); |
|
63 |
|
64 } |
|
65 |
|
66 #endif /* MOZILLA_GEOMETRYUTILS_H_ */ |