Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 22d6d63a50dd4148a61959043cfaca6179bdc3bf
      
https://github.com/WebKit/WebKit/commit/22d6d63a50dd4148a61959043cfaca6179bdc3bf
  Author: Alan Baradlay <[email protected]>
  Date:   2025-06-24 (Tue, 24 Jun 2025)

  Changed paths:
    A 
LayoutTests/fast/editing/incorrect-baseline-for-input-adjacent-content-expected.html
    A 
LayoutTests/fast/editing/incorrect-baseline-for-input-adjacent-content.html
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp

  Log Message:
  -----------
  Inputs within inline-block containers shift vertically when text is deleted 
and re-entered into an input
https://bugs.webkit.org/show_bug.cgi?id=294558
<rdar://problem/154094432>

Reviewed by Antti Koivisto.

1. RenderTextControlSingleLine's inner renderer is vertically centered.
2. RenderTextControlSingleLine's inner renderer provides the baseline position 
for the input box.
3. The baseline position is passed to inline layout and is used to align other 
content on the line (when baseline alignment applies).

As text is appended to the input box:

1. An empty RenderText is constructed and inserted into the tree.
2. InsertIntoTextNodeCommand::doApply() is called.
3. RenderText is populated by calling setText.

In step #2, layout is prematurely run on the content (see passwordEchoEnabled) 
before it is populated in step #3.
This layout generates an empty inline display content with a 0px-tall line box, 
which gets vertically centered.
This "centered line" then becomes the baseline for the rest of the content.
In step #3, another layout is run on the input box, this time with populated 
content, but the layout is limited to the input only, so adjacent content does 
not get alignment treatment.
This is how the offset occurs (result of the premature layout).

There are a few issues here:

1. We should not run layout on the empty content before RenderText is populated 
(webkit.org/b/294880).
2. RenderTextControlSingleLine should not center the inner renderer when it has 
no content (webkit.org/b/294881).
3. IFC should not report valid line boxes when there’s no content at all (i.e., 
when no display boxes are generated).

This patch addresses issue #3.

* 
LayoutTests/fast/editing/incorrect-baseline-for-input-adjacent-content-expected.html:
 Added.
* LayoutTests/fast/editing/incorrect-baseline-for-input-adjacent-content.html: 
Added.
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::firstLineBox const):
(WebCore::LayoutIntegration::LineLayout::lastLineBox const):

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



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

Reply via email to