Closed Bug 1478485 Opened 6 years ago Closed 6 years ago

Incorrect value for position:absolute's getComputedStyle left (for display:grid)

Categories

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

63 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: fremycompany_pub, Assigned: MatsPalmgren_bugz)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17720 Steps to reproduce: https://wptest.center/#/31dvt6 Actual results: values returned by getComputedStyle doesn't take the grid properties into account before returing a value Expected results: values returned by getComputedStyle should round trip (0px) https://github.com/w3c/csswg-drafts/issues/2913
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Flags: needinfo?(mats)
The problem is that nsComputedDOMStyle::GetAbsoluteOffset: https://searchfox.org/mozilla-central/rev/d4ef4e9747133aa2914aca2a15cf9df1e42a6aa0/layout/style/nsComputedDOMStyle.cpp#4142 assumes that the CB rect is the content rect of the container.
Assignee: nobody → mats
Component: Layout: Positioned → DOM: CSS Object Model
Flags: needinfo?(mats)
Attached patch fixSplinter Review
Attachment #9007896 - Flags: review?(dholbert)
I was expecting a WPT unexpected-fail but I don't see it: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3660ec79089c0a26cb74ddda2d5cb3bc8fc58043 François, do you intend to add a WPT for this?
Flags: needinfo?(fremycompany_pub)
Comment on attachment 9007896 [details] [diff] [review] fix Review of attachment 9007896 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nit addressed (assuming this ends up with a test here, or in WPT pretty soon) ::: layout/style/nsComputedDOMStyle.cpp @@ +4164,5 @@ > } > + } else if (container->IsGridContainerFrame() && > + (mOuterFrame->HasAnyStateBits(NS_FRAME_OUT_OF_FLOW))) { > + auto gridContainer = static_cast<nsGridContainerFrame*>(container); > + containerRect = gridContainer->GridItemCB(mOuterFrame); GridItemCB() is a static function on the nsGridContainerFrame class, so you shouldn't call it on the gridContainer instance. So I think we can just collapse these 2 lines to just the following: containerRect = nsGridContainerFrame::GridItemCB((mOuterFrame); See for reference: https://dxr.mozilla.org/mozilla-central/rev/9bb0f7fc73ad2109e4ea777e9ba65a16a6acc9cd/layout/generic/nsAbsoluteContainingBlock.cpp#136-137 You also might want to update the documentation at https://dxr.mozilla.org/mozilla-central/rev/9bb0f7fc73ad2109e4ea777e9ba65a16a6acc9cd/layout/generic/nsGridContainerFrame.h#162-163 which currently indicates that it's "not meant to be used elsewhere" (not for use outside of nsAbsoluteContainingBlock).
Attachment #9007896 - Flags: review?(dholbert) → review+
Good points, thanks. (Also, I meant s/unexpected-fail/unexpected-pass/ of course in my comment 3)
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/9a89fcb3c96c Use the stored CB on abs.pos. grid items when calculating used offset values. r=dholbert
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Flags: needinfo?(fremycompany_pub)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: