Closed Bug 1306894 Opened 8 years ago Closed 8 years ago

[css-flexbox] nsFlexContainerFrame needs to implement GetLogicalBaseline

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: bradwerth)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached file testcase
No description provided.
BTW, I think bug 1307806 is also needed to make the testcase work as expected.
Depends on: 1307806
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
(In reply to Daniel Holbert [:dholbert]) > (Yeah, the flex container's baseline gets set (not-entirely-correctly) here: > > aDesiredSize.SetBlockStartAscent(flexContainerAscent); > https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsFlexContainerFrame.cpp#4217 > > We could cache that on the frame in a member-variable, if that tends to > match what we do elsewhere for storing baselines.) Sounds good to me, with the usual NS_INTRINSIC_WIDTH_UNKNOWN init + assertion.
Blocks: css-align-3
Assignee: nobody → bwerth
Comment on attachment 8799910 [details] Bug 1306894 Part 1: Cache baseline from nsFlexContainerFrame::Reflow() for use in later calls to GetLogicalBaseline(). https://reviewboard.mozilla.org/r/84982/#review83552 r=me with "virtual" nit addressed ::: layout/generic/nsFlexContainerFrame.h:80 (Diff revision 1) > virtual nsIAtom* GetType() const override; > #ifdef DEBUG_FRAME_DUMP > virtual nsresult GetFrameName(nsAString& aResult) const override; > #endif > + > + virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override; Don't use the "virtual" keyword here. ("override" already implies it, which is why our coding style guide says to only use one of override|virtual|final.) The contextual code does use both, but that's simply because it's from before we added that coding style guideline (and we have yet to clean it up). ::: layout/generic/nsFlexContainerFrame.cpp:2141 (Diff revision 1) > +nsFlexContainerFrame::GetLogicalBaseline(mozilla::WritingMode aWM) const > +{ > + NS_ASSERTION(mBaselineFromLastReflow != NS_INTRINSIC_WIDTH_UNKNOWN, > + "baseline has not been set"); > + > + return mBaselineFromLastReflow; I wonder if we should be doing something with |aWM| here? (probably comparing it to our own) I guess we don't do that in other implementations, like in nsGridContainerFrame.h, nsBRFrame.cpp, & to a lesser extent nsFormControlFrame.cpp. Maybe we're getting lucky about the way this function happens to be called... Anyway, this is probably fine for now.
Attachment #8799910 - Flags: review?(dholbert) → review+
Lovely! Does the attached testcase work with this change? If so, could you please uncomment the TODO case in this reftest? http://searchfox.org/mozilla-central/source/layout/reftests/css-grid/grid-container-baselines-004.html (hopefully it should just work)
Flags: needinfo?(bwerth)
(In reply to Mats Palmgren (:mats) from comment #6) > Lovely! Does the attached testcase work with this change? Yes, it does fix the attached testcase. Thank you for pointing out grid-container-baselines-004 -- I was thinking I'd have to create a new reftest. Part 2 of the patch updates that reftest.
Flags: needinfo?(bwerth)
Comment on attachment 8799965 [details] Bug 1306894 Part 2: Update the grid-container-baselines-004 reftest to exercise baseline alignment of flexboxes within grid containers. https://reviewboard.mozilla.org/r/85016/#review83568 Two commit message nits: > Updated the grid-container-baselines-004 reftest. (1) s/Updated/Update/ (we tend to use *present* active tense, rather than past tense, when describing the change in commit message) (2) It'd be nice to have a bit more detail on the change here. "Update this test" doesn't really say much. Better would be: "Uncomment the flex-container-dependent part of grid-container-baselines-004 reftest." (I had these same thoughts about parts 3-9 on bug 1221565, but I didn't bring them up there because it would've been a lot of commit-message-rewriting, for marginal benefit. :) I'm bringing them up here since now there's only one patch to update, and since I think they're good best practices to get used to.)
Comment on attachment 8799965 [details] Bug 1306894 Part 2: Update the grid-container-baselines-004 reftest to exercise baseline alignment of flexboxes within grid containers. https://reviewboard.mozilla.org/r/85016/#review83572 [sorry, I meant to set this to "r+" with my previous comment -- r=me with those commit message nits addressed.]
Attachment #8799965 - Flags: review?(dholbert) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2e88bcc7f1bc Part 1: Cache baseline from nsFlexContainerFrame::Reflow() for use in later calls to GetLogicalBaseline(). r=dholbert https://hg.mozilla.org/integration/autoland/rev/570c8ad43113 Part 2: Update the grid-container-baselines-004 reftest to exercise baseline alignment of flexboxes within grid containers. r=dholbert
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: