Closed Bug 946273 Opened 7 years ago Closed 7 years ago

Add unit tests for -moz-box-sizing:border-box on a flex container and/or flex items

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(3 files)

Per bug 939901 comment 18, we should add some unit tests with -moz-box-sizing: border-box on flex containers, as well as on flex items.
Summary: Add unit tests for -moz-box-sizing:border-box on a flex container → Add unit tests for -moz-box-sizing:border-box on a flex container and/or flex items
In my local tests so far (w/ "-moz-box-sizing: border-box" on flex container & also on items, in some simple situations), things seem to be working correctly here.

Diego, would you mind posting a testcase (ideally as an attachment on this bug) that demonstrates the issues you were hitting in bug 939901 comment 51?
Flags: needinfo?(diegobfernandez)
As soon as multiline landed I started a small project to demonstrate flexbox to my company partners
https://github.com/diegobfernandez/HolyGrailFlexbox
can be viewed in https://c9.io/diegobf/github_holygrailflexbox/workspace/index.html

After your request I tried to reproduce it but now I can't.
Maybe I have just missed something.

Sorry.
Flags: needinfo?(diegobfernandez)
(In reply to diegobfernandez from comment #2)
> As soon as multiline landed I started a small project to demonstrate flexbox
> to my company partners

Looks nice!

> After your request I tried to reproduce it but now I can't.
> Maybe I have just missed something.
> 
> Sorry.

No worries. I'll take that as good news. :) Please do file a bug (or mention here) if you end up being able to reproduce later, though.
This patch adds 2 reftests:
 - one with "box-sizing:border-box" on a horizontal container
 - one with "box-sizing:border-box" on flex items *in* a horizontal container, in 4 different configurations.

In both cases, we do (what I believe is) the right thing -- we behave just as if the "width" had been specified as being a bit less (smaller by the amount of the border in that axis). Conveniently, this "just works" due to how nsHTMLReflowState sets up mComputedWidth and mComputedHeight. (This didn't require any special code in nsFlexContainerFrame.)
Attachment #8350186 - Flags: review?(matspal)
>  - one with "box-sizing:border-box" on flex items *in* a horizontal
> container, in 4 different configurations.

This adds a "hg cp" variant of that ^^ test, with the flex items' sizing coming from "flex-basis" instead of "width"
Attachment #8350189 - Flags: review?(matspal)
...and this patch adds vertical variants of all of these tests (using hg cp + tweaks).
Attachment #8350190 - Flags: review?(matspal)
Attachment #8350186 - Flags: review?(matspal) → review+
Attachment #8350189 - Flags: review?(matspal) → review+
Comment on attachment 8350190 [details] [diff] [review]
part 3: add testcases with vertical flex containers

r=mats
Attachment #8350190 - Flags: review?(matspal) → review+
You need to log in before you can comment on or make changes to this bug.