Bug 1766305, part 2 - Return a wireframe with GetLayoutHistoryState. r=smaug,mconley
The main goal here is to get the wireframe test to work with parent-controlled navigation. This means we don't need to collect the wireframe any more in PersistLayoutHistoryState, I think, because it is redundant. I think we need to clear the wireframe in finish restore for when we navigate back. As a result of these changes, the two todo subtests in the wireframe test now pass. Differential Revision: https://phabricator.services.mozilla.com/D146252
This commit is contained in:
@@ -11154,32 +11154,41 @@ bool nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
|
||||
return onLocationChangeNeeded;
|
||||
}
|
||||
|
||||
bool nsDocShell::CollectWireframe() {
|
||||
Maybe<Wireframe> nsDocShell::GetWireframe() {
|
||||
const bool collectWireFrame =
|
||||
mozilla::SessionHistoryInParent() &&
|
||||
StaticPrefs::browser_history_collectWireframes() &&
|
||||
mBrowsingContext->IsTopContent() && mActiveEntry;
|
||||
|
||||
if (!collectWireFrame) {
|
||||
return false;
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
RefPtr<Document> doc = mContentViewer->GetDocument();
|
||||
Nullable<Wireframe> wireframe;
|
||||
doc->GetWireframeWithoutFlushing(false, wireframe);
|
||||
if (wireframe.IsNull()) {
|
||||
return Nothing();
|
||||
}
|
||||
return Some(wireframe.Value());
|
||||
}
|
||||
|
||||
bool nsDocShell::CollectWireframe() {
|
||||
Maybe<Wireframe> wireframe = GetWireframe();
|
||||
if (wireframe.isNothing()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
SessionHistoryEntry* entry =
|
||||
mBrowsingContext->Canonical()->GetActiveSessionHistoryEntry();
|
||||
if (entry) {
|
||||
entry->SetWireframe(Some(wireframe.Value()));
|
||||
entry->SetWireframe(wireframe);
|
||||
}
|
||||
} else {
|
||||
mozilla::Unused
|
||||
<< ContentChild::GetSingleton()->SendSessionHistoryEntryWireframe(
|
||||
mBrowsingContext, wireframe.Value());
|
||||
mBrowsingContext, wireframe.ref());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -12113,8 +12122,6 @@ nsDocShell::PersistLayoutHistoryState() {
|
||||
if (scrollRestorationIsManual && layoutState) {
|
||||
layoutState->ResetScrollState();
|
||||
}
|
||||
|
||||
CollectWireframe();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user