Closed Bug 391034 Opened 17 years ago Closed 17 years ago

[FIX]"ASSERTION: Unexpected left/right/top/bottom unit" with getComputedStyle on "position: relative; left: 3ch;" element

Categories

(Core :: CSS Parsing and Computation, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Assigned: bzbarsky)

References

Details

(Keywords: assertion, testcase)

Attachments

(2 files, 1 obsolete file)

Attached file testcase
###!!! ASSERTION: Unexpected left/right/top/bottom unit: 'Error', file /Users/jruderman/trunk/mozilla/layout/style/nsComputedDOMStyle.cpp, line 2726

This reminds me of bug 379405.
Attached patch Possible fix (obsolete) — Splinter Review
This does fix the bug... but I wonder about the behavior here in general.  In particular, the behavior of returning 0 if the offsets are auto, or are percentages and there's no containing block, as well as the "look at the opposite side" thing.  I think it might make more sense to just use SetValueToCoord here and be done with it...
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #275606 - Flags: superreview?(dbaron)
Attachment #275606 - Flags: review?(dbaron)
Attached patch The right diffSplinter Review
Attachment #275606 - Attachment is obsolete: true
Attachment #275607 - Flags: superreview?(dbaron)
Attachment #275607 - Flags: review?(dbaron)
Attachment #275606 - Flags: superreview?(dbaron)
Attachment #275606 - Flags: review?(dbaron)
That patch depends on bug 391221.
Depends on: 391221
Summary: "ASSERTION: Unexpected left/right/top/bottom unit" with getComputedStyle on "position: relative; left: 3ch;" element → [FIX]"ASSERTION: Unexpected left/right/top/bottom unit" with getComputedStyle on "position: relative; left: 3ch;" element
Comment on attachment 275607 [details] [diff] [review]
The right diff

>+  // XXXbz I wish there were some centralized place that had the
>+  // condition of this |if| statement.
>   if (coord.GetUnit() != eStyleUnit_Coord &&
>-      coord.GetUnit() != eStyleUnit_Percent) {
>+      coord.GetUnit() != eStyleUnit_Percent &&
>+      coord.GetUnit() != eStyleUnit_Chars) {

Can you just check coord.GetUnit() == eStyleUnit_Auto?

(Was this one of the places where there used to be some eStyleUnit_Null?)

r+sr+a=dbaron

(Didn't really look at the test, but I trust you there.  I hope you generally test that the test fails without the patch?)
Attachment #275607 - Flags: superreview?(dbaron)
Attachment #275607 - Flags: superreview+
Attachment #275607 - Flags: review?(dbaron)
Attachment #275607 - Flags: review+
Attachment #275607 - Flags: approval1.9+
> Can you just check coord.GetUnit() == eStyleUnit_Auto?

Um.... yes.  ;)

And yes, I do check that the tests fail without the patch.
Checked in with that change.  Fixed.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Crashtest checked in.
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: