Closed Bug 208729 Opened 22 years ago Closed 20 years ago

[FIXr]consider creating an nsCSSValuePair type

Categories

(Core :: CSS Parsing and Computation, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha4

People

(Reporter: dbaron, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 2 obsolete files)

If we create an nsCSSValuePair type (as bz suggested in bug 125246 comment 41), we might be able to get rid of some shorthand hacks: Looking over this code, could we introduce a nsCSSValuePair type of data and then eliminate the -x-* properties for 'border-spacing', 'size', 'play-during', 'background-position'? That could simplify some more code, and arguably make some more correct (see the XXX comment you added in nsCSSPropList.h). Probably do this as a separate patch after this one lands... This would be a seventh type in the eCSSType enumeration, I think.
Blocks: 104322
Blocks: 200499
Attached patch Current state of things (obsolete) — Splinter Review
This doesn't convert background-position because I've not yet been able to get the shorthand code to play nice with this setup... The problem, of course, is that background-position can be a shorthand of its own _or_ part of the background shorthand. Yay.
By "shorthand code" I mean the code that outputs shorthands when nsCSSDeclaration is converted into a string.
Blocks: 223718
Blocks: 253222
So I wouldn't mind using this for something new (bug 72747). Is it reviewable (in its 'background-position'-not-yet-converted state)? I note the XXXldb where you added the #ifdef DEBUG could probably be removed, as could the "debugging methods only".
Er, well, now that I think about it for 10 seconds, I actually don't want to use this. So never mind the dependency, but it could still be worth landing.
Yeah, the patch should be reviewable as it is, with background-position to be fixed later. Let me post a diff against current trunk for review.
Attached patch Diff against tip (obsolete) — Splinter Review
Attachment #134188 - Attachment is obsolete: true
Attachment #156555 - Flags: superreview?(dbaron)
Attachment #156555 - Flags: review?(dbaron)
Comment on attachment 156555 [details] [diff] [review] Diff against tip >+#ifdef DEBUG >+void nsCSSValuePair::AppendToString(nsAString& aString, >+ nsCSSProperty aPropName) const >+{ >+ if (mXValue.GetUnit() != eCSSUnit_Null) { >+ AppendUTF8toUTF16(nsCSSProps::GetStringValue(aPropName), aString); >+ aString.Append(NS_LITERAL_STRING(": ")); >+ mXValue.AppendToString(aString); >+ NS_ASSERTION(mYValue.GetUnit() != eCSSUnit_Null, >+ nsPrintfCString("Parsed half of a %s?", >+ nsCSSProps::GetStringValue(aPropName).get()).get()); >+ mYValue.AppendToString(aString); Appending a space might be good, I think, unless something else does it. A little more context in this diff might have been nice, but r+sr=dbaron.
Attachment #156555 - Flags: superreview?(dbaron)
Attachment #156555 - Flags: superreview+
Attachment #156555 - Flags: review?(dbaron)
Attachment #156555 - Flags: review+
> Appending a space might be good, I think, unless something else does it. Yeah, I need to do that. Good catch.
Assignee: dbaron → bzbarsky
Priority: -- → P2
Summary: consider creating an nsCSSValuePair type → [FIXr]consider creating an nsCSSValuePair type
Target Milestone: --- → mozilla1.8alpha4
Note that while getting play-during directly will work with this patch, cssText for it will still be broken. I'll file a bug on that, as well on the background-position issue.
Attachment #156555 - Attachment is obsolete: true
Blocks: 258079
Blocks: 258080
Filed bug 258080 on the background-position issue and bug 258079 on a related play-during issue I noticed.
Fix checked in for 1.8a4
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: