Trying to fix Tp regression. More of bug 254378, r+sr=roc

This commit is contained in:
bzbarsky@mit.edu
2004-08-10 21:25:48 +00:00
parent 5c7e3ef527
commit a53270d275
2 changed files with 32 additions and 52 deletions

View File

@@ -468,8 +468,6 @@ public:
virtual void AdjustOffsetsForBidi(PRInt32 start, PRInt32 end);
NS_IMETHOD DidSetStyleContext(nsPresContext* aPresContext);
NS_IMETHOD GetPointFromOffset(nsPresContext* inPresContext,
nsIRenderingContext* inRendContext,
PRInt32 inOffset,
@@ -1276,11 +1274,11 @@ DrawSelectionIterator::IsBeforeOrAfter()
#define TEXT_BLINK_ON 0x80000000
#define TEXT_IS_EMPTY 0x00100000
#define TEXT_IS_ONLY_WHITESPACE 0x00100000
#define TEXT_ISNOT_EMPTY 0x00200000
#define TEXT_ISNOT_ONLY_WHITESPACE 0x00200000
#define TEXT_ISEMPTY_FLAGS 0x00300000
#define TEXT_WHITESPACE_FLAGS 0x00300000
//----------------------------------------------------------------------
@@ -1397,7 +1395,7 @@ nsTextFrame::CharacterDataChanged(nsPresContext* aPresContext,
if (aAppend) {
markAllDirty = PR_FALSE;
nsTextFrame* frame = (nsTextFrame*)GetLastInFlow();
frame->mState &= ~TEXT_ISEMPTY_FLAGS;
frame->mState &= ~TEXT_WHITESPACE_FLAGS;
frame->mState |= NS_FRAME_IS_DIRTY;
targetTextFrame = frame;
}
@@ -1406,7 +1404,7 @@ nsTextFrame::CharacterDataChanged(nsPresContext* aPresContext,
// Mark this frame and all the next-in-flow frames as dirty
nsTextFrame* textFrame = this;
while (textFrame) {
textFrame->mState &= ~TEXT_ISEMPTY_FLAGS;
textFrame->mState &= ~TEXT_WHITESPACE_FLAGS;
textFrame->mState |= NS_FRAME_IS_DIRTY;
#ifdef IBMBIDI
void* nextBidiFrame;
@@ -5836,23 +5834,23 @@ nsTextFrame::GetType() const
/* virtual */ PRBool
nsTextFrame::IsEmpty()
{
NS_ASSERTION(!(mState & TEXT_IS_EMPTY) || !(mState & TEXT_ISNOT_EMPTY),
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
"Invalid state");
if (mState & TEXT_ISNOT_EMPTY) {
return PR_FALSE;
}
if (mState & TEXT_IS_EMPTY) {
return PR_TRUE;
}
// XXXldb Should this check compatibility mode as well???
if (GetStyleText()->WhiteSpaceIsSignificant()) {
mState |= TEXT_ISNOT_EMPTY;
return PR_FALSE;
}
if (mState & TEXT_ISNOT_ONLY_WHITESPACE) {
return PR_FALSE;
}
if (mState & TEXT_IS_ONLY_WHITESPACE) {
return PR_TRUE;
}
nsCOMPtr<nsITextContent> textContent( do_QueryInterface(mContent) );
if (! textContent) {
NS_NOTREACHED("text frame has no text content");
@@ -5860,18 +5858,10 @@ nsTextFrame::IsEmpty()
}
PRBool isEmpty = textContent->IsOnlyWhitespace();
mState |= (isEmpty ? TEXT_IS_EMPTY : TEXT_ISNOT_EMPTY);
mState |= (isEmpty ? TEXT_IS_ONLY_WHITESPACE : TEXT_ISNOT_ONLY_WHITESPACE);
return isEmpty;
}
NS_IMETHODIMP
nsTextFrame::DidSetStyleContext(nsPresContext* aPresContext) {
// Clear out our cached IsEmpty() state, since that depends on style
mState &= ~TEXT_ISEMPTY_FLAGS;
return nsFrame::DidSetStyleContext(aPresContext);
}
#ifdef DEBUG
NS_IMETHODIMP
nsTextFrame::GetFrameName(nsAString& aResult) const