[webkit-changes] [WebKit/WebKit] df850b: <textarea> with float:left disappears when editing...

Alan Baradlay noreply at github.com
Wed Jun 7 09:52:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: df850bbc342ee6caba4371b51ccfde480ab6db54
      https://github.com/WebKit/WebKit/commit/df850bbc342ee6caba4371b51ccfde480ab6db54
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-06-07 (Wed, 07 Jun 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderLayer.cpp

  Log Message:
  -----------
  <textarea> with float:left disappears when editing text
https://bugs.webkit.org/show_bug.cgi?id=132188
<rdar://problem/110093535>

Reviewed by Simon Fraser.

Consider the following example:
 <div id=top>
   <div id=middle>
     <div id=float_box style="width: 100px; height: 100px;"></div>
   </div>
 </div>
1. A float box can intrude into multiple containers ("top" and "middle").
2. Containers construct FloatingObjects for intruding floats (multiple FloatingObjects can point to the same float when it crosses containers).
3. Float boxes (usually) are painted by the top most container where they intrude ("top").
4. However self-painting float boxes always paint themselves (this is not specific to floats, all renderers behave like this).
5. FloatingObject's m_paintsFloat controls which container is responsible for painting the (non-self-painting) float box.

When a float box goes from self-painting to non-self painting, we need to ensure that one of its containers takes care of painting it
by adjusting the associated FloatingObject's paint flag.
It is usually done as part of the layout process at RenderBlockFlow::addIntrudingFloats when containers finish running layout
on their child renderers (including float boxes) (i.e. the containing block chain takes care of updating this bit).

However when the float box is the root of the layout (i.e. subtree layout) none of its containers get the chance to update this paint flag since
layout flow never reaches said ancestors. (note when the layout's entry point is the float box, it's guaranteed that
none of the intruding/overhanging properties change at the containing block level (i.e. no need to extend the layout to the ancestor chain).
At this point this is really only about ensuring that one of the ancestors (through the already constructed FloatingObjects) starts painting this float box.

* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::updateFloatBoxAfterSelfPaintingLayerChange):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):

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




More information about the webkit-changes mailing list