[webkit-dev] Improve selection with floats

Javier Fernandez jfernandez at igalia.com
Thu Sep 7 07:40:19 PDT 2017


I've been working lately on some cases where selection shows an
unpredictable behavior when applied to cases with float elements;
basically, selection boundaries jump when dragging over floats. I've
found this old bug (https://webkit.org/b/101771) which described some of
these cases. I've attached another case with the same problem.

This weird Selection's behavior is also present in Blink and Gecko:
  - https://crbug.com/758526
  - https://bugzilla.mozilla.org/show_bug.cgi?id=1397514

I'm aware of the issues we have with Selection when the Render Tree
differs from the DOM Tree's structure, but that's not the case of the
examples I've been evaluating so far; I think for these cases we can do

My theory is that the root cause of this issue in most, if not all, the
cases is that we are not considering floats as valid HitTest candidates.
Additionally, we exclude floats from the positionForPoint logic,
implemented in the different render objects.

I'm evaluating a preliminary approach based on considering floats as
valid HitTest candidates. I started to address a very specific case in
https://webkit.org/b/176096 and, if it gets enough support, I have plans
to continue addressing as many cases as possible.

I think we have to assume that we will have issues with floats when they
create complex render trees, like it happens with other layout models,
but at least we can improve the simplest cases.

I appreciate any feedback on my current approach and reviews of my
patches, if we finally want to give this proposal a shot.

More information about the webkit-dev mailing list