Closed Bug 1177927 Opened 7 years ago Closed 7 years ago

Simplify frame-list counting in nsPrintEngine to use GetLength()

Categories

(Core :: Printing: Output, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed
firefox42 --- affected

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

While fixing bug 1177925, I noticed that nsPrintEngine walks a nsFrameList purely to count the number of frames in it.

It should simply use nsFrameList::GetLength for this.
Summary: Simplify child-list counting in nsPrintEngine to use GetLength() → Simplify frame-list counting in nsPrintEngine to use GetLength()
Attached patch fix v1Splinter Review
Here's the patch.  This just replaces a loop with a call to GetLength().  (I also removed "first" from the comment, because it's not actually "first"; it's rather the last thing that we do.)
Attachment #8626797 - Flags: review?(tnikkel)
Attachment #8626797 - Flags: review?(tnikkel) → review+
Flags: in-testsuite-
Comment on attachment 8626797 [details] [diff] [review]
fix v1

>+  // count the total number of pages
>+  aCount = aSeqFrame->PrincipalChildList()->GetLength();

Er, PrincipalChildList() returns a nsFrameList&, so that should be .GetLength(), not ->. (I could've sworn I built this locally earlier in the week, but I guess not.)

Just pushed a followup to fix that.
https://hg.mozilla.org/mozilla-central/rev/052df7a415f1
https://hg.mozilla.org/mozilla-central/rev/30e8c73f674e
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.