Closed Bug 1490619 Opened 2 years ago Closed 2 years ago

GetComputedStyle for an inset property on an overconstrained abspos or fixed element returns used value, not absolutized computed value

Categories

(Core :: DOM: CSS Object Model, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webcompat?])

Attachments

(5 files)

Attached file testcase
See the testcase. Every other browser returns 3px, we return 199px.

https://drafts.csswg.org/cssom/#resolved-value-special-case-property-like-top

We should probably make nsComputedDOMStyle::GetAbsoluteOffset more like GetRelativeOffset:

  https://searchfox.org/mozilla-central/rev/9e7995b3c384945740985107a4de601b27904718/layout/style/nsComputedDOMStyle.cpp#4142
Flags: needinfo?(emilio)
Whiteboard: [webcompat?]
Flags: needinfo?(emilio)
Summary: GetComputedStyle for an inset property on an overconstrained element returns used value, not absolutized computed value → GetComputedStyle for an inset property on an overconstrained abspos or fixed element returns used value, not absolutized computed value
Flags: needinfo?(emilio)
Per https://drafts.csswg.org/cssom/#resolved-value-special-case-property-like-top

This passes all the tests in
https://github.com/web-platform-tests/wpt/pull/12956, but I don't know if I need
a special-case for grid items in the GetCBPaddingRect and such... Is GridItemCB
what percentages are resolved against?
Attached file Grid item testcase.
Mats, do you know if I need a grid-item special-case for this? I assume so. Also, is it right that we're still messing with the paddings with your patch for bug 1478485? I'd expect this test-case to return 0.
Assignee: nobody → emilio
Flags: needinfo?(emilio) → needinfo?(mats)
Attachment #9008392 - Attachment mime type: text/plain → text/html
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)
> Created attachment 9008392 [details]
> Grid item testcase.
> 
> Mats, do you know if I need a grid-item special-case for this? I assume so.

The grid container isn't the absolute containing block in this test,
the viewport is.  So the result (8px) is the margin-left of <body>.

The "static position" in this case is a bit special though:
https://drafts.csswg.org/css-grid/#static-position
It seems to me we should use the "content edges of the grid container",
so I would expect the result to be 18px and the green block positioned
at 10,10 from the top-left of the blue block.

It appears the Grid spec changed just a couple of weeks ago though.
https://github.com/w3c/csswg-drafts/issues/3020
It used to say "padding edges" so our current layout reflects that.

I filed bug 1490730.


> Also, is it right that we're still messing with the paddings with your patch
> for bug 1478485?

Bug 1478485 deals with the other case: when the grid container is
the CB, where we should use the grid area.
Flags: needinfo?(mats)
Attachment #9008389 - Attachment description: Fall back to the computed value for overconstrained abspos / fixed pos. → Bug 1490619 - Fall back to the computed value for overconstrained abspos / fixed pos.

The resolved percentage values (bottom and right) looks weird to me (being negative), but I haven't investigated what the correct values should be here.

Blocks: 1525168
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/06e188d40c8d
Fall back to the computed value for overconstrained abspos / fixed pos. r=mats
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.