Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e10f145ce64951e5b0333135fbb6b6b55aea0cee
      
https://github.com/WebKit/WebKit/commit/e10f145ce64951e5b0333135fbb6b6b55aea0cee
  Author: Alan Baradlay <za...@apple.com>
  Date:   2023-05-09 (Tue, 09 May 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderElement.cpp

  Log Message:
  -----------
  [Repaint] Cleanup RenderElement::repaintAfterLayoutIfNeeded
https://bugs.webkit.org/show_bug.cgi?id=256537

Reviewed by Simon Fraser.

1. Rename incoming parameters to indicate
  - whether they are clipped or unclipped
  - what they actually include (outline vs. outline and box shadow)
2. Remove redundant/misleading comment(s) (e.g. 16814@main changed the "We 
didn't move, but we did change size." part where now size changing gets handles 
both before and after the comment).
3. Introduce helper functions for each CSS property that may expand the damaged 
area (they make this additional repaint logic easier to reason about).

Let's look at a very simple example (box shrinks vertically).

before:

    70px
 _________
|         |
|         |  100px
|         |
|         |
|_________|

after:

    70px
 _________
|         |
|         |  60px
|_________|

With no decoration (assume these box lines are not borders/outlines etc like 
<div style="width: 70px; height: 100px; background-color: green"></div>) on 
this box,
the "delta" logic (above the cleanup part) completely takes care the damaged 
area by issuing a repaint at [0px, 60px, 70px, 40px].
The subsequent paint will put some new pixels in there removing all the old 
content (background color).

    70px
 _________
|         |
|         |  60px
|_________|
***********
***********

(where '*' means damaged pixel)

However with some decorations (and let's just go with the simplest case here; a 
border), without damaging additional canvas space
the bottom decoration (border) would not be visible at all after the subsequent 
paint.

    70px
 _________
|         |
|         |  60px
|         |

^^ we issue repaint on the pixels where the border used to be, but not where it 
is now.

So instead we need to extend the repaint rect by finding out what else we have 
in that box that need additional paint (e.g. border, negative outline, inset 
box shadow etc).
(and that's what this change is about).

    70px
 _________
|         |
|         |  60px
***********
***********
***********

* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::repaintAfterLayoutIfNeeded):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to