-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering rules for buttons #4081
Comments
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6267 Edge: button (inline) is underlined. |
Investigation of computed style for certain properties for button (default), button (no theme), input (default), input (no theme): |
In Gecko buttons (both Inside this box is an anonymous box which is basically a block formatting context with shrink-wrapping behavior. This has some styles applied at https://searchfox.org/mozilla-central/rev/65f9687eb192f8317b4e02b0b791932eff6237cc/layout/style/res/forms.css#646-678 and https://searchfox.org/mozilla-central/rev/65f9687eb192f8317b4e02b0b791932eff6237cc/layout/style/res/forms.css#794-799 Child boxes go inside this anonymous box. During layout the inner box is centered in the outer box, if possible. See https://searchfox.org/mozilla-central/source/layout/forms/nsHTMLButtonControlFrame.cpp#229.
Yep. See discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=491180 that led to this behavior in Firefox. |
I don't know the detail of button layout.
|
@cbiesinger do you know how button layout works in chromium? Or do you know who knows? |
Can you elaborate? Does this refer to dimensions of the box being like replaced elements, with intrinsic dimensions matching the anon child box? |
Oh, there's more in https://searchfox.org/mozilla-central/rev/1ce4e8a5601da8e744ca6eda69e782318afab54d/layout/generic/ReflowInput.cpp -- this flag affects hypothetical box computations for auto-offset abspos things, the thing above wit width sizing for abspos things, height styles work even if "display: inline". I think that's it.... |
Thanks! |
I've started a draft specification covering buttons at https://docs.google.com/document/d/1FE5YIoirPKxYbbnMd8kS6w39M8bzLTl5tf4wwOxR1wc/edit?usp=sharing |
That's correct. The child box may be a flexbox if display: flex is specified on the button. We copy various styles to the child box here: Let me know if you have any further questions. |
What's the benefit of using flexbox over the approach gecko uses? Or vice versa? What should I require in the spec? |
This seems to apply to I'm not sure I understand the effect of this. What would a test look like? |
I don't think you should require flexbox in the spec for this purpose. I believe the only reason we currently use it is because that was an expedient way to center the content; long-term I'd like to get rid of it. |
This specifies the layout model of buttons (the button element, the input element in the Button, Reset, Submit states, and the button part of input in the File Upload state). Fixes #1024. Fixes #2948. Fixes #4081. Part of #4082. Tests: web-platform-tests/wpt#14824 Bugs: https://bugs.chromium.org/p/chromium/issues/detail?id=962936 https://bugs.webkit.org/show_bug.cgi?id=197879 https://bugzilla.mozilla.org/show_bug.cgi?id=1539469
The spec right now says
This doesn't really match browsers.
If you specify
display: block
, that is honored but the button itself still shrinkwraps. In Chromium I believe the button is a flexbox (inline-flex if display is inline-level?) and it has an anonymous child box that is the actual button. @tkent-google can you confirm/elaborate? What causes author styles to apply to the inner box? What happens if you click the outer box (doesn't seem to activate the button)? @MatsPalmgren @jwatt @bzbarsky what does Gecko do?Some author styles such as setting a background causes the native theme (via -webkit-appearance) to be ignored and fallback style to be used instead. It's unclear to me which styles exactly trigger this, and if it's different for different controls. I found this for Chromium but it seems to unconditionally return the same value?
Overflow is clipped on
input
element buttons but not forbutton
s.The text was updated successfully, but these errors were encountered: