Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ebc6a3e50a6dbbc291c318aeacef55cf774452e8
      
https://github.com/WebKit/WebKit/commit/ebc6a3e50a6dbbc291c318aeacef55cf774452e8
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-12 (Wed, 12 Aug 2026)

  Changed paths:
    A 
LayoutTests/editing/selection/caret-from-point-above-leading-float-expected.txt
    A LayoutTests/editing/selection/caret-from-point-above-leading-float.html
    M Source/WebCore/rendering/RenderBlock.cpp

  Log Message:
  -----------
  [block-in-inline] A float is not offered to the caret when its container has 
a block level box on a line
https://bugs.webkit.org/show_bug.cgi?id=321472

Reviewed by Antti Koivisto.

RenderBlock::positionForPoint answers a point above its content with the first 
child the point is above,
walking the children in document order. isChildHitTestCandidate takes floats, 
so a float that leads the
container is what a point above it resolves to.

A container whose children are a mix of inline and block level content takes 
positionForPointWithInlineChildren
instead. That walks line boxes, and while PlacedFloats does record the line 
that placed each float, a float
never gets a display box, so the line box iterators cannot reach one. The caret 
goes to the first line's
leading box, which for such a container is the block level box on it.

Answer from the leading floats before taking the inline children walk, and only 
for a container that has a
block level box on a line, so that a container with inline content only keeps 
resolving the point with its
lines. The float walk stops at the first child that is not floating, so it only 
speaks for floats that come
before any other content.

* LayoutTests/editing/selection/caret-from-point-above-leading-float.html: 
Added.
* 
LayoutTests/editing/selection/caret-from-point-above-leading-float-expected.txt:
 Added.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPoint):

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



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

Reply via email to