Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 96df1f16fca074e176035aa3c47bb90651e5038b
      
https://github.com/WebKit/WebKit/commit/96df1f16fca074e176035aa3c47bb90651e5038b
  Author: Alan Baradlay <[email protected]>
  Date:   2026-04-09 (Thu, 09 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height.html
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineQuirks.cpp

  Log Message:
  -----------
  <br />'s as direct children of <ul> between every two adjecent <li> elements 
causes misalignment
https://bugs.webkit.org/show_bug.cgi?id=17757

Reviewed by Antti Koivisto.

When you set line-height on a <br> element (e.g. br { line-height: 200px }),
the line containing the <br> should be 200px tall. Instead, the <br>'s
line-height was completely ignored and the line used the default font height.

Two things were wrong:

1. inlineLevelBoxAffectsLineBox() returned false for all line break boxes,
   meaning the <br>'s layout bounds never contributed to the line box height.
   Fixed: return true when the <br> has an explicit (non-normal) line-height.

2. The layout bounds for line break boxes were computed using only the parent
   inline box's font metrics, ignoring the <br>'s own line-height. Fixed:
   when line-height is explicit, apply the standard CSS half-leading model --
   compute the leading (line-height minus font metrics height), split it
   equally above and below the baseline, same as any inline box.

In quirks mode, there's an additional issue: when a <br> is the only
contentful box on a line, it tells its parent (the root inline box) that
it has "content." This causes the root inline box's font-metrics-based
layout bounds (18px) to stretch the line, regardless of the <br>'s own
line-height. With explicit line-height, the <br> should not mark the
parent as having content -- the <br>'s own layout bounds should drive
the line height directly. This lets line-height: 0 collapse the line
to zero, matching the behavior of other browsers in quirks mode.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height.html: 
Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-stretch-quirks.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-shrink-quirks.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-inline/br-line-height-zero-quirks.html:
 Added.
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingUtils.cpp:
(WebCore::Layout::InlineFormattingUtils::inlineLevelBoxAffectsLineBox const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::setVerticalPropertiesForInlineLevelBox const):
* Source/WebCore/layout/formattingContexts/inline/InlineQuirks.cpp:
(WebCore::Layout::InlineQuirks::lineBreakBoxAffectsParentInlineBox):

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



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

Reply via email to