Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 47d8491450fb6c0c91c123bd0c0e322f0eaa8b22
      
https://github.com/WebKit/WebKit/commit/47d8491450fb6c0c91c123bd0c0e322f0eaa8b22
  Author: Yulun Wu <[email protected]>
  Date:   2026-06-17 (Wed, 17 Jun 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    M 
LayoutTests/platform/glib/fast/block/basic/fieldset-stretch-to-legend-expected.txt
    M LayoutTests/platform/glib/fast/borders/fieldsetBorderRadius-expected.txt
    M LayoutTests/platform/ios/fast/borders/fieldsetBorderRadius-expected.txt
    M 
LayoutTests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.txt
    M LayoutTests/platform/mac/fast/borders/fieldsetBorderRadius-expected.txt
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderBlock.h

  Log Message:
  -----------
  [Margin][Legend] Positive margin on fieldset legends should shift the 
fieldset down.
https://bugs.webkit.org/show_bug.cgi?id=284441
rdar://141267953

Reviewed by Alan Baradlay.

Webkit and Blink currently ignore block-start margin on a fieldset's
<legend>. The HTML spec for fieldset/legend says:

"The space allocated for the element's border on the block-start side is 
expected to be the
element's 'border-block-start-width' or the rendered legend's margin box size 
in the
fieldset's block-flow direction, whichever is greater."

https://html.spec.whatwg.org/multipage/rendering.html#the-fieldset-and-legend-elements

Our current implementation only handles border-block-start-width via
fieldsetBorderBefore() but never handles the legend's before margin.

Ths PR adds intrinsicMarginBeforeForFieldset() to add the legend's margin
onto the fieldset's marginBefore(), shifting the fieldset down with the legend.

This change fixes the WPT "legend-block-margins.html"

We also need to rebaseline:

basic/fieldset-stretch-to-legend-expected
fieldsetBorderRadius-expected

As we are now handling:

  <legend style="width: 90px; margin: 30px;"></legend>

* LayoutTests/TestExpectations:
* 
LayoutTests/platform/glib/fast/block/basic/fieldset-stretch-to-legend-expected.txt:
* LayoutTests/platform/glib/fast/borders/fieldsetBorderRadius-expected.txt:
* LayoutTests/platform/ios/fast/borders/fieldsetBorderRadius-expected.txt:
* 
LayoutTests/platform/mac/fast/block/basic/fieldset-stretch-to-legend-expected.txt:
* LayoutTests/platform/mac/fast/borders/fieldsetBorderRadius-expected.txt:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutExcludedChildren):
(WebCore::RenderBlock::intrinsicMarginBeforeForFieldset const):
(WebCore::RenderBlock::setIntrinsicMarginBeforeForFieldset):
(WebCore::RenderBlock::marginBefore const):
* Source/WebCore/rendering/RenderBlock.h:
(WebCore::RenderBlock::marginBefore const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to