summaryrefslogtreecommitdiffstats
path: root/layout/base/ScrollbarStyles.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/base/ScrollbarStyles.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/ScrollbarStyles.h')
-rw-r--r--layout/base/ScrollbarStyles.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/layout/base/ScrollbarStyles.h b/layout/base/ScrollbarStyles.h
new file mode 100644
index 000000000..e6f0c6dde
--- /dev/null
+++ b/layout/base/ScrollbarStyles.h
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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 ScrollbarStyles_h
+#define ScrollbarStyles_h
+
+#include <stdint.h>
+#include "nsStyleConsts.h" // for NS_STYLE_SCROLL_SNAP_*
+#include "nsStyleCoord.h" // for nsStyleCoord
+#include "mozilla/dom/WindowBinding.h"
+
+// Forward declarations
+struct nsStyleDisplay;
+
+namespace mozilla {
+
+struct ScrollbarStyles
+{
+ // Always one of NS_STYLE_OVERFLOW_SCROLL, NS_STYLE_OVERFLOW_HIDDEN,
+ // or NS_STYLE_OVERFLOW_AUTO.
+ uint8_t mHorizontal;
+ uint8_t mVertical;
+ // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
+ // NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
+ uint8_t mScrollBehavior;
+ // Always one of NS_STYLE_SCROLL_SNAP_NONE, NS_STYLE_SCROLL_SNAP_MANDATORY,
+ // or NS_STYLE_SCROLL_SNAP_PROXIMITY.
+ uint8_t mScrollSnapTypeX;
+ uint8_t mScrollSnapTypeY;
+ nsStyleCoord mScrollSnapPointsX;
+ nsStyleCoord mScrollSnapPointsY;
+ nsStyleCoord::CalcValue mScrollSnapDestinationX;
+ nsStyleCoord::CalcValue mScrollSnapDestinationY;
+
+ ScrollbarStyles(uint8_t aH, uint8_t aV)
+ : mHorizontal(aH), mVertical(aV),
+ mScrollBehavior(NS_STYLE_SCROLL_BEHAVIOR_AUTO),
+ mScrollSnapTypeX(NS_STYLE_SCROLL_SNAP_TYPE_NONE),
+ mScrollSnapTypeY(NS_STYLE_SCROLL_SNAP_TYPE_NONE),
+ mScrollSnapPointsX(nsStyleCoord(eStyleUnit_None)),
+ mScrollSnapPointsY(nsStyleCoord(eStyleUnit_None)) {
+
+ mScrollSnapDestinationX.mPercent = 0;
+ mScrollSnapDestinationX.mLength = nscoord(0.0f);
+ mScrollSnapDestinationX.mHasPercent = false;
+ mScrollSnapDestinationY.mPercent = 0;
+ mScrollSnapDestinationY.mLength = nscoord(0.0f);
+ mScrollSnapDestinationY.mHasPercent = false;
+ }
+
+ explicit ScrollbarStyles(const nsStyleDisplay* aDisplay);
+ ScrollbarStyles(uint8_t aH, uint8_t aV, const nsStyleDisplay* aDisplay);
+ ScrollbarStyles() {}
+ bool operator==(const ScrollbarStyles& aStyles) const {
+ return aStyles.mHorizontal == mHorizontal && aStyles.mVertical == mVertical &&
+ aStyles.mScrollBehavior == mScrollBehavior &&
+ aStyles.mScrollSnapTypeX == mScrollSnapTypeX &&
+ aStyles.mScrollSnapTypeY == mScrollSnapTypeY &&
+ aStyles.mScrollSnapPointsX == mScrollSnapPointsX &&
+ aStyles.mScrollSnapPointsY == mScrollSnapPointsY &&
+ aStyles.mScrollSnapDestinationX == mScrollSnapDestinationX &&
+ aStyles.mScrollSnapDestinationY == mScrollSnapDestinationY;
+ }
+ bool operator!=(const ScrollbarStyles& aStyles) const {
+ return !(*this == aStyles);
+ }
+ bool IsHiddenInBothDirections() const {
+ return mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
+ mVertical == NS_STYLE_OVERFLOW_HIDDEN;
+ }
+ bool IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
+ return aBehavior == dom::ScrollBehavior::Smooth ||
+ (aBehavior == dom::ScrollBehavior::Auto &&
+ mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
+ }
+};
+
+} // namespace mozilla
+
+#endif