2013-08-24 00:20:07 +04:00
|
|
|
/* -*- 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>
|
2014-09-15 23:30:00 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2014-09-15 23:30:03 +04:00
|
|
|
#include "mozilla/dom/WindowBinding.h"
|
2013-08-24 00:20:07 +04:00
|
|
|
|
|
|
|
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;
|
2014-09-15 23:30:00 +04:00
|
|
|
// Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO,
|
|
|
|
// NS_STYLE_SCROLL_BEHAVIOR_INSTANT, or
|
|
|
|
// NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
|
|
|
|
uint8_t mScrollBehavior;
|
|
|
|
ScrollbarStyles(uint8_t aH, uint8_t aV, uint8_t aB) : mHorizontal(aH),
|
|
|
|
mVertical(aV),
|
|
|
|
mScrollBehavior(aB) {}
|
2013-08-24 00:20:07 +04:00
|
|
|
ScrollbarStyles() {}
|
|
|
|
bool operator==(const ScrollbarStyles& aStyles) const {
|
2014-09-15 23:30:00 +04:00
|
|
|
return aStyles.mHorizontal == mHorizontal && aStyles.mVertical == mVertical &&
|
|
|
|
aStyles.mScrollBehavior == mScrollBehavior;
|
2013-08-24 00:20:07 +04:00
|
|
|
}
|
|
|
|
bool operator!=(const ScrollbarStyles& aStyles) const {
|
2014-09-15 23:30:00 +04:00
|
|
|
return aStyles.mHorizontal != mHorizontal || aStyles.mVertical != mVertical ||
|
|
|
|
aStyles.mScrollBehavior != mScrollBehavior;
|
|
|
|
}
|
2014-09-15 23:30:03 +04:00
|
|
|
bool IsHiddenInBothDirections() const {
|
2014-09-15 23:30:00 +04:00
|
|
|
return mHorizontal == NS_STYLE_OVERFLOW_HIDDEN &&
|
|
|
|
mVertical == NS_STYLE_OVERFLOW_HIDDEN;
|
2013-08-24 00:20:07 +04:00
|
|
|
}
|
2014-09-15 23:30:03 +04:00
|
|
|
bool IsSmoothScroll(dom::ScrollBehavior aBehavior) const {
|
|
|
|
return aBehavior == dom::ScrollBehavior::Smooth ||
|
|
|
|
(aBehavior == dom::ScrollBehavior::Auto &&
|
|
|
|
mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH);
|
|
|
|
}
|
2013-08-24 00:20:07 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|