зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1645954. Don't use a stale value of mScrollPort during scrollframe reflow while still determining the new value of mScrollPort. r=tnikkel
Also, adjust for scrollbars and resolution correctly. Differential Revision: https://phabricator.services.mozilla.com/D79778
This commit is contained in:
Родитель
f66f5a235e
Коммит
8349c27e4a
|
@ -8701,14 +8701,16 @@ nsMargin nsLayoutUtils::ScrollbarAreaToExcludeFromCompositionBoundsFor(
|
|||
|
||||
/* static */
|
||||
nsSize nsLayoutUtils::CalculateCompositionSizeForFrame(
|
||||
nsIFrame* aFrame, bool aSubtractScrollbars) {
|
||||
nsIFrame* aFrame, bool aSubtractScrollbars,
|
||||
const nsSize* aOverrideScrollPortSize) {
|
||||
// If we have a scrollable frame, restrict the composition bounds to its
|
||||
// scroll port. The scroll port excludes the frame borders and the scroll
|
||||
// bars, which we don't want to be part of the composition bounds.
|
||||
nsIScrollableFrame* scrollableFrame = aFrame->GetScrollTargetFrame();
|
||||
nsRect rect = scrollableFrame ? scrollableFrame->GetScrollPortRect()
|
||||
: aFrame->GetRect();
|
||||
nsSize size = rect.Size();
|
||||
nsSize size =
|
||||
aOverrideScrollPortSize ? *aOverrideScrollPortSize : rect.Size();
|
||||
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
PresShell* presShell = presContext->PresShell();
|
||||
|
|
|
@ -2706,7 +2706,8 @@ class nsLayoutUtils {
|
|||
* are likely to need special-case handling of the RCD-RSF.
|
||||
*/
|
||||
static nsSize CalculateCompositionSizeForFrame(
|
||||
nsIFrame* aFrame, bool aSubtractScrollbars = true);
|
||||
nsIFrame* aFrame, bool aSubtractScrollbars = true,
|
||||
const nsSize* aOverrideScrollPortSize = nullptr);
|
||||
|
||||
/**
|
||||
* Calculate the composition size for the root scroll frame of the root
|
||||
|
|
|
@ -464,14 +464,16 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput* aState,
|
|||
nsSize visualViewportSize = scrollPortSize;
|
||||
mozilla::PresShell* presShell = PresShell();
|
||||
if (mHelper.mIsRoot && presShell->IsVisualViewportSizeSet()) {
|
||||
nsSize compositionSize =
|
||||
nsLayoutUtils::CalculateCompositionSizeForFrame(this, false);
|
||||
visualViewportSize = nsLayoutUtils::CalculateCompositionSizeForFrame(
|
||||
this, false, &layoutSize);
|
||||
|
||||
visualViewportSize = nsSize(
|
||||
std::max(0, visualViewportSize.width - vScrollbarDesiredWidth),
|
||||
std::max(0, visualViewportSize.height - hScrollbarDesiredHeight));
|
||||
|
||||
float resolution = presShell->GetResolution();
|
||||
compositionSize.width /= resolution;
|
||||
compositionSize.height /= resolution;
|
||||
visualViewportSize =
|
||||
nsSize(std::max(0, compositionSize.width - vScrollbarDesiredWidth),
|
||||
std::max(0, compositionSize.height - hScrollbarDesiredHeight));
|
||||
visualViewportSize.width /= resolution;
|
||||
visualViewportSize.height /= resolution;
|
||||
}
|
||||
|
||||
nsRect overflowRect = aState->mContentsOverflowAreas.ScrollableOverflow();
|
||||
|
|
Загрузка…
Ссылка в новой задаче