mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Update content offset for all next-continuations, not just fluid ones. b=406380 r+sr=roc a=blocking1.9
This commit is contained in:
parent
18894258b2
commit
4aa25eb7a7
@ -284,7 +284,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRInt32 GetContentOffset() const { return mContentOffset; }
|
PRInt32 GetContentOffset() const { return mContentOffset; }
|
||||||
PRInt32 GetContentLength() const { return GetContentEnd() - mContentOffset; }
|
PRInt32 GetContentLength() const
|
||||||
|
{
|
||||||
|
NS_ASSERTION(GetContentEnd() - mContentOffset >= 0, "negative length");
|
||||||
|
return GetContentEnd() - mContentOffset;
|
||||||
|
}
|
||||||
PRInt32 GetContentEnd() const;
|
PRInt32 GetContentEnd() const;
|
||||||
// This returns the length the frame thinks it *should* have after it was
|
// This returns the length the frame thinks it *should* have after it was
|
||||||
// last reflowed (0 if it hasn't been reflowed yet). This should be used only
|
// last reflowed (0 if it hasn't been reflowed yet). This should be used only
|
||||||
|
@ -1078,6 +1078,7 @@ void BuildTextRunsScanner::FlushFrames(PRBool aFlushLineBreaks, PRBool aSuppress
|
|||||||
|
|
||||||
void BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame* aFrame)
|
void BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame* aFrame)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(mMaxTextLength <= mMaxTextLength + aFrame->GetContentLength(), "integer overflow");
|
||||||
mMaxTextLength += aFrame->GetContentLength();
|
mMaxTextLength += aFrame->GetContentLength();
|
||||||
mDoubleByteText |= aFrame->GetContent()->GetText()->Is2b();
|
mDoubleByteText |= aFrame->GetContent()->GetText()->Is2b();
|
||||||
mLastFrame = aFrame;
|
mLastFrame = aFrame;
|
||||||
@ -3159,7 +3160,9 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
|
|||||||
// NOTE: bypassing nsTextFrame::Init!!!
|
// NOTE: bypassing nsTextFrame::Init!!!
|
||||||
nsresult rv = nsFrame::Init(aContent, aParent, aPrevInFlow);
|
nsresult rv = nsFrame::Init(aContent, aParent, aPrevInFlow);
|
||||||
|
|
||||||
|
#ifdef IBMBIDI
|
||||||
nsIFrame* nextContinuation = aPrevInFlow->GetNextContinuation();
|
nsIFrame* nextContinuation = aPrevInFlow->GetNextContinuation();
|
||||||
|
#endif // IBMBIDI
|
||||||
// Hook the frame into the flow
|
// Hook the frame into the flow
|
||||||
SetPrevInFlow(aPrevInFlow);
|
SetPrevInFlow(aPrevInFlow);
|
||||||
aPrevInFlow->SetNextInFlow(this);
|
aPrevInFlow->SetNextInFlow(this);
|
||||||
@ -3176,9 +3179,6 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
|
|||||||
}
|
}
|
||||||
#ifdef IBMBIDI
|
#ifdef IBMBIDI
|
||||||
if (aPrevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) {
|
if (aPrevInFlow->GetStateBits() & NS_FRAME_IS_BIDI) {
|
||||||
PRInt32 start, end;
|
|
||||||
aPrevInFlow->GetOffsets(start, mContentOffset);
|
|
||||||
|
|
||||||
nsPropertyTable *propTable = PresContext()->PropertyTable();
|
nsPropertyTable *propTable = PresContext()->PropertyTable();
|
||||||
propTable->SetProperty(this, nsGkAtoms::embeddingLevel,
|
propTable->SetProperty(this, nsGkAtoms::embeddingLevel,
|
||||||
propTable->GetProperty(aPrevInFlow, nsGkAtoms::embeddingLevel),
|
propTable->GetProperty(aPrevInFlow, nsGkAtoms::embeddingLevel),
|
||||||
@ -3192,7 +3192,9 @@ nsContinuingTextFrame::Init(nsIContent* aContent,
|
|||||||
if (nextContinuation) {
|
if (nextContinuation) {
|
||||||
SetNextContinuation(nextContinuation);
|
SetNextContinuation(nextContinuation);
|
||||||
nextContinuation->SetPrevContinuation(this);
|
nextContinuation->SetPrevContinuation(this);
|
||||||
nextContinuation->GetOffsets(start, end);
|
PRInt32 end = static_cast<nsTextFrame*>(nextContinuation)->GetContentOffset();
|
||||||
|
// Adjust next-continuations' content offset as needed.
|
||||||
|
SetLength(PR_MAX(0, end - mContentOffset));
|
||||||
}
|
}
|
||||||
mState |= NS_FRAME_IS_BIDI;
|
mState |= NS_FRAME_IS_BIDI;
|
||||||
} // prev frame is bidi
|
} // prev frame is bidi
|
||||||
@ -5156,27 +5158,35 @@ nsTextFrame::SetLength(PRInt32 aLength)
|
|||||||
{
|
{
|
||||||
mContentLengthHint = aLength;
|
mContentLengthHint = aLength;
|
||||||
PRInt32 end = GetContentOffset() + aLength;
|
PRInt32 end = GetContentOffset() + aLength;
|
||||||
nsTextFrame* f = static_cast<nsTextFrame*>(GetNextInFlow());
|
nsTextFrame* continuation = static_cast<nsTextFrame*>(GetNextContinuation());
|
||||||
if (!f)
|
if (!continuation)
|
||||||
return;
|
return;
|
||||||
if (end < f->mContentOffset) {
|
|
||||||
// Our frame is shrinking. Give the text to our next in flow.
|
if (end < continuation->mContentOffset) {
|
||||||
f->mContentOffset = end;
|
// Our frame is shrinking. Give the text to our next-continuation.
|
||||||
if (f->GetTextRun() != mTextRun) {
|
continuation->mContentOffset = end;
|
||||||
|
if (continuation->GetTextRun() != mTextRun) {
|
||||||
ClearTextRun();
|
ClearTextRun();
|
||||||
f->ClearTextRun();
|
continuation->ClearTextRun();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (f && f->mContentOffset < end) {
|
while (continuation && continuation->mContentOffset < end) {
|
||||||
// Our frame is growing. Take text from our in-flow.
|
// Our frame is growing. Take text from our next-continuation.
|
||||||
f->mContentOffset = end;
|
continuation->mContentOffset = end;
|
||||||
if (f->GetTextRun() != mTextRun) {
|
if (continuation->GetTextRun() != mTextRun) {
|
||||||
ClearTextRun();
|
ClearTextRun();
|
||||||
f->ClearTextRun();
|
continuation->ClearTextRun();
|
||||||
}
|
}
|
||||||
f = static_cast<nsTextFrame*>(f->GetNextInFlow());
|
continuation = static_cast<nsTextFrame*>(continuation->GetNextContinuation());
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
continuation = this;
|
||||||
|
while (continuation) {
|
||||||
|
continuation->GetContentLength(); // Assert if negative length
|
||||||
|
continuation = static_cast<nsTextFrame*>(continuation->GetNextContinuation());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -6023,10 +6033,8 @@ nsTextFrame::AdjustOffsetsForBidi(PRInt32 aStart, PRInt32 aEnd)
|
|||||||
aEnd = PR_MAX(aEnd, prevOffset);
|
aEnd = PR_MAX(aEnd, prevOffset);
|
||||||
prev->ClearTextRun();
|
prev->ClearTextRun();
|
||||||
}
|
}
|
||||||
if (mContentOffset != aStart) {
|
|
||||||
mContentOffset = aStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
mContentOffset = aStart;
|
||||||
SetLength(aEnd - aStart);
|
SetLength(aEnd - aStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user