Simplify logic in nsCSSFrameConstructor::ConstructDocElementFrame

RESOLVED FIXED in mozilla30

Status

()

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

Trunk
mozilla30
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

Assignee

Description

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

Filing this bug on doing that.
Assignee

Comment 1

5 years ago
Posted patch fix v1Splinter Review
Here's the patch.

Much-easier-to-read "diff -w" version coming up.
Attachment #8375227 - Flags: review?(bzbarsky)
Assignee

Comment 2

5 years ago
(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.
Assignee

Comment 3

5 years ago
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+
Assignee

Updated

5 years ago
Blocks: 969460
Assignee

Comment 5

5 years ago
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: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.