diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-05-16 17:18:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 17:18:04 +0200 |
commit | db852311451f95679fff9b9bd19c7ce3d624d69c (patch) | |
tree | a8b9793117d86bccd0072d06717dcb4a5d604aa5 /layout | |
parent | f7cf18bfe1201e923e8c341f5ce7f5f083b5e280 (diff) | |
parent | d1184bfb4939e76f3aa442daa90dc5cca3a850e4 (diff) | |
download | UXP-db852311451f95679fff9b9bd19c7ce3d624d69c.tar UXP-db852311451f95679fff9b9bd19c7ce3d624d69c.tar.gz UXP-db852311451f95679fff9b9bd19c7ce3d624d69c.tar.lz UXP-db852311451f95679fff9b9bd19c7ce3d624d69c.tar.xz UXP-db852311451f95679fff9b9bd19c7ce3d624d69c.zip |
Merge pull request #360 from janekptacijarabaci/readview_pageshow_persisted_1
Fix: Reader Mode icon in urlbar is not displayed when close the Reader Mode view
Diffstat (limited to 'layout')
-rw-r--r-- | layout/base/nsDocumentViewer.cpp | 15 | ||||
-rw-r--r-- | layout/base/nsPresContext.cpp | 13 |
2 files changed, 23 insertions, 5 deletions
diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 137efb3cd..7b8734928 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1012,7 +1012,13 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) nsIDocShell *docShell = window->GetDocShell(); NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED); - docShell->GetRestoringDocument(&restoring); + // Unfortunately, docShell->GetRestoringDocument() might no longer be set + // correctly. In particular, it can be false by now if someone took it upon + // themselves to block onload from inside restoration and unblock it later. + // But we can detect the restoring case very simply: by whether our + // document's readyState is COMPLETE. + restoring = (mDocument->GetReadyStateEnum() == + nsIDocument::READYSTATE_COMPLETE); if (!restoring) { NS_ASSERTION(mDocument->IsXULDocument() || // readyState for XUL is bogus mDocument->GetReadyStateEnum() == @@ -1023,6 +1029,13 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) nsIDocument::READYSTATE_UNINITIALIZED && NS_IsAboutBlank(mDocument->GetDocumentURI())), "Bad readystate"); +#ifdef DEBUG + bool docShellThinksWeAreRestoring; + docShell->GetRestoringDocument(&docShellThinksWeAreRestoring); + MOZ_ASSERT(!docShellThinksWeAreRestoring, + "How can docshell think we are restoring if we don't have a " + "READYSTATE_COMPLETE document?"); +#endif // DEBUG nsCOMPtr<nsIDocument> d = mDocument; mDocument->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE); diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 4a54a8432..3106ff386 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1307,10 +1307,15 @@ nsPresContext::SetFullZoom(float aZoom) void nsPresContext::SetOverrideDPPX(float aDPPX) { - mOverrideDPPX = aDPPX; - - if (HasCachedStyleData()) { - MediaFeatureValuesChanged(nsRestyleHint(0), nsChangeHint(0)); + // SetOverrideDPPX is called during navigations, including history + // traversals. In that case, it's typically called with our current value, + // and we don't need to actually do anything. + if (aDPPX != mOverrideDPPX) { + mOverrideDPPX = aDPPX; + + if (HasCachedStyleData()) { + MediaFeatureValuesChanged(nsRestyleHint(0), nsChangeHint(0)); + } } } |