1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/GeometryUtils.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef MOZILLA_GEOMETRYUTILS_H_ 1.10 +#define MOZILLA_GEOMETRYUTILS_H_ 1.11 + 1.12 +#include "mozilla/ErrorResult.h" 1.13 +#include "nsTArray.h" 1.14 +#include "nsCOMPtr.h" 1.15 + 1.16 +/** 1.17 + * This file defines utility functions for converting between layout 1.18 + * coordinate systems. 1.19 + */ 1.20 + 1.21 +class nsINode; 1.22 +class nsIDocument; 1.23 + 1.24 +namespace mozilla { 1.25 + 1.26 +namespace dom { 1.27 +struct BoxQuadOptions; 1.28 +struct ConvertCoordinateOptions; 1.29 +class DOMQuad; 1.30 +class DOMRectReadOnly; 1.31 +class DOMPoint; 1.32 +class DOMPointInit; 1.33 +class OwningTextOrElementOrDocument; 1.34 +class TextOrElementOrDocument; 1.35 +} 1.36 + 1.37 +typedef dom::TextOrElementOrDocument GeometryNode; 1.38 +typedef dom::OwningTextOrElementOrDocument OwningGeometryNode; 1.39 + 1.40 +/** 1.41 + * Computes quads for aNode using aOptions, according to GeometryUtils.getBoxQuads. 1.42 + * May set an error in aRv. 1.43 + */ 1.44 +void GetBoxQuads(nsINode* aNode, 1.45 + const dom::BoxQuadOptions& aOptions, 1.46 + nsTArray<nsRefPtr<dom::DOMQuad> >& aResult, 1.47 + ErrorResult& aRv); 1.48 + 1.49 +already_AddRefed<dom::DOMQuad> 1.50 +ConvertQuadFromNode(nsINode* aTo, dom::DOMQuad& aQuad, 1.51 + const GeometryNode& aFrom, 1.52 + const dom::ConvertCoordinateOptions& aOptions, 1.53 + ErrorResult& aRv); 1.54 + 1.55 +already_AddRefed<dom::DOMQuad> 1.56 +ConvertRectFromNode(nsINode* aTo, dom::DOMRectReadOnly& aRect, 1.57 + const GeometryNode& aFrom, 1.58 + const dom::ConvertCoordinateOptions& aOptions, 1.59 + ErrorResult& aRv); 1.60 + 1.61 +already_AddRefed<dom::DOMPoint> 1.62 +ConvertPointFromNode(nsINode* aTo, const dom::DOMPointInit& aPoint, 1.63 + const GeometryNode& aFrom, 1.64 + const dom::ConvertCoordinateOptions& aOptions, 1.65 + ErrorResult& aRv); 1.66 + 1.67 +} 1.68 + 1.69 +#endif /* MOZILLA_GEOMETRYUTILS_H_ */