mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 371839. Assertions that scan all continuations should bail out if the continuation chain is too long, so they don't add O(N) to algorithmic complexity. r=bzbarsky
This commit is contained in:
parent
c862b4f8f6
commit
301eb1e0b2
@ -131,20 +131,26 @@ nsIFrame* nsSplittableFrame::GetLastContinuation() const
|
||||
#ifdef DEBUG
|
||||
PRBool nsSplittableFrame::IsInPrevContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2)
|
||||
{
|
||||
while (aFrame1) {
|
||||
PRInt32 iterations = 0;
|
||||
while (aFrame1 && iterations < 10) {
|
||||
// Bail out after 10 iterations so we don't bog down debug builds too much
|
||||
if (aFrame1 == aFrame2)
|
||||
return PR_TRUE;
|
||||
aFrame1 = aFrame1->GetPrevContinuation();
|
||||
++iterations;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsSplittableFrame::IsInNextContinuationChain(nsIFrame* aFrame1, nsIFrame* aFrame2)
|
||||
{
|
||||
while (aFrame1) {
|
||||
PRInt32 iterations = 0;
|
||||
while (aFrame1 && iterations < 10) {
|
||||
// Bail out after 10 iterations so we don't bog down debug builds too much
|
||||
if (aFrame1 == aFrame2)
|
||||
return PR_TRUE;
|
||||
aFrame1 = aFrame1->GetNextContinuation();
|
||||
++iterations;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -5958,10 +5958,19 @@ nsTextFrame::SetLength(PRInt32 aLength)
|
||||
f = static_cast<nsTextFrame*>(f->GetNextInFlow());
|
||||
}
|
||||
#ifdef DEBUG
|
||||
f = static_cast<nsTextFrame*>(this->GetFirstContinuation());
|
||||
while (f) {
|
||||
f = this;
|
||||
PRInt32 iterations = 0;
|
||||
while (f && iterations < 10) {
|
||||
f->GetContentLength(); // Assert if negative length
|
||||
f = static_cast<nsTextFrame*>(f->GetNextContinuation());
|
||||
++iterations;
|
||||
}
|
||||
f = this;
|
||||
iterations = 0;
|
||||
while (f && iterations < 10) {
|
||||
f->GetContentLength(); // Assert if negative length
|
||||
f = static_cast<nsTextFrame*>(f->GetPrevContinuation());
|
||||
++iterations;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user