Changeset 281136 in webkit


Ignore:
Timestamp:
Aug 17, 2021 7:11:22 AM (11 months ago)
Author:
Antti Koivisto
Message:

Incorrect repaint when inline level box style change triggers line height change
https://bugs.webkit.org/show_bug.cgi?id=229140
<rdar://problem/81980863>

Reviewed by Alan Bujtas.

Source/WebCore:

If an existing block shrinks vertically as a result of layout we fail to invalidate the
old content area for repaint, thus potentially leaving painting artefacts behind.
This is often hidden by the content shift triggering other repaints.

Test: fast/repaint/line-layout-block-shrink.html

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::layoutModernLines):

Adjust the repaint area to include the content size before the layout.

LayoutTests:

  • fast/repaint/line-layout-block-shrink-expected.txt: Added.
  • fast/repaint/line-layout-block-shrink.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r281134 r281136  
     12021-08-17  Antti Koivisto  <antti@apple.com>
     2
     3        Incorrect repaint when inline level box style change triggers line height change
     4        https://bugs.webkit.org/show_bug.cgi?id=229140
     5        <rdar://problem/81980863>
     6
     7        Reviewed by Alan Bujtas.
     8
     9        * fast/repaint/line-layout-block-shrink-expected.txt: Added.
     10        * fast/repaint/line-layout-block-shrink.html: Added.
     11
    1122021-08-17  Jean-Yves Avenard  <jya@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r281135 r281136  
     12021-08-17  Antti Koivisto  <antti@apple.com>
     2
     3        Incorrect repaint when inline level box style change triggers line height change
     4        https://bugs.webkit.org/show_bug.cgi?id=229140
     5        <rdar://problem/81980863>
     6
     7        Reviewed by Alan Bujtas.
     8
     9        If an existing block shrinks vertically as a result of layout we fail to invalidate the
     10        old content area for repaint, thus potentially leaving painting artefacts behind.
     11        This is often hidden by the content shift triggering other repaints.
     12
     13        Test: fast/repaint/line-layout-block-shrink.html
     14
     15        * rendering/RenderBlockFlow.cpp:
     16        (WebCore::RenderBlockFlow::layoutModernLines):
     17
     18        Adjust the repaint area to include the content size before the layout.
     19
    1202021-08-17  Philippe Normand  <pnormand@igalia.com>
    221
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r279918 r281136  
    37323732    }
    37333733
     3734    auto contentBoxTop = borderAndPaddingBefore();
     3735
     3736    auto computeContentHeight = [&] {
     3737        if (!hasLines() && hasLineIfEmpty())
     3738            return lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
     3739
     3740        return layoutFormattingContextLineLayout.contentLogicalHeight();
     3741    };
     3742
     3743    auto computeBorderBoxBottom = [&] {
     3744        auto contentBoxBottom = contentBoxTop + computeContentHeight();
     3745        return contentBoxBottom + borderAndPaddingAfter();
     3746    };
     3747
     3748    auto oldBorderBoxBottom = computeBorderBoxBottom();
     3749
    37343750    layoutFormattingContextLineLayout.layout();
    37353751
     
    37373753        layoutFormattingContextLineLayout.adjustForPagination();
    37383754
    3739     auto contentHeight = [&] {
    3740         if (!hasLines() && hasLineIfEmpty())
    3741             return lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
    3742        
    3743         return layoutFormattingContextLineLayout.contentLogicalHeight();
    3744     }();
    3745     auto contentBoxTop = borderAndPaddingBefore();
    3746     auto contentBoxBottom = contentBoxTop + contentHeight;
    3747     auto borderBoxBottom = contentBoxBottom + borderAndPaddingAfter();
     3755    auto newBorderBoxBottom = computeBorderBoxBottom();
    37483756
    37493757    repaintLogicalTop = contentBoxTop;
    3750     repaintLogicalBottom = borderBoxBottom;
    3751     setLogicalHeight(borderBoxBottom);
     3758    repaintLogicalBottom = std::max(oldBorderBoxBottom, newBorderBoxBottom);
     3759
     3760    setLogicalHeight(newBorderBoxBottom);
    37523761}
    37533762#endif
Note: See TracChangeset for help on using the changeset viewer.