Fix crash when composer and comboboxes interact. The real fix is in

nsComboboxControlFrame; the nsBlockFrame changes are just cleanup the fix
enables. Bug 197942, r=jkeiser, sr=dbaron.
This commit is contained in:
bzbarsky%mit.edu 2003-04-12 16:06:54 +00:00
parent e1aca3947c
commit 0b85b42edc
6 changed files with 22 additions and 46 deletions

View File

@ -2197,7 +2197,7 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
if (!frameManager) { return NS_ERROR_NULL_POINTER; }
frameManager->SetPrimaryFrameFor(content, mTextFrame);
rv = mDisplayFrame->Init(aPresContext, content, this, styleContext, nsnull);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }
mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);
@ -2332,7 +2332,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
frameManager->SetPrimaryFrameFor(content, mTextFrame);
*/
rv = mDisplayFrame->Init(aPresContext, content, this, styleContext, nsnull);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }
mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);

View File

@ -58,7 +58,6 @@
#include "nsIFontMetrics.h"
#include "nsHTMLParts.h"
#include "nsHTMLAtoms.h"
#include "nsCSSPseudoElements.h"
#include "nsHTMLValue.h"
#include "nsIDOMEvent.h"
#include "nsIHTMLContent.h"
@ -2818,7 +2817,8 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
}
if (aFromLine.next() != end_lines())
aFromLine.next()->MarkPreviousMarginDirty();
Invalidate(aState.mPresContext, combinedArea);
if (!combinedArea.IsEmpty())
Invalidate(aState.mPresContext, combinedArea);
aFromContainer.erase(aFromLine);
aState.FreeLineBox(fromLine);
}
@ -6265,24 +6265,6 @@ nsBlockFrame::Init(nsIPresContext* aPresContext,
return rv;
}
already_AddRefed<nsStyleContext>
nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
{
// This check is here because nsComboboxControlFrame creates
// nsBlockFrame objects that have an |mContent| pointing to a text
// node. This check ensures we don't try to do selector matching on
// that text node.
//
// XXX This check should go away once we fix nsComboboxControlFrame.
//
if (!mContent->IsContentOfType(nsIContent::eELEMENT))
return nsnull;
return aPresContext->ProbePseudoStyleContextFor(mContent,
nsCSSPseudoElements::firstLetter,
mStyleContext);
}
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,

View File

@ -43,6 +43,7 @@
#include "nsAbsoluteContainingBlock.h"
#include "nsLineBox.h"
#include "nsReflowPath.h"
#include "nsCSSPseudoElements.h"
class nsBlockReflowState;
class nsBulletFrame;
@ -212,7 +213,12 @@ protected:
nsBlockFrame();
virtual ~nsBlockFrame();
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext);
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext)
{
return aPresContext->ProbePseudoStyleContextFor(mContent,
nsCSSPseudoElements::firstLetter,
mStyleContext);
}
/*
* Overides member function of nsHTMLContainerFrame. Needed to handle the

View File

@ -58,7 +58,6 @@
#include "nsIFontMetrics.h"
#include "nsHTMLParts.h"
#include "nsHTMLAtoms.h"
#include "nsCSSPseudoElements.h"
#include "nsHTMLValue.h"
#include "nsIDOMEvent.h"
#include "nsIHTMLContent.h"
@ -2818,7 +2817,8 @@ nsBlockFrame::PullFrameFrom(nsBlockReflowState& aState,
}
if (aFromLine.next() != end_lines())
aFromLine.next()->MarkPreviousMarginDirty();
Invalidate(aState.mPresContext, combinedArea);
if (!combinedArea.IsEmpty())
Invalidate(aState.mPresContext, combinedArea);
aFromContainer.erase(aFromLine);
aState.FreeLineBox(fromLine);
}
@ -6265,24 +6265,6 @@ nsBlockFrame::Init(nsIPresContext* aPresContext,
return rv;
}
already_AddRefed<nsStyleContext>
nsBlockFrame::GetFirstLetterStyle(nsIPresContext* aPresContext)
{
// This check is here because nsComboboxControlFrame creates
// nsBlockFrame objects that have an |mContent| pointing to a text
// node. This check ensures we don't try to do selector matching on
// that text node.
//
// XXX This check should go away once we fix nsComboboxControlFrame.
//
if (!mContent->IsContentOfType(nsIContent::eELEMENT))
return nsnull;
return aPresContext->ProbePseudoStyleContextFor(mContent,
nsCSSPseudoElements::firstLetter,
mStyleContext);
}
NS_IMETHODIMP
nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,

View File

@ -43,6 +43,7 @@
#include "nsAbsoluteContainingBlock.h"
#include "nsLineBox.h"
#include "nsReflowPath.h"
#include "nsCSSPseudoElements.h"
class nsBlockReflowState;
class nsBulletFrame;
@ -212,7 +213,12 @@ protected:
nsBlockFrame();
virtual ~nsBlockFrame();
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext);
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext)
{
return aPresContext->ProbePseudoStyleContextFor(mContent,
nsCSSPseudoElements::firstLetter,
mStyleContext);
}
/*
* Overides member function of nsHTMLContainerFrame. Needed to handle the

View File

@ -2197,7 +2197,7 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
if (!frameManager) { return NS_ERROR_NULL_POINTER; }
frameManager->SetPrimaryFrameFor(content, mTextFrame);
rv = mDisplayFrame->Init(aPresContext, content, this, styleContext, nsnull);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }
mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);
@ -2332,7 +2332,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
frameManager->SetPrimaryFrameFor(content, mTextFrame);
*/
rv = mDisplayFrame->Init(aPresContext, content, this, styleContext, nsnull);
rv = mDisplayFrame->Init(aPresContext, mContent, this, styleContext, nsnull);
if (NS_FAILED(rv)) { return rv; }
mDisplayFrame->SetInitialChildList(aPresContext, nsnull, mTextFrame);