- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 25 Apr 2013 14:05:03 -0400
- To: whatwg@lists.whatwg.org
On 4/25/13 1:58 PM, Christian Biesinger wrote: >> Gecko puts the baseline of the button at the baseline of the button's text, >> and if the button is not auto-height the extra height is added (or removed) >> equally from above and below the text. > > Hm, but I don't think that's completely correct, because then the > positioning should stay the same when I start entering text in the > button, right? Or does adding text make the text run have height, > affecting where the extra height gets added? If I recall exactly how this code works, if there is no text then the baseline goes at the bottom of the (empty) content box and then the extra height is added on both sides. Once you have text the baseline goes on the baseline of the text, which is slightly above the bottom of the content box to allow for descenders. > I think what you are saying is: in Gecko, baseline of a button is > (content_box_height - text_height) / 2 + text_ascent Mm.... Measured from where? > (BTW, where is that code located? I tried and failed to find it :( ) http://hg.mozilla.org/mozilla-central/file/690b5e0f6562/layout/forms/nsHTMLButtonControlFrame.cpp#l308 (see the GetBaseline() call and the adjustment by "yoff", where "yoff" is half of the extra height we have. This is computing the ascent of the box; the baseline position in the box is then considered to be "ascent" from the top. > I don't understand inline layout very well Does anyone? ;) -Boris
Received on Thursday, 25 April 2013 18:05:33 UTC