Title: [272662] trunk
Revision
272662
Author
an...@apple.com
Date
2021-02-10 10:26:43 -0800 (Wed, 10 Feb 2021)

Log Message

[LFC][Integration] Paint invalidation for inline element style changes
https://bugs.webkit.org/show_bug.cgi?id=221669

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/repaint/inline-style-change.html

Compute the repaint rect for RenderInline.

* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::visualOverflowBoundingBoxRectFor const):
* layout/integration/LayoutIntegrationLineLayout.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::linesVisualOverflowBoundingBox const):
(WebCore::RenderInline::clippedOverflowRectForRepaint const):

LayoutTests:

* fast/repaint/inline-style-change-expected.txt: Added.
* fast/repaint/inline-style-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272661 => 272662)


--- trunk/LayoutTests/ChangeLog	2021-02-10 18:23:51 UTC (rev 272661)
+++ trunk/LayoutTests/ChangeLog	2021-02-10 18:26:43 UTC (rev 272662)
@@ -1,3 +1,13 @@
+2021-02-10  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Paint invalidation for inline element style changes
+        https://bugs.webkit.org/show_bug.cgi?id=221669
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/repaint/inline-style-change-expected.txt: Added.
+        * fast/repaint/inline-style-change.html: Added.
+
 2021-02-10  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [watchOS] Adopt PUICQuickboardController for text input

Added: trunk/LayoutTests/fast/repaint/inline-style-change-expected.txt (0 => 272662)


--- trunk/LayoutTests/fast/repaint/inline-style-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/inline-style-change-expected.txt	2021-02-10 18:26:43 UTC (rev 272662)
@@ -0,0 +1,2 @@
+O tempora, o mores! senatus haec intellegit, consul videt; hic tamen vivit. vivit? immo vero etiam in senatum venit, fit publici consili particeps, notat et designat oculis ad caedem unum quemque nostrum. nos autem fortes viri satis facere rei publicae videmur, si istius furorem ac tela vitamus. ad mortem te, Catilina, duci iussu consulis iam pridem oportebat, in te conferri pestem quam tu in nos omnis iam diu machinaris.
+(repaint rects (rect 8 48 760 80) )

Added: trunk/LayoutTests/fast/repaint/inline-style-change.html (0 => 272662)


--- trunk/LayoutTests/fast/repaint/inline-style-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/inline-style-change.html	2021-02-10 18:26:43 UTC (rev 272662)
@@ -0,0 +1,34 @@
+<style>
+body { font: 20px Ahem; }
+span { color: red; }
+</style>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+async function test() {
+    await new Promise(requestAnimationFrame);
+
+    if (window.internals)
+        internals.startTrackingRepaints();
+
+    document.querySelector('span').style.color = 'green';
+
+    await new Promise(requestAnimationFrame);
+
+    if (window.internals) {
+        document.querySelector('#repaints').textContent = window.internals.repaintRectsAsText();
+        internals.stopTrackingRepaints();
+    }
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+<body _onload_="test()">
+<div>O tempora, o mores! senatus haec intellegit, consul videt; hic tamen vivit. vivit? <span>immo vero etiam in senatum venit, fit publici consili particeps, notat et designat oculis ad caedem unum quemque nostrum</span>. nos autem fortes viri satis facere rei publicae videmur, si istius furorem ac tela vitamus. ad mortem te, Catilina, duci iussu consulis iam pridem oportebat, in te conferri pestem quam tu in nos omnis iam diu machinaris.</div>
+
+<div id="repaints"></div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (272661 => 272662)


--- trunk/Source/WebCore/ChangeLog	2021-02-10 18:23:51 UTC (rev 272661)
+++ trunk/Source/WebCore/ChangeLog	2021-02-10 18:26:43 UTC (rev 272662)
@@ -1,3 +1,21 @@
+2021-02-10  Antti Koivisto  <an...@apple.com>
+
+        [LFC][Integration] Paint invalidation for inline element style changes
+        https://bugs.webkit.org/show_bug.cgi?id=221669
+
+        Reviewed by Zalan Bujtas.
+
+        Test: fast/repaint/inline-style-change.html
+
+        Compute the repaint rect for RenderInline.
+
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::visualOverflowBoundingBoxRectFor const):
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::linesVisualOverflowBoundingBox const):
+        (WebCore::RenderInline::clippedOverflowRectForRepaint const):
+
 2021-02-10  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed build fix.

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (272661 => 272662)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-02-10 18:23:51 UTC (rev 272661)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2021-02-10 18:26:43 UTC (rev 272662)
@@ -409,6 +409,12 @@
     return { Layout::BoxGeometry::borderBoxTopLeft(boxGeometry), boxGeometry.contentBox().size() };
 }
 
+LayoutRect LineLayout::visualOverflowBoundingBoxRectFor(const RenderInline& renderInline) const
+{
+    // FIXME: This doesn't contain overflow.
+    return enclosingBorderBoxRectFor(renderInline);
+}
+
 const RenderObject& LineLayout::rendererForLayoutBox(const Layout::Box& layoutBox) const
 {
     return m_boxTree.rendererForLayoutBox(layoutBox);

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (272661 => 272662)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2021-02-10 18:23:51 UTC (rev 272661)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2021-02-10 18:26:43 UTC (rev 272662)
@@ -94,6 +94,7 @@
     LineIterator lastLine() const;
 
     LayoutRect enclosingBorderBoxRectFor(const RenderInline&) const;
+    LayoutRect visualOverflowBoundingBoxRectFor(const RenderInline&) const;
 
     const RenderObject& rendererForLayoutBox(const Layout::Box&) const;
     const RenderBlockFlow& flow() const { return m_boxTree.flow(); }

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (272661 => 272662)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2021-02-10 18:23:51 UTC (rev 272661)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2021-02-10 18:26:43 UTC (rev 272662)
@@ -773,6 +773,11 @@
 
 LayoutRect RenderInline::linesVisualOverflowBoundingBox() const
 {
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (auto* layout = LayoutIntegration::LineLayout::containing(*this))
+        return layout->visualOverflowBoundingBoxRectFor(*this);
+#endif
+
     if (!alwaysCreateLineBoxes())
         return culledInlineVisualOverflowBoundingBox();
 
@@ -849,7 +854,19 @@
     // 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());
 
-    if (!firstLineBoxIncludingCulling() && !continuation())
+    auto knownEmpty = [&] {
+        if (firstLineBoxIncludingCulling())
+            return false;
+        if (continuation())
+            return false;
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+        if (LayoutIntegration::LineLayout::containing(*this))
+            return false;
+#endif
+        return true;
+    };
+
+    if (knownEmpty())
         return LayoutRect();
 
     LayoutRect repaintRect(linesVisualOverflowBoundingBox());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to