fune/layout/generic/ScrollSnap.h
Daniel Holbert ae192ec3a5 Bug 1613192: Fix non-unified build bustage in layout/{base,generic} directories. r=TYLin
Summary of the changes/reasons:

- LayoutTelemetryTools.h directly uses several types whose headers it needs to
  include. (These includes were present in its .cpp file; I'm migrating them
  from there to the .h file, and I'm adding a new include for "Saturate.h" to
  provide the SaturateUint8 type.)

- LayoutTelemetryTools.cpp needs an include for MainThreadUtils.h, to provide
  NS_IsMainThread().

- StaticPresData.cpp needs an include for ServoUtils.h, to provide
  AssertIsMainThreadOrServoFontMetricsLocked().

- ZoomConstraintsClient.h needs a forward-decl for mozilla::dom::Document since
  it uses a pointer of that type in a function-decl.

- ScrollSnap.h needs forward-decls of nsPoint/nsRect for some references to
  those types in a method signature.

- nsGridContainerFrame.cpp needs an include for nsBoxLayoutState.h since it
  uses that type (it instantiates a nsBoxLayoutState instance).

- nsPlaceholderFrame.cpp needs a "using" decl for the mozilla::dom namespace in
  order to use the un-namespace-prefixed "Element" type.

Differential Revision: https://phabricator.services.mozilla.com/D61603

--HG--
extra : moz-landing-system : lando
2020-02-04 19:34:51 +00:00

45 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layout_ScrollSnap_h_
#define mozilla_layout_ScrollSnap_h_
#include "mozilla/ScrollTypes.h"
#include "mozilla/Maybe.h"
struct nsPoint;
struct nsRect;
namespace mozilla {
namespace layers {
struct ScrollSnapInfo;
}
struct ScrollSnapUtils {
/**
* GetSnapPointForDestination determines which point to snap to after
* scrolling. |aStartPos| gives the position before scrolling and
* |aDestination| gives the position after scrolling, with no snapping.
* Behaviour is dependent on the value of |aUnit|.
* |aSnapInfo| and |aScrollRange| are characteristics of the scroll frame for
* which snapping is being performed.
* If a suitable snap point could be found, it is returned. Otherwise, an
* empty Maybe is returned.
* IMPORTANT NOTE: This function is designed to be called both on and off
* the main thread. If modifying its implementation, be sure
* not to touch main-thread-only data structures without
* appropriate locking.
*/
static mozilla::Maybe<nsPoint> GetSnapPointForDestination(
const layers::ScrollSnapInfo& aSnapInfo, ScrollUnit aUnit,
const nsRect& aScrollRange, const nsPoint& aStartPos,
const nsPoint& aDestination);
};
} // namespace mozilla
#endif // mozilla_layout_ScrollSnap_h_