tor-browser

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

ZoomConstraints.h (2034B)


      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 GFX_ZOOMCONSTRAINTS_H
      8 #define GFX_ZOOMCONSTRAINTS_H
      9 
     10 #include <iosfwd>
     11 
     12 #include "Units.h"                               // for CSSRect, CSSPixel, etc
     13 #include "mozilla/layers/ScrollableLayerGuid.h"  // for ScrollableLayerGuid
     14 
     15 namespace mozilla {
     16 namespace layers {
     17 
     18 struct ZoomConstraints {
     19  bool mAllowZoom;
     20  bool mAllowDoubleTapZoom;
     21  CSSToParentLayerScale mMinZoom;
     22  CSSToParentLayerScale mMaxZoom;
     23 
     24  ZoomConstraints() : mAllowZoom(true), mAllowDoubleTapZoom(true) {
     25    MOZ_COUNT_CTOR(ZoomConstraints);
     26  }
     27 
     28  ZoomConstraints(bool aAllowZoom, bool aAllowDoubleTapZoom,
     29                  const CSSToParentLayerScale& aMinZoom,
     30                  const CSSToParentLayerScale& aMaxZoom)
     31      : mAllowZoom(aAllowZoom),
     32        mAllowDoubleTapZoom(aAllowDoubleTapZoom),
     33        mMinZoom(aMinZoom),
     34        mMaxZoom(aMaxZoom) {
     35    MOZ_COUNT_CTOR(ZoomConstraints);
     36  }
     37 
     38  ZoomConstraints(const ZoomConstraints& other)
     39      : mAllowZoom(other.mAllowZoom),
     40        mAllowDoubleTapZoom(other.mAllowDoubleTapZoom),
     41        mMinZoom(other.mMinZoom),
     42        mMaxZoom(other.mMaxZoom) {
     43    MOZ_COUNT_CTOR(ZoomConstraints);
     44  }
     45 
     46  MOZ_COUNTED_DTOR(ZoomConstraints)
     47 
     48  bool operator==(const ZoomConstraints& other) const {
     49    return mAllowZoom == other.mAllowZoom &&
     50           mAllowDoubleTapZoom == other.mAllowDoubleTapZoom &&
     51           mMinZoom == other.mMinZoom && mMaxZoom == other.mMaxZoom;
     52  }
     53 
     54  bool operator!=(const ZoomConstraints& other) const {
     55    return !(*this == other);
     56  }
     57 
     58  friend std::ostream& operator<<(std::ostream& aStream,
     59                                  const ZoomConstraints& z);
     60 };
     61 
     62 }  // namespace layers
     63 }  // namespace mozilla
     64 
     65 #endif /* GFX_ZOOMCONSTRAINTS_H */