Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a5b74fd0d393650eecb5acf6cd51ac67b7d44bc2
      
https://github.com/WebKit/WebKit/commit/a5b74fd0d393650eecb5acf6cd51ac67b7d44bc2
  Author: Alan Baradlay <za...@apple.com>
  Date:   2025-05-12 (Mon, 12 May 2025)

  Changed paths:
    A LayoutTests/fast/inline/input-button-content-center-expected.html
    A LayoutTests/fast/inline/input-button-content-center.html
    M Source/WebCore/rendering/updating/RenderTreeBuilderFormControls.cpp

  Log Message:
  -----------
  [button-layout] display: flex cause text not being centered in input type 
button
https://bugs.webkit.org/show_bug.cgi?id=292822

Reviewed by Antti Koivisto.

WebKit has been supporting <button> with 'display: flex' since 39015@main.

  <button style="display: flex">
    <span>button</span>
    <span>text</span>
  </button>

It turns <button> into a versatile container with many layout options.

We achieved it by making RenderButton's inner container a flex box.
  RenderButton (<button>)
    RenderFlexibleBox (inner, anonymous block container)
      RenderBlockFlow (<span>, flex item)
        RenderText ('button')

However starting from 228400@main, we no longer create RenderButton for flex 
<button>s,
but instead generate RenderFlexibleBox renderers (with no inner box).
  RenderFlexibleBox (<button>)
    RenderBlockFlow (<span>, flex item)

It also means we don't need to make the inner block a flex when the <button> 
has display flex.

Also 39015@main accidentally broke

  <input type=button style="display: flex" value="text">

case where the button's value ('text') ended up being treated as flex item 
breaking the simple button layout.
(The anon flex container should have been applied to only the <button> case and 
not the input type=button)

* LayoutTests/fast/inline/input-button-content-center-expected.html: Added.
* LayoutTests/fast/inline/input-button-content-center.html: Added.
* Source/WebCore/rendering/updating/RenderTreeBuilderFormControls.cpp:
(WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):

Canonical link: https://commits.webkit.org/294785@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to