Closed Bug 514634 Opened 15 years ago Closed 15 years ago

some misc block frame code cleanup

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tnikkel, Assigned: tnikkel)

Details

Attachments

(1 file, 1 obsolete file)

Noticed a few things while working on another bug that I wanted to followup on.
Attached patch patch (obsolete) — Splinter Review
Add some assertions to catch problems.

nsBlockFrame::PullFrameFrom calls SetNextSibling twice, doing what should be
the same thing twice.

Fix the comment above nsBlockFrame::PullFrameFrom.
Attachment #398619 - Flags: review?(fantasai.bugs)
-      aLine->LastChild()->SetNextSibling(frame);
+      NS_ASSERTION(aState.mPrevChild == aLine->LastChild(),
+        "mPrevChild should be the LastChild of the line we are adding to");
+      // The frame is being pulled from a next-in-flow; therefore we
+      // need to add it to our sibling list.
+      if (nsnull != aState.mPrevChild) {
+        aState.mPrevChild->SetNextSibling(frame);
+      }

So what happens when aState.mPrevChild is null? (If that's not supposed to happen, then we should assert here and not have an if-clause.)

       frame->SetNextSibling(nsnull);

This line should also be moved so that the two list-splicing operations are together. You'll need to cache the nextSibling in a newFirstChild variable or something, but I think the code will be more understandable that way.
Attached patch patch v2Splinter Review
(In reply to comment #2)
> So what happens when aState.mPrevChild is null? (If that's not supposed to
> happen, then we should assert here and not have an if-clause.)

The NS_ASSERTION(aState.mPrevChild == aLine->LastChild(),...) already asserts for the null mPrevChild case. Removed the if-clause.

>        frame->SetNextSibling(nsnull);
> 
> This line should also be moved so that the two list-splicing operations are
> together. You'll need to cache the nextSibling in a newFirstChild variable or
> something, but I think the code will be more understandable that way.

Done.
Attachment #398619 - Attachment is obsolete: true
Attachment #398903 - Flags: review?(fantasai.bugs)
Attachment #398619 - Flags: review?(fantasai.bugs)
Attachment #398903 - Flags: review?(fantasai.bugs) → review+
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/f712fa4cd5ad
Status: NEW → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: