mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1514679 - Use layers::ScrollDirection instead of boolean. r=botond
Depends on D14713 Differential Revision: https://phabricator.services.mozilla.com/D14714 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
f46451eef5
commit
0a0f595df0
@ -5597,8 +5597,9 @@ void ScrollFrameHelper::UpdatePrevScrolledRect() {
|
||||
|
||||
void ScrollFrameHelper::AdjustScrollbarRectForResizer(
|
||||
nsIFrame* aFrame, nsPresContext* aPresContext, nsRect& aRect,
|
||||
bool aHasResizer, bool aVertical) {
|
||||
if ((aVertical ? aRect.width : aRect.height) == 0) {
|
||||
bool aHasResizer, ScrollDirection aDirection) {
|
||||
if ((aDirection == ScrollDirection::eVertical ? aRect.width : aRect.height) ==
|
||||
0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5623,18 +5624,25 @@ void ScrollFrameHelper::AdjustScrollbarRectForResizer(
|
||||
}
|
||||
|
||||
if (resizerRect.Contains(aRect.BottomRight() - nsPoint(1, 1))) {
|
||||
if (aVertical) {
|
||||
aRect.height = std::max(0, resizerRect.y - aRect.y);
|
||||
} else {
|
||||
aRect.width = std::max(0, resizerRect.x - aRect.x);
|
||||
switch (aDirection) {
|
||||
case ScrollDirection::eVertical:
|
||||
aRect.height = std::max(0, resizerRect.y - aRect.y);
|
||||
break;
|
||||
case ScrollDirection::eHorizontal:
|
||||
aRect.width = std::max(0, resizerRect.x - aRect.x);
|
||||
break;
|
||||
}
|
||||
} else if (resizerRect.Contains(aRect.BottomLeft() + nsPoint(1, -1))) {
|
||||
if (aVertical) {
|
||||
aRect.height = std::max(0, resizerRect.y - aRect.y);
|
||||
} else {
|
||||
nscoord xmost = aRect.XMost();
|
||||
aRect.x = std::max(aRect.x, resizerRect.XMost());
|
||||
aRect.width = xmost - aRect.x;
|
||||
switch (aDirection) {
|
||||
case ScrollDirection::eVertical:
|
||||
aRect.height = std::max(0, resizerRect.y - aRect.y);
|
||||
break;
|
||||
case ScrollDirection::eHorizontal: {
|
||||
nscoord xmost = aRect.XMost();
|
||||
aRect.x = std::max(aRect.x, resizerRect.XMost());
|
||||
aRect.width = xmost - aRect.x;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5756,7 +5764,8 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
mVScrollbarBox->GetXULMargin(margin);
|
||||
vRect.Deflate(margin);
|
||||
}
|
||||
AdjustScrollbarRectForResizer(mOuter, presContext, vRect, hasResizer, true);
|
||||
AdjustScrollbarRectForResizer(mOuter, presContext, vRect, hasResizer,
|
||||
ScrollDirection::eVertical);
|
||||
}
|
||||
|
||||
nsRect hRect;
|
||||
@ -5775,7 +5784,7 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||
hRect.Deflate(margin);
|
||||
}
|
||||
AdjustScrollbarRectForResizer(mOuter, presContext, hRect, hasResizer,
|
||||
false);
|
||||
ScrollDirection::eHorizontal);
|
||||
}
|
||||
|
||||
if (!LookAndFeel::GetInt(LookAndFeel::eIntID_AllowOverlayScrollbarsOverlap)) {
|
||||
|
@ -395,9 +395,9 @@ class ScrollFrameHelper : public nsIReflowCallback {
|
||||
// adjust the scrollbar rectangle aRect to account for any visible resizer.
|
||||
// aHasResizer specifies if there is a content resizer, however this method
|
||||
// will also check if a widget resizer is present as well.
|
||||
void AdjustScrollbarRectForResizer(nsIFrame* aFrame,
|
||||
nsPresContext* aPresContext, nsRect& aRect,
|
||||
bool aHasResizer, bool aVertical);
|
||||
void AdjustScrollbarRectForResizer(
|
||||
nsIFrame* aFrame, nsPresContext* aPresContext, nsRect& aRect,
|
||||
bool aHasResizer, mozilla::layers::ScrollDirection aDirection);
|
||||
// returns true if a resizer should be visible
|
||||
bool HasResizer() { return mResizerBox && !mCollapsedResizer; }
|
||||
void LayoutScrollbars(nsBoxLayoutState& aState, const nsRect& aContentArea,
|
||||
|
Loading…
Reference in New Issue
Block a user