Bug 1897135 Part 3 - Change two APIs to ensure root frame is a ViewportFrame. r=dholbert
Move `SetRootFrame()` to nsFrameManager.cpp, because in order to compile `mRootFrame = aRootFrame` the compiler requires the full definition of `ViewportFrame` to know that `ViewportFrame` is a subclass of `nsIFrame` Differential Revision: https://phabricator.services.mozilla.com/D210671
This commit is contained in:
@@ -115,6 +115,7 @@
|
||||
#include "mozilla/Try.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/ViewportFrame.h"
|
||||
#include "mozilla/ViewportUtils.h"
|
||||
#include "nsAnimationManager.h"
|
||||
#include "nsAutoLayoutPhase.h"
|
||||
@@ -1766,10 +1767,10 @@ nsresult PresShell::Initialize() {
|
||||
// XXXbz it would be nice to move this somewhere else... like frame manager
|
||||
// Init(), say. But we need to make sure our views are all set up by the
|
||||
// time we do this!
|
||||
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
||||
NS_ASSERTION(!rootFrame, "How did that happen, exactly?");
|
||||
|
||||
if (!rootFrame) {
|
||||
MOZ_ASSERT(!mFrameConstructor->GetRootFrame(),
|
||||
"How did that happen, exactly?");
|
||||
ViewportFrame* rootFrame;
|
||||
{
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
rootFrame = mFrameConstructor->ConstructRootFrame();
|
||||
mFrameConstructor->SetRootFrame(rootFrame);
|
||||
@@ -2458,8 +2459,7 @@ nsIFrame* PresShell::GetRootScrollFrame() const {
|
||||
return nullptr;
|
||||
}
|
||||
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
||||
// Ensure root frame is a viewport frame
|
||||
if (!rootFrame || !rootFrame->IsViewportFrame()) {
|
||||
if (!rootFrame) {
|
||||
return nullptr;
|
||||
}
|
||||
nsIFrame* theFrame = rootFrame->PrincipalChildList().FirstChild();
|
||||
|
||||
Reference in New Issue
Block a user