mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-26 19:55:39 +00:00
Bug 1444580: Move OnPageShow / OnPageHide to nsIDocument, devirtualize OnPageHide. r=smaug
MozReview-Commit-ID: HlOpJ8Rg9IG
This commit is contained in:
parent
b6a3264fba
commit
e00ebeda6a
@ -8451,9 +8451,9 @@ nsIDocument::GetContentInThisDocument(nsIFrame* aFrame) const
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DispatchPageTransition(EventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
bool aPersisted)
|
||||
nsIDocument::DispatchPageTransition(EventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
bool aPersisted)
|
||||
{
|
||||
if (!aDispatchTarget) {
|
||||
return;
|
||||
@ -8485,8 +8485,7 @@ NotifyPageShow(nsIDocument* aDocument, void* aData)
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::OnPageShow(bool aPersisted,
|
||||
EventTarget* aDispatchStartTarget)
|
||||
nsIDocument::OnPageShow(bool aPersisted, EventTarget* aDispatchStartTarget)
|
||||
{
|
||||
mVisible = true;
|
||||
|
||||
@ -8527,8 +8526,8 @@ nsDocument::OnPageShow(bool aPersisted,
|
||||
// Dispatch observer notification to notify observers page is shown.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
nsIPrincipal *principal = GetPrincipal();
|
||||
os->NotifyObservers(static_cast<nsIDocument*>(this),
|
||||
nsIPrincipal* principal = NodePrincipal();
|
||||
os->NotifyObservers(this,
|
||||
nsContentUtils::IsSystemPrincipal(principal) ?
|
||||
"chrome-page-shown" :
|
||||
"content-page-shown",
|
||||
@ -8577,16 +8576,15 @@ DispatchFullScreenChange(nsIDocument* aTarget)
|
||||
static void ClearPendingFullscreenRequests(nsIDocument* aDoc);
|
||||
|
||||
void
|
||||
nsDocument::OnPageHide(bool aPersisted,
|
||||
EventTarget* aDispatchStartTarget)
|
||||
nsIDocument::OnPageHide(bool aPersisted, EventTarget* aDispatchStartTarget)
|
||||
{
|
||||
// Send out notifications that our <link> elements are detached,
|
||||
// but only if this is not a full unload.
|
||||
Element* root = GetRootElement();
|
||||
if (aPersisted && root) {
|
||||
RefPtr<nsContentList> links = NS_GetContentList(root,
|
||||
kNameSpaceID_XHTML,
|
||||
NS_LITERAL_STRING("link"));
|
||||
kNameSpaceID_XHTML,
|
||||
NS_LITERAL_STRING("link"));
|
||||
|
||||
uint32_t linkCount = links->Length(true);
|
||||
for (uint32_t i = 0; i < linkCount; ++i) {
|
||||
@ -8618,8 +8616,8 @@ nsDocument::OnPageHide(bool aPersisted,
|
||||
// Dispatch observer notification to notify observers page is hidden.
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
nsIPrincipal* principal = GetPrincipal();
|
||||
os->NotifyObservers(static_cast<nsIDocument*>(this),
|
||||
nsIPrincipal* principal = NodePrincipal();
|
||||
os->NotifyObservers(this,
|
||||
nsContentUtils::IsSystemPrincipal(principal) ?
|
||||
"chrome-page-hidden" :
|
||||
"content-page-hidden",
|
||||
|
@ -205,9 +205,6 @@ public:
|
||||
nsAString& aEncoding,
|
||||
nsAString& Standalone) override;
|
||||
|
||||
virtual void OnPageShow(bool aPersisted, mozilla::dom::EventTarget* aDispatchStartTarget) override;
|
||||
virtual void OnPageHide(bool aPersisted, mozilla::dom::EventTarget* aDispatchStartTarget) override;
|
||||
|
||||
virtual void WillDispatchMutationEvent(nsINode* aTarget) override;
|
||||
virtual void MutationEventDispatched(nsINode* aTarget) override;
|
||||
|
||||
@ -393,10 +390,6 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void DispatchPageTransition(mozilla::dom::EventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
bool aPersisted);
|
||||
|
||||
void UpdateScreenOrientation();
|
||||
|
||||
#define NS_DOCUMENT_NOTIFY_OBSERVERS(func_, params_) do { \
|
||||
|
@ -1406,6 +1406,10 @@ public:
|
||||
mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const;
|
||||
|
||||
protected:
|
||||
void DispatchPageTransition(mozilla::dom::EventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
bool aPersisted);
|
||||
|
||||
// Call this before the document does something that will unbind all content.
|
||||
// That will stop us from doing a lot of work as each element is removed.
|
||||
void DestroyElementMaps();
|
||||
@ -2358,7 +2362,7 @@ public:
|
||||
* document won't be altered.
|
||||
*/
|
||||
virtual void OnPageShow(bool aPersisted,
|
||||
mozilla::dom::EventTarget* aDispatchStartTarget) = 0;
|
||||
mozilla::dom::EventTarget* aDispatchStartTarget);
|
||||
|
||||
/**
|
||||
* Notification that the page has been hidden, for documents which are loaded
|
||||
@ -2372,8 +2376,8 @@ public:
|
||||
* Note: if aDispatchStartTarget isn't null, the showing state of the
|
||||
* document won't be altered.
|
||||
*/
|
||||
virtual void OnPageHide(bool aPersisted,
|
||||
mozilla::dom::EventTarget* aDispatchStartTarget) = 0;
|
||||
void OnPageHide(bool aPersisted,
|
||||
mozilla::dom::EventTarget* aDispatchStartTarget);
|
||||
|
||||
/*
|
||||
* We record the set of links in the document that are relevant to
|
||||
|
Loading…
Reference in New Issue
Block a user