Closed Bug 379741 Opened 17 years ago Closed 17 years ago

We have eStyleUnit_Null nsStyleCoords for margin, etc.

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha5

People

(Reporter: dbaron, Assigned: dbaron)

References

Details

Attachments

(3 files)

We have eStyleUnit_Null nsStyleCoords for a bunch of CSS properties where the null duplicates some other initial value that is representable in nsStyleCoord.  We should instead represent these initial values so we don't have to worry about two different nsStyleCoord values representing the same thing.

This also causes some bugs in the computed style code:  we show (since some recent refactoring that bz did, I think) 'none' as the computed value for margin, padding, etc. properties on elements that don't have frames.
Attached patch patchSplinter Review
Attachment #263767 - Flags: superreview?(bzbarsky)
Attachment #263767 - Flags: review?(bzbarsky)
Comment on attachment 263767 [details] [diff] [review]
patch

So you can remove the check for eStyleUnit_Null from IsFixedPaddingSize() and IsFixedMarginSize() in nsAbsoluteContainingBlock.cpp, right?  Or better yet expose IsFixedUnit from nsStyleStruct.cpp and make this code use that (and remove the check for _Null in that as well)?

Also, can the line-height be eStyleUnit_Null at http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/layout/generic/nsLineLayout.cpp&rev=3.261#2012 ?  Or can that check be removed too?

Same for the check in NonZeroStyleCoord() in nsContainerFrame.cpp (only used for border-radius).

Same for NonZeroStyleCoord() in nsDisplayList.cpp.

Similar for IsPaddingZero() and IsMarginZero() in nsInlineFrame.cpp.

Similar for functions with the same names in nsBlockFrame.cpp

r+sr=bzbarsky for the patch as-is if you want to do the cleanups in a different bug.

Followup: Do we want to avoid duplicating IsAutoHeight() between nsLayoutUtils and nsFrame.cpp?
Attachment #263767 - Flags: superreview?(bzbarsky)
Attachment #263767 - Flags: superreview+
Attachment #263767 - Flags: review?(bzbarsky)
Attachment #263767 - Flags: review+
I'm thinking I should eventually move to where GetUnit() can
  NS_ASSERTION(mUnit != eStyleUnit_Null, "reading uninitialized value");
This removes the remaining use of null units to mean anything other than uninitialized.
Attachment #264423 - Flags: superreview?(bzbarsky)
Attachment #264423 - Flags: review?(bzbarsky)
This removes the remaining eStyleUnit_Null checks (mostly obsoleted by attachment 263767 [details] [diff] [review]; some unneeded before it) and makes GetUnit assert that mUnit is not null.
Attachment #264424 - Flags: superreview?(bzbarsky)
Attachment #264424 - Flags: review?(bzbarsky)
Comment on attachment 264423 [details] [diff] [review]
add eStyleUnit_None and use it for max-width/height

r+sr=bzbarsky
Attachment #264423 - Flags: superreview?(bzbarsky)
Attachment #264423 - Flags: superreview+
Attachment #264423 - Flags: review?(bzbarsky)
Attachment #264423 - Flags: review+
Comment on attachment 264424 [details] [diff] [review]
remove the remaining eStyelUnit_Null checks

r+sr=bzbarsky
Attachment #264424 - Flags: superreview?(bzbarsky)
Attachment #264424 - Flags: superreview+
Attachment #264424 - Flags: review?(bzbarsky)
Attachment #264424 - Flags: review+
All 3 patches checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
One of these patches (probably the first) also fixed the marker-offset:auto failure in test_value_computation.html.
Flags: in-testsuite+
Depends on: 381284
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: