зеркало из https://github.com/mozilla/gecko-dev.git
Bug 791616. Part 2: Add API to ScrollIntoView methods to control whether to scroll in a direction when that direction is not a perceived scrollable direction. r=mats
This commit is contained in:
Родитель
d2389223a9
Коммит
7280df4b6d
|
@ -568,7 +568,8 @@ public:
|
|||
};
|
||||
typedef struct ScrollAxis {
|
||||
int16_t mWhereToScroll;
|
||||
WhenToScroll mWhenToScroll : 16;
|
||||
WhenToScroll mWhenToScroll : 8;
|
||||
bool mOnlyIfPerceivedScrollableDirection : 1;
|
||||
/**
|
||||
* @param aWhere: Either a percentage or a special value.
|
||||
* nsIPresShell defines:
|
||||
|
@ -599,10 +600,17 @@ public:
|
|||
* is visible.
|
||||
* * SCROLL_ALWAYS: Move the frame regardless of its current
|
||||
* visibility.
|
||||
* @param aOnlyIfPerceivedScrollableDirection:
|
||||
* If the direction is not a perceived scrollable direction (i.e.
|
||||
* no scrollbar showing and less than one device pixel of
|
||||
* scrollable distance), don't scroll. Defaults to false.
|
||||
*/
|
||||
ScrollAxis(int16_t aWhere = SCROLL_MINIMUM,
|
||||
WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE) :
|
||||
mWhereToScroll(aWhere), mWhenToScroll(aWhen) {}
|
||||
WhenToScroll aWhen = SCROLL_IF_NOT_FULLY_VISIBLE,
|
||||
bool aOnlyIfPerceivedScrollableDirection = false) :
|
||||
mWhereToScroll(aWhere), mWhenToScroll(aWhen),
|
||||
mOnlyIfPerceivedScrollableDirection(aOnlyIfPerceivedScrollableDirection)
|
||||
{}
|
||||
} ScrollAxis;
|
||||
/**
|
||||
* Scrolls the view of the document so that the primary frame of the content
|
||||
|
|
|
@ -3106,9 +3106,12 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
|
|||
nsPresContext::ScrollbarStyles ss = aScrollFrame->GetScrollbarStyles();
|
||||
nsRect allowedRange(scrollPt, nsSize(0, 0));
|
||||
bool needToScroll = false;
|
||||
uint32_t directions = aScrollFrame->GetPerceivedScrollingDirections();
|
||||
|
||||
if ((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
|
||||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
|
||||
ss.mVertical != NS_STYLE_OVERFLOW_HIDDEN) &&
|
||||
(!aVertical.mOnlyIfPerceivedScrollableDirection ||
|
||||
(directions & nsIScrollableFrame::VERTICAL))) {
|
||||
|
||||
if (ComputeNeedToScroll(aVertical.mWhenToScroll,
|
||||
lineSize.height,
|
||||
|
@ -3129,8 +3132,10 @@ static void ScrollToShowRect(nsIScrollableFrame* aScrollFrame,
|
|||
}
|
||||
}
|
||||
|
||||
if ((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
|
||||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
if (((aFlags & nsIPresShell::SCROLL_OVERFLOW_HIDDEN) ||
|
||||
ss.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN) &&
|
||||
(!aHorizontal.mOnlyIfPerceivedScrollableDirection ||
|
||||
(directions & nsIScrollableFrame::HORIZONTAL))) {
|
||||
|
||||
if (ComputeNeedToScroll(aHorizontal.mWhenToScroll,
|
||||
lineSize.width,
|
||||
|
|
Загрузка…
Ссылка в новой задаче