зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656802. In LayoutScrollbars move the calculation of the scrollbar rects to the first thing in the function. r=emilio
There is no dependency in this code as far as I can tell. The next patch needs the scrollbar rects for the scroll corner calculation. Differential Revision: https://phabricator.services.mozilla.com/D85705
This commit is contained in:
Родитель
3f4285b053
Коммит
51578a321e
|
@ -6519,67 +6519,6 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||||
mOuter, false, &compositionSize);
|
mOuter, false, &compositionSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// place the scrollcorner
|
|
||||||
if (mScrollCornerBox || mResizerBox) {
|
|
||||||
MOZ_ASSERT(!mScrollCornerBox || mScrollCornerBox->IsXULBoxFrame(),
|
|
||||||
"Must be a box frame!");
|
|
||||||
|
|
||||||
nsRect r(0, 0, 0, 0);
|
|
||||||
if (aContentArea.x != mScrollPort.x || scrollbarOnLeft) {
|
|
||||||
// scrollbar (if any) on left
|
|
||||||
r.x = aContentArea.x;
|
|
||||||
r.width = mScrollPort.x - aContentArea.x;
|
|
||||||
NS_ASSERTION(r.width >= 0, "Scroll area should be inside client rect");
|
|
||||||
} else {
|
|
||||||
// scrollbar (if any) on right
|
|
||||||
r.width = aContentArea.XMost() - mScrollPort.XMost();
|
|
||||||
r.x = aContentArea.XMost() - r.width;
|
|
||||||
NS_ASSERTION(r.width >= 0, "Scroll area should be inside client rect");
|
|
||||||
}
|
|
||||||
if (aContentArea.y != mScrollPort.y) {
|
|
||||||
NS_ERROR("top scrollbars not supported");
|
|
||||||
} else {
|
|
||||||
// scrollbar (if any) on bottom
|
|
||||||
r.height = aContentArea.YMost() - mScrollPort.YMost();
|
|
||||||
r.y = aContentArea.YMost() - r.height;
|
|
||||||
NS_ASSERTION(r.height >= 0, "Scroll area should be inside client rect");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mScrollCornerBox) {
|
|
||||||
nsBoxFrame::LayoutChildAt(aState, mScrollCornerBox, r);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasResizer) {
|
|
||||||
// if a resizer is present, get its size. Assume a default size of 15
|
|
||||||
// pixels.
|
|
||||||
nscoord defaultSize = nsPresContext::CSSPixelsToAppUnits(15);
|
|
||||||
nsSize resizerMinSize = mResizerBox->GetXULMinSize(aState);
|
|
||||||
|
|
||||||
nscoord vScrollbarWidth =
|
|
||||||
mVScrollbarBox ? mVScrollbarBox->GetXULPrefSize(aState).width
|
|
||||||
: defaultSize;
|
|
||||||
r.width =
|
|
||||||
std::max(std::max(r.width, vScrollbarWidth), resizerMinSize.width);
|
|
||||||
if (aContentArea.x == mScrollPort.x && !scrollbarOnLeft) {
|
|
||||||
r.x = aContentArea.XMost() - r.width;
|
|
||||||
}
|
|
||||||
|
|
||||||
nscoord hScrollbarHeight =
|
|
||||||
mHScrollbarBox ? mHScrollbarBox->GetXULPrefSize(aState).height
|
|
||||||
: defaultSize;
|
|
||||||
r.height =
|
|
||||||
std::max(std::max(r.height, hScrollbarHeight), resizerMinSize.height);
|
|
||||||
if (aContentArea.y == mScrollPort.y) {
|
|
||||||
r.y = aContentArea.YMost() - r.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsBoxFrame::LayoutChildAt(aState, mResizerBox, r);
|
|
||||||
} else if (mResizerBox) {
|
|
||||||
// otherwise lay out the resizer with an empty rectangle
|
|
||||||
nsBoxFrame::LayoutChildAt(aState, mResizerBox, nsRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsPresContext* presContext = mScrolledFrame->PresContext();
|
nsPresContext* presContext = mScrolledFrame->PresContext();
|
||||||
nsRect vRect;
|
nsRect vRect;
|
||||||
if (mVScrollbarBox) {
|
if (mVScrollbarBox) {
|
||||||
|
@ -6642,6 +6581,67 @@ void ScrollFrameHelper::LayoutScrollbars(nsBoxLayoutState& aState,
|
||||||
ScrollDirection::eHorizontal);
|
ScrollDirection::eHorizontal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// place the scrollcorner
|
||||||
|
if (mScrollCornerBox || mResizerBox) {
|
||||||
|
MOZ_ASSERT(!mScrollCornerBox || mScrollCornerBox->IsXULBoxFrame(),
|
||||||
|
"Must be a box frame!");
|
||||||
|
|
||||||
|
nsRect r(0, 0, 0, 0);
|
||||||
|
if (aContentArea.x != mScrollPort.x || scrollbarOnLeft) {
|
||||||
|
// scrollbar (if any) on left
|
||||||
|
r.x = aContentArea.x;
|
||||||
|
r.width = mScrollPort.x - aContentArea.x;
|
||||||
|
NS_ASSERTION(r.width >= 0, "Scroll area should be inside client rect");
|
||||||
|
} else {
|
||||||
|
// scrollbar (if any) on right
|
||||||
|
r.width = aContentArea.XMost() - mScrollPort.XMost();
|
||||||
|
r.x = aContentArea.XMost() - r.width;
|
||||||
|
NS_ASSERTION(r.width >= 0, "Scroll area should be inside client rect");
|
||||||
|
}
|
||||||
|
if (aContentArea.y != mScrollPort.y) {
|
||||||
|
NS_ERROR("top scrollbars not supported");
|
||||||
|
} else {
|
||||||
|
// scrollbar (if any) on bottom
|
||||||
|
r.height = aContentArea.YMost() - mScrollPort.YMost();
|
||||||
|
r.y = aContentArea.YMost() - r.height;
|
||||||
|
NS_ASSERTION(r.height >= 0, "Scroll area should be inside client rect");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mScrollCornerBox) {
|
||||||
|
nsBoxFrame::LayoutChildAt(aState, mScrollCornerBox, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasResizer) {
|
||||||
|
// if a resizer is present, get its size. Assume a default size of 15
|
||||||
|
// pixels.
|
||||||
|
nscoord defaultSize = nsPresContext::CSSPixelsToAppUnits(15);
|
||||||
|
nsSize resizerMinSize = mResizerBox->GetXULMinSize(aState);
|
||||||
|
|
||||||
|
nscoord vScrollbarWidth =
|
||||||
|
mVScrollbarBox ? mVScrollbarBox->GetXULPrefSize(aState).width
|
||||||
|
: defaultSize;
|
||||||
|
r.width =
|
||||||
|
std::max(std::max(r.width, vScrollbarWidth), resizerMinSize.width);
|
||||||
|
if (aContentArea.x == mScrollPort.x && !scrollbarOnLeft) {
|
||||||
|
r.x = aContentArea.XMost() - r.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
nscoord hScrollbarHeight =
|
||||||
|
mHScrollbarBox ? mHScrollbarBox->GetXULPrefSize(aState).height
|
||||||
|
: defaultSize;
|
||||||
|
r.height =
|
||||||
|
std::max(std::max(r.height, hScrollbarHeight), resizerMinSize.height);
|
||||||
|
if (aContentArea.y == mScrollPort.y) {
|
||||||
|
r.y = aContentArea.YMost() - r.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsBoxFrame::LayoutChildAt(aState, mResizerBox, r);
|
||||||
|
} else if (mResizerBox) {
|
||||||
|
// otherwise lay out the resizer with an empty rectangle
|
||||||
|
nsBoxFrame::LayoutChildAt(aState, mResizerBox, nsRect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!LookAndFeel::GetInt(LookAndFeel::IntID::AllowOverlayScrollbarsOverlap)) {
|
if (!LookAndFeel::GetInt(LookAndFeel::IntID::AllowOverlayScrollbarsOverlap)) {
|
||||||
AdjustOverlappingScrollbars(vRect, hRect);
|
AdjustOverlappingScrollbars(vRect, hRect);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче