зеркало из https://github.com/mozilla/gecko-dev.git
Bug 288873. Don't let nsSubDocumentFrame tear down a presentation it didn't build. r+sr=bzbarsky,a=asa.
This commit is contained in:
Родитель
596fb50b2f
Коммит
4ab8153bb1
|
@ -2643,6 +2643,9 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
|
||||||
void
|
void
|
||||||
nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
|
if (!mDocument)
|
||||||
|
return;
|
||||||
|
|
||||||
// Hold onto old target content through the event and reset after.
|
// Hold onto old target content through the event and reset after.
|
||||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||||
|
|
||||||
|
@ -2652,6 +2655,12 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
||||||
// Get the target content target (mousemove target == mouseover target)
|
// Get the target content target (mousemove target == mouseover target)
|
||||||
nsCOMPtr<nsIContent> targetElement;
|
nsCOMPtr<nsIContent> targetElement;
|
||||||
GetEventTargetContent(aEvent, getter_AddRefs(targetElement));
|
GetEventTargetContent(aEvent, getter_AddRefs(targetElement));
|
||||||
|
if (!targetElement) {
|
||||||
|
// We're always over the document root, even if we're only
|
||||||
|
// over dead space in a page (whose frame is not associated with
|
||||||
|
// any content) or in print preview dead space
|
||||||
|
targetElement = mDocument->GetRootContent();
|
||||||
|
}
|
||||||
NS_ASSERTION(targetElement, "Mouse move must have some target content");
|
NS_ASSERTION(targetElement, "Mouse move must have some target content");
|
||||||
if (targetElement) {
|
if (targetElement) {
|
||||||
NotifyMouseOver(aEvent, targetElement);
|
NotifyMouseOver(aEvent, targetElement);
|
||||||
|
|
|
@ -1652,7 +1652,8 @@ DocumentViewerImpl::Hide(void)
|
||||||
// right now returning from print and the layout frame that was
|
// right now returning from print and the layout frame that was
|
||||||
// created for this document is being destroyed. In such a case we
|
// created for this document is being destroyed. In such a case we
|
||||||
// ignore the Hide() call.
|
// ignore the Hide() call.
|
||||||
|
// XXX The above statement is a lie. We do not check our parents.
|
||||||
|
// in fact it always returns false for subdocuments.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1663,7 +1664,8 @@ DocumentViewerImpl::Hide(void)
|
||||||
// we're right now returning from print preview and the layout
|
// we're right now returning from print preview and the layout
|
||||||
// frame that was created for this document is being destroyed. In
|
// frame that was created for this document is being destroyed. In
|
||||||
// such a case we ignore the Hide() call.
|
// such a case we ignore the Hide() call.
|
||||||
|
// XXX The above statement is a lie. We do not check our parents.
|
||||||
|
// in fact it always returns false for subdocuments.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3376,6 +3378,7 @@ DocumentViewerImpl::GetGlobalPrintSettings(nsIPrintSettings * *aGlobalPrintSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute boolean doingPrint; */
|
/* readonly attribute boolean doingPrint; */
|
||||||
|
// XXX This always returns PR_FALSE for subdocuments
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetDoingPrint(PRBool *aDoingPrint)
|
DocumentViewerImpl::GetDoingPrint(PRBool *aDoingPrint)
|
||||||
{
|
{
|
||||||
|
@ -3384,6 +3387,7 @@ DocumentViewerImpl::GetDoingPrint(PRBool *aDoingPrint)
|
||||||
|
|
||||||
*aDoingPrint = PR_FALSE;
|
*aDoingPrint = PR_FALSE;
|
||||||
if (mPrintEngine) {
|
if (mPrintEngine) {
|
||||||
|
// XXX shouldn't this be GetDoingPrint() ?
|
||||||
return mPrintEngine->GetDoingPrintPreview(aDoingPrint);
|
return mPrintEngine->GetDoingPrintPreview(aDoingPrint);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -3393,6 +3397,7 @@ DocumentViewerImpl::GetDoingPrint(PRBool *aDoingPrint)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute boolean doingPrintPreview; */
|
/* readonly attribute boolean doingPrintPreview; */
|
||||||
|
// XXX This always returns PR_FALSE for subdocuments
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetDoingPrintPreview(PRBool *aDoingPrintPreview)
|
DocumentViewerImpl::GetDoingPrintPreview(PRBool *aDoingPrintPreview)
|
||||||
{
|
{
|
||||||
|
@ -3603,6 +3608,7 @@ DocumentViewerImpl::SetIsPrintingInDocShellTree(nsIDocShellTreeNode* aParentNode
|
||||||
#endif // NS_PRINTING
|
#endif // NS_PRINTING
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
// XXX this always returns PR_FALSE for subdocuments
|
||||||
PRBool
|
PRBool
|
||||||
DocumentViewerImpl::GetIsPrinting()
|
DocumentViewerImpl::GetIsPrinting()
|
||||||
{
|
{
|
||||||
|
@ -3632,7 +3638,8 @@ DocumentViewerImpl::SetIsPrinting(PRBool aIsPrinting)
|
||||||
|
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
// The PrintEngine holds the current value
|
// The PrintEngine holds the current value
|
||||||
// this called from inside the DocViewer
|
// this called from inside the DocViewer.
|
||||||
|
// XXX it always returns PR_FALSE for subdocuments
|
||||||
PRBool
|
PRBool
|
||||||
DocumentViewerImpl::GetIsPrintPreview()
|
DocumentViewerImpl::GetIsPrintPreview()
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,15 +158,16 @@ protected:
|
||||||
virtual PRIntn GetSkipSides() const;
|
virtual PRIntn GetSkipSides() const;
|
||||||
|
|
||||||
nsCOMPtr<nsIFrameLoader> mFrameLoader;
|
nsCOMPtr<nsIFrameLoader> mFrameLoader;
|
||||||
|
nsIView* mInnerView;
|
||||||
|
PRPackedBool mDidCreateDoc;
|
||||||
PRPackedBool mOwnsFrameLoader;
|
PRPackedBool mOwnsFrameLoader;
|
||||||
PRPackedBool mIsInline;
|
PRPackedBool mIsInline;
|
||||||
nsIView* mInnerView;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nsSubDocumentFrame::nsSubDocumentFrame()
|
nsSubDocumentFrame::nsSubDocumentFrame()
|
||||||
: nsLeafFrame(), mOwnsFrameLoader(PR_FALSE)
|
: nsLeafFrame(), mDidCreateDoc(PR_FALSE), mOwnsFrameLoader(PR_FALSE),
|
||||||
|
mIsInline(PR_FALSE)
|
||||||
{
|
{
|
||||||
mIsInline = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
|
@ -274,6 +275,7 @@ nsSubDocumentFrame::Init(nsPresContext* aPresContext,
|
||||||
if (shouldCreateDoc) {
|
if (shouldCreateDoc) {
|
||||||
rv = ShowDocShell();
|
rv = ShowDocShell();
|
||||||
NS_ENSURE_SUCCESS(rv,rv);
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
mDidCreateDoc = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -534,7 +536,7 @@ NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubDocumentFrame::Destroy(nsPresContext* aPresContext)
|
nsSubDocumentFrame::Destroy(nsPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
if (mFrameLoader) {
|
if (mFrameLoader && mDidCreateDoc) {
|
||||||
// Get the content viewer through the docshell, but don't call
|
// Get the content viewer through the docshell, but don't call
|
||||||
// GetDocShell() since we don't want to create one if we don't
|
// GetDocShell() since we don't want to create one if we don't
|
||||||
// have one.
|
// have one.
|
||||||
|
@ -584,6 +586,8 @@ nsSize nsSubDocumentFrame::GetMargin()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX this should be called ObtainDocShell or something like that,
|
||||||
|
// to indicate that it could have side effects
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
|
nsSubDocumentFrame::GetDocShell(nsIDocShell **aDocShell)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче