diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -401,16 +401,17 @@ GK_ATOM(handlers, "handlers") GK_ATOM(handlers, "handlers") GK_ATOM(HARD, "HARD") GK_ATOM(hasSameNode, "has-same-node") GK_ATOM(hbox, "hbox") GK_ATOM(head, "head") GK_ATOM(headers, "headers") GK_ATOM(height, "height") GK_ATOM(hidden, "hidden") +GK_ATOM(hiddenfocus, "hiddenfocus") GK_ATOM(hidechrome, "hidechrome") GK_ATOM(highest, "highest") GK_ATOM(horizontal, "horizontal") GK_ATOM(hover, "hover") GK_ATOM(hr, "hr") GK_ATOM(href, "href") GK_ATOM(hreflang, "hreflang") GK_ATOM(hspace, "hspace") diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -296,17 +296,16 @@ nsDocShell::nsDocShell(): mAllowAuth(PR_TRUE), mAllowKeywordFixup(PR_FALSE), mFiredUnloadEvent(PR_FALSE), mEODForCurrentDocument(PR_FALSE), mURIResultedInDocument(PR_FALSE), mIsBeingDestroyed(PR_FALSE), mIsExecutingOnLoadHandler(PR_FALSE), mIsPrintingOrPP(PR_FALSE), - mIsOffScreenBrowser(PR_FALSE), mSavingOldViewer(PR_FALSE), mAppType(nsIDocShell::APP_TYPE_UNKNOWN), mChildOffset(0), mBusyFlags(BUSY_FLAGS_NONE), mMarginWidth(0), mMarginHeight(0), mItemType(typeContent), mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto), @@ -3943,18 +3942,17 @@ nsDocShell::GetVisibility(PRBool * aVisi // if our root view is hidden, we are not visible if (view->GetVisibility() == nsViewVisibility_kHide) { *aVisibility = PR_FALSE; return NS_OK; } // otherwise, we must walk up the document and view trees checking - // for a hidden view, unless we're an off screen browser, which - // would make this test meaningless. + // for a hidden view. nsCOMPtr treeItem = this; nsCOMPtr parentItem; treeItem->GetParent(getter_AddRefs(parentItem)); while (parentItem) { nsCOMPtr docShell(do_QueryInterface(treeItem)); docShell->GetPresShell(getter_AddRefs(presShell)); @@ -3969,19 +3967,17 @@ nsDocShell::GetVisibility(PRBool * aVisi return NS_OK; } nsIContent *shellContent = pPresShell->GetDocument()->FindContentForSubDocument(presShell->GetDocument()); NS_ASSERTION(shellContent, "subshell not in the map"); nsIFrame* frame = pPresShell->GetPrimaryFrameFor(shellContent); - PRBool isDocShellOffScreen = PR_FALSE; - docShell->GetIsOffScreenBrowser(&isDocShellOffScreen); - if (frame && !frame->AreAncestorViewsVisible() && !isDocShellOffScreen) { + if (frame && !frame->AreAncestorViewsVisible()) { *aVisibility = PR_FALSE; return NS_OK; } treeItem = parentItem; treeItem->GetParent(getter_AddRefs(parentItem)); } @@ -3990,30 +3986,16 @@ nsDocShell::GetVisibility(PRBool * aVisi if (!treeOwnerAsWin) { *aVisibility = PR_TRUE; return NS_OK; } // Check with the tree owner as well to give embedders a chance to // expose visibility as well. return treeOwnerAsWin->GetVisibility(aVisibility); -} - -NS_IMETHODIMP -nsDocShell::SetIsOffScreenBrowser(PRBool aIsOffScreen) -{ - mIsOffScreenBrowser = aIsOffScreen; - return NS_OK; -} - -NS_IMETHODIMP -nsDocShell::GetIsOffScreenBrowser(PRBool *aIsOffScreen) -{ - *aIsOffScreen = mIsOffScreenBrowser; - return NS_OK; } NS_IMETHODIMP nsDocShell::SetVisibility(PRBool aVisibility) { if (!mContentViewer) return NS_OK; if (aVisibility) { diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -561,17 +561,16 @@ protected: PRPackedBool mAllowImages; PRPackedBool mFocusDocFirst; PRPackedBool mHasFocus; PRPackedBool mCreatingDocument; // (should be) debugging only PRPackedBool mUseErrorPages; PRPackedBool mObserveErrorPages; PRPackedBool mAllowAuth; PRPackedBool mAllowKeywordFixup; - PRPackedBool mIsOffScreenBrowser; // This boolean is set to true right before we fire pagehide and generally // unset when we embed a new content viewer. While it's true no navigation // is allowed in this docshell. PRPackedBool mFiredUnloadEvent; // this flag is for bug #21358. a docshell may load many urls // which don't result in new documents being created (i.e. a new diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl --- a/docshell/base/nsIDocShell.idl +++ b/docshell/base/nsIDocShell.idl @@ -63,17 +63,17 @@ interface nsISimpleEnumerator; interface nsISimpleEnumerator; interface nsIInputStream; interface nsIRequest; interface nsISHEntry; interface nsILayoutHistoryState; interface nsISecureBrowserUI; interface nsIDOMStorage; -[scriptable, uuid(dc4daea1-b43d-406f-bd62-c2ee879192ad)] +[scriptable, uuid(cf974f45-d2f1-4bd5-aecd-568a1c4da454)] interface nsIDocShell : nsISupports { /** * Loads a given URI. This will give priority to loading the requested URI * in the object implementing this interface. If it can't be loaded here * however, the URL dispatcher will go through its normal process of content * loading. * @@ -458,17 +458,10 @@ interface nsIDocShell : nsISupports */ readonly attribute boolean channelIsUnsafe; /** * Disconnects this docshell's editor from its window, and stores the * editor data in the open document's session history entry. */ [noscript, notxpcom] void DetachEditorFromWindow(); - - /** - * If true, this browser is not visible in the traditional sense, but - * is actively being rendered to the screen (ex. painted on a canvas) - * and should be treated accordingly. - **/ - attribute boolean isOffScreenBrowser; }; diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -3605,16 +3605,30 @@ NS_IMETHODIMP nsFrame::GetOffsetFromView return NS_OK; } /* virtual */ PRBool nsIFrame::AreAncestorViewsVisible() const { for (nsIView* view = GetClosestView(); view; view = view->GetParent()) { if (view->GetVisibility() == nsViewVisibility_kHide) { + // if a hidden view is associated with a deck child with the hiddenfocus + // attribute set to true, then we treat the view as visible. + nsIFrame* frame = static_cast(view->GetClientData()); + if (frame) { + nsIFrame* parentframe = frame->GetParent(); + if (parentframe->GetType() == nsGkAtoms::deckFrame) { + nsIContent* content = frame->GetContent(); + if (content && content->AttrValueIs(kNameSpaceID_None, + nsGkAtoms::hiddenfocus, nsGkAtoms::_true, + eCaseMatters)) + continue; + } + } + return PR_FALSE; } } return PR_TRUE; } nsIWidget* nsIFrame::GetWindow() const