Closed Bug 972119 Opened 10 years ago Closed 10 years ago

Simplify logic in nsCSSFrameConstructor::ConstructDocElementFrame

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(2 files)

While working on bug 969460, I noticed an opportunity to simplify some logic in nsCSSFrameConstructor::ConstructDocElementFrame.

Filing this bug on doing that.
Attached patch fix v1Splinter Review
Here's the patch.

Much-easier-to-read "diff -w" version coming up.
Attachment #8375227 - Flags: review?(bzbarsky)
(This is the version you probably want to review.)

So the idea here is to:
 (a) Invert the "Tag() == svg" logic, so that an early-return gets moved from "else"-body to "if"-body, which does away with the need for the "else" entirely.

 (b) Drop the unnecessary 'docElemIsTable' variable

 (c) Flatten "else { if" into "else if" to save on indentation.
and the point of all this is that now this function ends up looking like:

 if (style/tag is $FOO) {
   set up a particular frame;
 } else if (style/tag is $BAR) {
   set up a particular frame;
 } else if (style/tag is $BAZ) {
   [...etc...]
 } else {
   set up a block;
 }
Comment on attachment 8375227 [details] [diff] [review]
fix v1

r=me.  Thank you for the diff -w!
Attachment #8375227 - Flags: review?(bzbarsky) → review+
Blocks: 969460
Thanks for the review!

Try run: https://tbpl.mozilla.org/?tree=Try&rev=bebe01ea1dd6
https://hg.mozilla.org/mozilla-central/rev/72a491f40e45
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: