Title: [291639] branches/safari-613-branch
Revision
291639
Author
alanc...@apple.com
Date
2022-03-22 10:54:57 -0700 (Tue, 22 Mar 2022)

Log Message

Cherry-pick r290645. rdar://problem/89180092

    REGRESSION (r273129): Text contents in <span> with opacity not repainting/updating when sibling element has "will-change: transform"
    https://bugs.webkit.org/show_bug.cgi?id=236876
    <rdar://problem/89180092>

    Reviewed by Simon Fraser.

    Source/WebCore:

    This patch implements a slightly naive repaint for inline boxes with self painting layers.
    1. Mark the line when it gains an inline box (RenderInline) with self painting layer (e.g. <span style="position: relative">this has dedicated layer</span>)
    2. Issue repaint at the end of the line layout on such renderers.

    Test: fast/repaint/inline-box-with-self-paint-layer.html

    * rendering/LegacyInlineFlowBox.cpp:
    (WebCore::LegacyInlineFlowBox::addToLine):
    * rendering/LegacyInlineFlowBox.h:
    (WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
    (WebCore::LegacyInlineFlowBox::hasSelfPaintInlineBox const):
    * rendering/LegacyLineLayout.cpp:
    (WebCore::repaintSelfPaintInlineBoxes):
    (WebCore::LegacyLineLayout::layoutRunsAndFloats):
    * rendering/RenderInline.cpp:
    (WebCore::RenderInline::clippedOverflowRect const): expand the ASSERT to enclsing inline boxes too.

    LayoutTests:

    * fast/repaint/inline-box-with-self-paint-layer-expected.html: Added.
    * fast/repaint/inline-box-with-self-paint-layer.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290645 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (291638 => 291639)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-22 17:54:57 UTC (rev 291639)
@@ -1,5 +1,53 @@
 2022-03-21  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r290645. rdar://problem/89180092
+
+    REGRESSION (r273129): Text contents in <span> with opacity not repainting/updating when sibling element has "will-change: transform"
+    https://bugs.webkit.org/show_bug.cgi?id=236876
+    <rdar://problem/89180092>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    This patch implements a slightly naive repaint for inline boxes with self painting layers.
+    1. Mark the line when it gains an inline box (RenderInline) with self painting layer (e.g. <span style="position: relative">this has dedicated layer</span>)
+    2. Issue repaint at the end of the line layout on such renderers.
+    
+    Test: fast/repaint/inline-box-with-self-paint-layer.html
+    
+    * rendering/LegacyInlineFlowBox.cpp:
+    (WebCore::LegacyInlineFlowBox::addToLine):
+    * rendering/LegacyInlineFlowBox.h:
+    (WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
+    (WebCore::LegacyInlineFlowBox::hasSelfPaintInlineBox const):
+    * rendering/LegacyLineLayout.cpp:
+    (WebCore::repaintSelfPaintInlineBoxes):
+    (WebCore::LegacyLineLayout::layoutRunsAndFloats):
+    * rendering/RenderInline.cpp:
+    (WebCore::RenderInline::clippedOverflowRect const): expand the ASSERT to enclsing inline boxes too.
+    
+    LayoutTests:
+    
+    * fast/repaint/inline-box-with-self-paint-layer-expected.html: Added.
+    * fast/repaint/inline-box-with-self-paint-layer.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-01  Alan Bujtas  <za...@apple.com>
+
+            REGRESSION (r273129): Text contents in <span> with opacity not repainting/updating when sibling element has "will-change: transform"
+            https://bugs.webkit.org/show_bug.cgi?id=236876
+            <rdar://problem/89180092>
+
+            Reviewed by Simon Fraser.
+
+            * fast/repaint/inline-box-with-self-paint-layer-expected.html: Added.
+            * fast/repaint/inline-box-with-self-paint-layer.html: Added.
+
+2022-03-21  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r290615. rdar://problem/87919197
 
     Handle widow relayout differently

Added: branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html (0 => 291639)


--- branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html	2022-03-22 17:54:57 UTC (rev 291639)
@@ -0,0 +1,7 @@
+<style>
+span {
+  font-family: Monospace;
+  position: relative;
+}
+</style>
+<div><span>PASS if this text ends in '1': 1</span></div>

Added: branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html (0 => 291639)


--- branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html	2022-03-22 17:54:57 UTC (rev 291639)
@@ -0,0 +1,28 @@
+<style>
+.sibling {
+  will-change: transform;
+}
+
+#changeThis {
+  font-family: Monospace;
+  position: relative;
+}
+</style>
+<div class=sibling></div>
+<div><span id=changeThis>PASS if this text ends in '1': 0</span></div>
+<script src=""
+<script>
+if (window.testRunner)
+  testRunner.waitUntilDone();
+
+async function runTest() {
+  document.body.offsetHeight;
+  await UIHelper.renderingUpdate();
+  changeThis.firstChild.nodeValue = "PASS if this text ends in '1': 1";
+  await UIHelper.renderingUpdate();
+  if (window.testRunner)
+    testRunner.notifyDone();
+}
+
+window.addEventListener('load', runTest);
+</script>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291638 => 291639)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-22 17:54:57 UTC (rev 291639)
@@ -1,5 +1,67 @@
 2022-03-21  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r290645. rdar://problem/89180092
+
+    REGRESSION (r273129): Text contents in <span> with opacity not repainting/updating when sibling element has "will-change: transform"
+    https://bugs.webkit.org/show_bug.cgi?id=236876
+    <rdar://problem/89180092>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    This patch implements a slightly naive repaint for inline boxes with self painting layers.
+    1. Mark the line when it gains an inline box (RenderInline) with self painting layer (e.g. <span style="position: relative">this has dedicated layer</span>)
+    2. Issue repaint at the end of the line layout on such renderers.
+    
+    Test: fast/repaint/inline-box-with-self-paint-layer.html
+    
+    * rendering/LegacyInlineFlowBox.cpp:
+    (WebCore::LegacyInlineFlowBox::addToLine):
+    * rendering/LegacyInlineFlowBox.h:
+    (WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
+    (WebCore::LegacyInlineFlowBox::hasSelfPaintInlineBox const):
+    * rendering/LegacyLineLayout.cpp:
+    (WebCore::repaintSelfPaintInlineBoxes):
+    (WebCore::LegacyLineLayout::layoutRunsAndFloats):
+    * rendering/RenderInline.cpp:
+    (WebCore::RenderInline::clippedOverflowRect const): expand the ASSERT to enclsing inline boxes too.
+    
+    LayoutTests:
+    
+    * fast/repaint/inline-box-with-self-paint-layer-expected.html: Added.
+    * fast/repaint/inline-box-with-self-paint-layer.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-01  Alan Bujtas  <za...@apple.com>
+
+            REGRESSION (r273129): Text contents in <span> with opacity not repainting/updating when sibling element has "will-change: transform"
+            https://bugs.webkit.org/show_bug.cgi?id=236876
+            <rdar://problem/89180092>
+
+            Reviewed by Simon Fraser.
+
+            This patch implements a slightly naive repaint for inline boxes with self painting layers.
+            1. Mark the line when it gains an inline box (RenderInline) with self painting layer (e.g. <span style="position: relative">this has dedicated layer</span>)
+            2. Issue repaint at the end of the line layout on such renderers.
+
+            Test: fast/repaint/inline-box-with-self-paint-layer.html
+
+            * rendering/LegacyInlineFlowBox.cpp:
+            (WebCore::LegacyInlineFlowBox::addToLine):
+            * rendering/LegacyInlineFlowBox.h:
+            (WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
+            (WebCore::LegacyInlineFlowBox::hasSelfPaintInlineBox const):
+            * rendering/LegacyLineLayout.cpp:
+            (WebCore::repaintSelfPaintInlineBoxes):
+            (WebCore::LegacyLineLayout::layoutRunsAndFloats):
+            * rendering/RenderInline.cpp:
+            (WebCore::RenderInline::clippedOverflowRect const): expand the ASSERT to enclsing inline boxes too.
+
+2022-03-21  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r290618. rdar://problem/89585043
 
     Remove release assert when UI process is blocking IOSurface IOKit access

Modified: branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.cpp (291638 => 291639)


--- branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.cpp	2022-03-22 17:54:57 UTC (rev 291639)
@@ -186,6 +186,8 @@
         if (knownToHaveNoOverflow() && is<LegacyInlineFlowBox>(*child) && !downcast<LegacyInlineFlowBox>(*child).knownToHaveNoOverflow())
             clearKnownToHaveNoOverflow();
     }
+    if (auto* renderInline = dynamicDowncast<RenderInline>(child->renderer()); renderInline && renderInline->hasSelfPaintingLayer())
+        m_hasSelfPaintInlineBox = true;
 
     checkConsistency();
 }

Modified: branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.h (291638 => 291639)


--- branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.h	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/Source/WebCore/rendering/LegacyInlineFlowBox.h	2022-03-22 17:54:57 UTC (rev 291639)
@@ -51,6 +51,7 @@
         , m_hasAnnotationsAfter(false)
         , m_isFirstAfterPageBreak(false)
         , m_isForTrailingFloats(false)
+        , m_hasSelfPaintInlineBox(false)
 #if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
         , m_hasBadChildList(false)
 #endif
@@ -286,6 +287,8 @@
 
     void computeReplacedAndTextLineTopAndBottom(LayoutUnit& lineTop, LayoutUnit& lineBottom) const;
 
+    bool hasSelfPaintInlineBox() const { return m_hasSelfPaintInlineBox; }
+
 private:
     bool isInlineFlowBox() const final { return true; }
     void boxModelObject() const = delete;
@@ -320,6 +323,7 @@
 
     unsigned m_isFirstAfterPageBreak : 1;
     unsigned m_isForTrailingFloats : 1;
+    unsigned m_hasSelfPaintInlineBox : 1;
 
     // End of RootInlineBox-specific members.
 

Modified: branches/safari-613-branch/Source/WebCore/rendering/LegacyLineLayout.cpp (291638 => 291639)


--- branches/safari-613-branch/Source/WebCore/rendering/LegacyLineLayout.cpp	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/Source/WebCore/rendering/LegacyLineLayout.cpp	2022-03-22 17:54:57 UTC (rev 291639)
@@ -1311,6 +1311,20 @@
     }
 }
 
+static void repaintSelfPaintInlineBoxes(const LegacyRootInlineBox& firstRootInlineBox, const LegacyRootInlineBox& lastRootInlineBox)
+{
+    for (auto* rootInlineBox = &firstRootInlineBox; rootInlineBox; rootInlineBox = rootInlineBox->nextRootBox()) {
+        if (rootInlineBox->hasSelfPaintInlineBox()) {
+            for (auto* inlineBox = rootInlineBox->firstChild(); inlineBox; inlineBox = inlineBox->nextOnLine()) {
+                if (auto* renderer = dynamicDowncast<RenderLayerModelObject>(inlineBox->renderer()); renderer && renderer->hasSelfPaintingLayer())
+                    renderer->repaint();
+            }
+        }
+        if (rootInlineBox == &lastRootInlineBox)
+            break;
+    }
+}
+
 void LegacyLineLayout::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInlineChild)
 {
     // We want to skip ahead to the first dirty line
@@ -1372,6 +1386,8 @@
     layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineBidiStatus, consecutiveHyphenatedLines);
     linkToEndLineIfNeeded(layoutState);
     repaintDirtyFloats(layoutState.floatList());
+    if (firstRootBox())
+        repaintSelfPaintInlineBoxes(*firstRootBox(), layoutState.endLine() ? *layoutState.endLine() : *lastRootBox());
 }
 
 // Before restarting the layout loop with a new logicalHeight, remove all floats that were added and reset the resolver.

Modified: branches/safari-613-branch/Source/WebCore/rendering/RenderInline.cpp (291638 => 291639)


--- branches/safari-613-branch/Source/WebCore/rendering/RenderInline.cpp	2022-03-22 17:54:53 UTC (rev 291638)
+++ branches/safari-613-branch/Source/WebCore/rendering/RenderInline.cpp	2022-03-22 17:54:57 UTC (rev 291639)
@@ -569,7 +569,19 @@
 LayoutRect RenderInline::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const
 {
     // Only first-letter renderers are allowed in here during layout. They mutate the tree triggering repaints.
-    ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled() || style().styleType() == PseudoId::FirstLetter || hasSelfPaintingLayer());
+#ifndef NDEBUG
+    auto insideSelfPaintingInlineBox = [&] {
+        if (hasSelfPaintingLayer())
+            return true;
+        auto* containingBlock = this->containingBlock();
+        for (auto* ancestor = this->parent(); ancestor && ancestor != containingBlock; ancestor = ancestor->parent()) {
+            if (ancestor->hasSelfPaintingLayer())
+                return true;
+        }
+        return false;
+    };
+    ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled() || style().styleType() == PseudoId::FirstLetter || insideSelfPaintingInlineBox());
+#endif
 
     auto knownEmpty = [&] {
         if (firstLineBox())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to