Created attachment 707678 [details] Testcase Two buttons, one with height: 50px and the other with min-height: 50px have the same height as expected but have a different baseline.
The test case and the issue are coming from: http://stackoverflow.com/questions/14587372/misplacement-of-submit-type-input-in-firefox-when-using-min-height
This happens because the "center child vertically" bit in ReflowButtonContents happens before we adjust the height to take min-height into account (in Reflow). We should probably pass in the info needed to compute the right thing to ReflowButtonContents or something. Mounir, want to fix?
4 years ago
Hi, I'm new to bugzilla and would like to fix my first bug! Would this be a good one to start on? Thanks!
This one is fine, yes. Someone was looking at it at some point, but I haven't heard back from them in a while....
So to expand on comment 2, the way button reflow works right now is that we call ReflowButtonContents to reflow its contents, then set the height of the button based on the size of the contents (unless it has a non-auto height), then adjust the height based on min/max-height. The problem is that the vertical positioning of the button contents happens inside ReflowButtonContents, and uses the height available to it, which is the intrinsic height of the button unless a non-auto height is specified. But we already pass aReflowState to ReflowButtonContents, an it already writes to aDesiredSize.height. So the right thing is probably to move the application of min/max height (the entire block at http://hg.mozilla.org/mozilla-central/file/962f5293f87f/layout/forms/nsHTMLButtonControlFrame.cpp#l213 ) down into ReflowButtonContents, somewhere between the ReflowChild call (which computes the height of the child) and the "center child vertically" bit.
Hi, can I take this bug ?
Usurelu, could you confirm that you're still working on this?
Hi Josh, yes I am, I've run into some problems and I just can't see why it isn't working; now I'm a little busy, if I don't finish it by next week I'll leave it :( .
Please feel free to post what you have in the bug and ask me to look it over to see if anything jumps out at me. That's why I'm here!
Hi, I'm sorry but I won't be able to work on this bug for some time, please unassign me. Sorry :(
Not a problem. Just let me know when you have time again!
Created attachment 772365 [details] [diff] [review] Initial patch An initial patch based on bz's suggestion in comment 5 to move the aDesiredSize height calculation into ReflowButtonContents.
Comment on attachment 772365 [details] [diff] [review] Initial patch You definitely need to add the reftest to the reftest.list file so that it will be run.
Created attachment 772713 [details] [diff] [review] Updated patch Adding the test to the reftest.list file
Created attachment 772740 [details] [diff] [review] Updating reftest The reftests for forms were recently refactored into separate files. The updated patch takes this into account and moves the reftest to the layout/reftests/forms/button directory.
Comment on attachment 772740 [details] [diff] [review] Updating reftest You probably want to change the "If computed use the computed value" comment to say something like "Compute our desired height before we start vertically centering our kids". And please add the missing newlines to the end of your test files. r=me with those changes. Thank you for fixing this!
Created attachment 772842 [details] [diff] [review] Incorporating review feedback Thanks for the review! Added newlines to the test files, fixed the comment in nsHTMLButtonControlFrame.cpp, and shortened the log comment.
4 years ago