Bug 518659. Create nsIDocument::IsActive and IsVisible APIs so we can track HTML5 'active'ness. r=jst

This commit is contained in:
Robert O'Callahan 2009-10-05 17:13:11 +13:00
Родитель db8a0cafd4
Коммит f92a9d3614
3 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -129,6 +129,8 @@ public:
mCompatMode(eCompatibility_FullStandards),
mIsInitialDocumentInWindow(PR_FALSE),
mMayStartLayout(PR_TRUE),
mVisible(PR_TRUE),
mRemovedFromDocShell(PR_FALSE),
// mAllowDNSPrefetch starts true, so that we can always reliably && it
// with various values that might disable it. Since we never prefetch
// unless we get a window, and in that case the docshell value will get
@ -1120,6 +1122,16 @@ public:
* called yet.
*/
PRBool IsShowing() { return mIsShowing; }
/**
* Return whether the document is currently visible (in the sense of
* OnPageHide having been called and OnPageShow not yet having been called)
*/
PRBool IsVisible() { return mVisible; }
/**
* Return true when this document is active, i.e., the active document
* in a content viewer.
*/
PRBool IsActive() { return mDocumentContainer && !mRemovedFromDocShell; }
void RegisterFreezableElement(nsIContent* aContent);
PRBool UnregisterFreezableElement(nsIContent* aContent);
@ -1281,6 +1293,15 @@ protected:
// True iff IsShowing() should be returning true
PRPackedBool mIsShowing;
// True iff the document "page" is not hidden (i.e. currently in the
// bfcache)
PRPackedBool mVisible;
// True if our content viewer has been removed from the docshell
// (it may still be displayed, but in zombie state). Form control data
// has been saved.
PRPackedBool mRemovedFromDocShell;
// True iff DNS prefetch is allowed for this document. Note that if the
// document has no window, DNS prefetch won't be performed no matter what.
PRPackedBool mAllowDNSPrefetch;

Просмотреть файл

@ -1481,8 +1481,7 @@ nsDOMImplementation::Init(nsIURI* aDocumentURI, nsIURI* aBaseURI,
// bother initializing members to 0.
nsDocument::nsDocument(const char* aContentType)
: nsIDocument(),
mVisible(PR_TRUE)
: nsIDocument()
{
mContentType = aContentType;

Просмотреть файл

@ -1171,14 +1171,8 @@ protected:
// True if the document has been detached from its content viewer.
PRPackedBool mIsGoingAway:1;
// True if our content viewer has been removed from the docshell
// (it may still be displayed, but in zombie state). Form control data
// has been saved.
PRPackedBool mRemovedFromDocShell:1;
// True if the document is being destroyed.
PRPackedBool mInDestructor:1;
// True if the document "page" is not hidden
PRPackedBool mVisible:1;
// True if document has ever had script handling object.
PRPackedBool mHasHadScriptHandlingObject:1;