зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1501665 Part 7: Add a new function to allow visual viewport size to be un-set. r=smaug
Once nsIPresShell::SetVisualViewportSize is called, we currently have no way to restore the default viewport sizing behavior. This corrects that. We need the default behavior to get correctly-placed scrollbars when turning off meta viewport handling in Responsive Design Mode panes. Differential Revision: https://phabricator.services.mozilla.com/D20593 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
046007b94f
Коммит
1e6b91bfc7
|
@ -10627,15 +10627,8 @@ void nsIPresShell::MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty) {
|
|||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
||||
if (!mVisualViewportSizeSet || mVisualViewportSize.width != aWidth ||
|
||||
mVisualViewportSize.height != aHeight) {
|
||||
mVisualViewportSizeSet = true;
|
||||
mVisualViewportSize.width = aWidth;
|
||||
mVisualViewportSize.height = aHeight;
|
||||
|
||||
if (nsIScrollableFrame* rootScrollFrame =
|
||||
GetRootScrollFrameAsScrollable()) {
|
||||
void nsIPresShell::CompleteChangeToVisualViewportSize() {
|
||||
if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
|
||||
rootScrollFrame->MarkScrollbarsDirtyForReflow();
|
||||
}
|
||||
MarkFixedFramesForReflow(nsIPresShell::eResize);
|
||||
|
@ -10644,12 +10637,31 @@ void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
|||
window->VisualViewport()->PostResizeEvent();
|
||||
}
|
||||
|
||||
if (nsIScrollableFrame* rootScrollFrame =
|
||||
GetRootScrollFrameAsScrollable()) {
|
||||
if (nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable()) {
|
||||
ScrollAnchorContainer* container = rootScrollFrame->Anchor();
|
||||
container->UserScrolled();
|
||||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
||||
if (!mVisualViewportSizeSet || mVisualViewportSize.width != aWidth ||
|
||||
mVisualViewportSize.height != aHeight) {
|
||||
mVisualViewportSizeSet = true;
|
||||
mVisualViewportSize.width = aWidth;
|
||||
mVisualViewportSize.height = aHeight;
|
||||
|
||||
CompleteChangeToVisualViewportSize();
|
||||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::ResetVisualViewportSize() {
|
||||
if (mVisualViewportSizeSet) {
|
||||
mVisualViewportSizeSet = false;
|
||||
mVisualViewportSize.width = 0;
|
||||
mVisualViewportSize.height = 0;
|
||||
|
||||
CompleteChangeToVisualViewportSize();
|
||||
}
|
||||
}
|
||||
|
||||
bool nsIPresShell::SetVisualViewportOffset(
|
||||
|
|
|
@ -1654,6 +1654,7 @@ class nsIPresShell : public nsStubDocumentObserver {
|
|||
static void ClearMouseCapture(nsIFrame* aFrame);
|
||||
|
||||
void SetVisualViewportSize(nscoord aWidth, nscoord aHeight);
|
||||
void ResetVisualViewportSize();
|
||||
bool IsVisualViewportSizeSet() { return mVisualViewportSizeSet; }
|
||||
nsSize GetVisualViewportSize() {
|
||||
NS_ASSERTION(mVisualViewportSizeSet,
|
||||
|
@ -1661,6 +1662,10 @@ class nsIPresShell : public nsStubDocumentObserver {
|
|||
return mVisualViewportSize;
|
||||
}
|
||||
|
||||
// This function handles all the work after VisualViewportSize is set
|
||||
// or reset.
|
||||
void CompleteChangeToVisualViewportSize();
|
||||
|
||||
/**
|
||||
* The return value indicates whether the offset actually changed.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче