Closed Bug 129843 Opened 24 years ago Closed 24 years ago

More computed style property implementations

Categories

(Core :: DOM: CSS Object Model, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.0

People

(Reporter: caillon, Assigned: caillon)

Details

Attachments

(1 file, 1 obsolete file)

I thought I had already filed the bug on this a few days ago. Anyway, I've got a decent sized patch which implements computed styles for 10 more properties: 'background-attachment', 'background-repeat', 'font-size-adjust', 'clear', 'caption-side', 'empty-cells', 'table-layout', 'line-height', 'vertical-align', and '-moz-opacity'.
Attached patch Proposed patch v1.0 (obsolete) — — Splinter Review
This applies after the latest patch in bug 128428. I added GetLineHeightCoord() because I needed a good way to get the line-height for computing vertical-align in the case of a percentage to avoid always declaring two extra nsStyleStructs in GetVerticalAlign() for the rare case of someone using a percentage value for vertical-align and to avoid a function which had more code to get the line-height than the vertical-align. Other than that, the implementations are fairly straightforward IMO. (I love the new SetNumber() -- it works great here!) Comments?
Status: NEW → ASSIGNED
Keywords: patch, review
Priority: -- → P2
Target Milestone: --- → mozilla1.0
I'll do a thorough review later, but offhand: > +nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord, > + const nsStyleText*& aText, > + nsIFrame *aFrame) It's not modifying aText, so no need to have the "&" there. And put this next to other helper functions near the top of the file? (I'll look later to see why we need this function at all...) > - eCSSProperty_border_spacing, > + // eCSSProperty_border_spacing, why?
> + default: break; Put the break on a separate line. I agree that we should have GetLineHeightCoord(), but my comments in comment 2 still apply to that. In addition, make aCoord be the last argument, since that's what is being gotten. Other than that, looks good.
>> - eCSSProperty_border_spacing, >> + // eCSSProperty_border_spacing, >why? Because it's really _not_ queryable. All we do in the getter is return NS_ERROR_DOM_NOT_SUPPORTED_ERR; I'm still unsure what to do with properties like that and background-position. Currently, the only possible return value we can do is a string, but it's not a string really. It's not really a CSSValueList either. So I'm not at a loss for what to do. Unless, I misread it, the (always brilliant) DOM Style spec mandates that we return a CSSValue object for all non-shorthand properties. These are not shorthand properties as defined by the CSS2 spec. However, they act like shorthand properties and their return values should be canonicalized. AFAICT, there is no way to specify that with CSSValues. Of course the easiest thing to do is return null as if it were a shorthand property, and probably the best solution currently IMO. Anyway, I should probably add a comment to that. Similar to the other //shorthand properties are not really queryable >> + default: break; >Put the break on a separate line. Will do.
>So I'm not at a loss for what to do. That should read "So I'm _now_ at a loss for what to do." :)
Right... Not queryable it is. /me should have noticed.
Attached patch Patch v1.1 — — Splinter Review
Make changes suggested. I noticed why you thought that GetLineHeightCoord() was not with the helper functions: GetWidth() was intertwined within them. So I moved that up next to GetHeight() and I changed position of GetLineHeightCoord() next to the other Get*Coord() functions as it was a little more logical anyway. Also, sorry for the rant in comment #4. I re-read it just now and it sounded a bit harsher than I intended. Should have just answered with a simple reason, but I was in the middle of reading the spec and a bit frustrated with it.
Attachment #73388 - Attachment is obsolete: true
Comment on attachment 73526 [details] [diff] [review] Patch v1.1 r=bzbarsky
Attachment #73526 - Flags: review+
Attachment #73526 - Flags: superreview+
Comment on attachment 73526 [details] [diff] [review] Patch v1.1 sr=attinasi
Comment on attachment 73526 [details] [diff] [review] Patch v1.1 a=dbaron for trunk checkin
Attachment #73526 - Flags: approval+
checked in on the trunk.
Status: ASSIGNED → RESOLVED
Closed: 24 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: