W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2013

Re: [whatwg] Alignment of empty buttons

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 25 Apr 2013 14:05:03 -0400
Message-ID: <5179704F.4000301@mit.edu>
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 :( )

(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?  ;)

Received on Thursday, 25 April 2013 18:05:33 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:57 UTC