tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GeometryUtils.h (2292B)


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