<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[284334] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/284334">284334</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2021-10-17 07:45:44 -0700 (Sun, 17 Oct 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[LFC][Integration] Support background-clip:text on inline boxes
https://bugs.webkit.org/show_bug.cgi?id=231877

Reviewed by Alan Bujtas.

Source/WebCore:

Implement text mask painting.

Test: fast/inline/inline-background-clip-text.html

* layout/integration/InlineIteratorBoxLegacyPath.h:
(WebCore::InlineIterator::BoxLegacyPath::firstLeafBoxForInlineBox const):
(WebCore::InlineIterator::BoxLegacyPath::lastLeafBoxForInlineBox const):
* layout/integration/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::firstLeafBoxForInlineBox const):
(WebCore::InlineIterator::BoxModernPath::lastLeafBoxForInlineBox const):
(WebCore::InlineIterator::BoxModernPath::isWithinInlineBox):
* layout/integration/InlineIteratorInlineBox.cpp:
(WebCore::InlineIterator::InlineBox::firstLeafBox const):
(WebCore::InlineIterator::InlineBox::lastLeafBox const):
(WebCore::InlineIterator::InlineBox::endLeafBox const):

Add iterator support for getting leaf boxes of an inline box.

* layout/integration/InlineIteratorInlineBox.h:
* layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::printReason):
(WebCore::LayoutIntegration::canUseForRenderInlineChild):
* layout/integration/LayoutIntegrationCoverage.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox):

Paint the mask directly using TextBoxPainter instead of recursing to the general painting code.

* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::TextBoxPainter):
* rendering/TextBoxPainter.h:

LayoutTests:

* fast/inline/inline-background-clip-text-expected.html: Added.
* fast/inline/inline-background-clip-text.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreHeaderscmake">trunk/Source/WebCore/Headers.cmake</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationInlineIteratorBoxLegacyPathh">trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationInlineIteratorBoxModernPathh">trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationInlineIteratorInlineBoxcpp">trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationInlineIteratorInlineBoxh">trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationLayoutIntegrationCoveragecpp">trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutintegrationLayoutIntegrationCoverageh">trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextBoxPaintercpp">trunk/Source/WebCore/rendering/TextBoxPainter.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingTextBoxPainterh">trunk/Source/WebCore/rendering/TextBoxPainter.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastinlineinlinebackgroundcliptextexpectedhtml">trunk/LayoutTests/fast/inline/inline-background-clip-text-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastinlineinlinebackgroundcliptexthtml">trunk/LayoutTests/fast/inline/inline-background-clip-text.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/LayoutTests/ChangeLog 2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2021-10-17  Antti Koivisto  <antti@apple.com>
+
+        [LFC][Integration] Support background-clip:text on inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=231877
+
+        Reviewed by Alan Bujtas.
+
+        * fast/inline/inline-background-clip-text-expected.html: Added.
+        * fast/inline/inline-background-clip-text.html: Added.
+
</ins><span class="cx"> 2021-10-16  Robin Morisset  <rmorisset@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Allow WASM to use up to 4GB
</span></span></pre></div>
<a id="trunkLayoutTestsfastinlineinlinebackgroundcliptextexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline/inline-background-clip-text-expected.html (0 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline/inline-background-clip-text-expected.html                          (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-background-clip-text-expected.html     2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<style>
+div {
+    font-family: 'Ahem';
+}
+.clip {
+    color: green;
+}
+</style>
+<div>a <span class="clip">b <span>c </span></span>d</div>
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastinlineinlinebackgroundcliptexthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/inline/inline-background-clip-text.html (0 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/inline/inline-background-clip-text.html                           (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-background-clip-text.html      2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+<style>
+div {
+    font-family: 'Ahem';
+}
+.clip {
+    color: transparent;
+    background-clip: text;
+    background-color: green;
+}
+</style>
+<div>a <span class="clip">b <span>c </span></span>d</div>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/win/TestExpectations  2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/LayoutTests/platform/win/TestExpectations     2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -2911,6 +2911,7 @@
</span><span class="cx"> fast/repaint/block-inputrange-repaint.html [ Pass Failure ]
</span><span class="cx"> 
</span><span class="cx"> fast/inline/padding-ellipsis-right.html [ ImageOnlyFailure ]
</span><ins>+fast/inline/inline-background-clip-text.html [ ImageOnlyFailure ]
</ins><span class="cx"> 
</span><span class="cx"> # This test hardcodes the result of a platform-dependent font lookup algorithm.
</span><span class="cx"> fast/text/fallback-language-han.html [ Skip ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/ChangeLog      2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2021-10-17  Antti Koivisto  <antti@apple.com>
+
+        [LFC][Integration] Support background-clip:text on inline boxes
+        https://bugs.webkit.org/show_bug.cgi?id=231877
+
+        Reviewed by Alan Bujtas.
+
+        Implement text mask painting.
+
+        Test: fast/inline/inline-background-clip-text.html
+
+        * layout/integration/InlineIteratorBoxLegacyPath.h:
+        (WebCore::InlineIterator::BoxLegacyPath::firstLeafBoxForInlineBox const):
+        (WebCore::InlineIterator::BoxLegacyPath::lastLeafBoxForInlineBox const):
+        * layout/integration/InlineIteratorBoxModernPath.h:
+        (WebCore::InlineIterator::BoxModernPath::firstLeafBoxForInlineBox const):
+        (WebCore::InlineIterator::BoxModernPath::lastLeafBoxForInlineBox const):
+        (WebCore::InlineIterator::BoxModernPath::isWithinInlineBox):
+        * layout/integration/InlineIteratorInlineBox.cpp:
+        (WebCore::InlineIterator::InlineBox::firstLeafBox const):
+        (WebCore::InlineIterator::InlineBox::lastLeafBox const):
+        (WebCore::InlineIterator::InlineBox::endLeafBox const):
+
+        Add iterator support for getting leaf boxes of an inline box.
+
+        * layout/integration/InlineIteratorInlineBox.h:
+        * layout/integration/LayoutIntegrationCoverage.cpp:
+        (WebCore::LayoutIntegration::printReason):
+        (WebCore::LayoutIntegration::canUseForRenderInlineChild):
+        * layout/integration/LayoutIntegrationCoverage.h:
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintMaskForTextFillBox):
+
+        Paint the mask directly using TextBoxPainter instead of recursing to the general painting code.
+
+        * rendering/TextBoxPainter.cpp:
+        (WebCore::TextBoxPainter::TextBoxPainter):
+        * rendering/TextBoxPainter.h:
+
</ins><span class="cx"> 2021-10-16  Alan Bujtas  <zalan@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [LFC][IFC] Adjust the logical right side of the line with line spanning inline boxes
</span></span></pre></div>
<a id="trunkSourceWebCoreHeaderscmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Headers.cmake (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Headers.cmake       2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/Headers.cmake  2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -811,6 +811,8 @@
</span><span class="cx">     layout/integration/InlineIteratorTextBox.h
</span><span class="cx">     layout/integration/LayoutIntegrationInlineContent.h
</span><span class="cx">     layout/integration/LayoutIntegrationLine.h
</span><ins>+
+    layout/layouttree/LayoutContainerBox.h
</ins><span class="cx">     layout/layouttree/LayoutBox.h
</span><span class="cx"> 
</span><span class="cx">     loader/CanvasActivityRecord.h
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationInlineIteratorBoxLegacyPathh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h    2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h       2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -96,6 +96,16 @@
</span><span class="cx">         m_inlineBox = inlineFlowBox()->prevLineBox();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    BoxLegacyPath firstLeafBoxForInlineBox() const
+    {
+        return { inlineFlowBox()->firstLeafDescendant() };
+    }
+
+    BoxLegacyPath lastLeafBoxForInlineBox() const
+    {
+        return { inlineFlowBox()->lastLeafDescendant() };
+    }
+
</ins><span class="cx">     bool operator==(const BoxLegacyPath& other) const { return m_inlineBox == other.m_inlineBox; }
</span><span class="cx"> 
</span><span class="cx">     bool atEnd() const { return !m_inlineBox; }
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationInlineIteratorBoxModernPathh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h    2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h       2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
</span><span class="cx"> 
</span><span class="cx"> #include "FontCascade.h"
</span><ins>+#include "LayoutContainerBox.h"
</ins><span class="cx"> #include "LayoutIntegrationInlineContent.h"
</span><span class="cx"> #include "TextBoxSelectableRange.h"
</span><span class="cx"> 
</span><span class="lines">@@ -194,6 +195,36 @@
</span><span class="cx">         ASSERT(atEnd() || box().isInlineBox());
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    BoxModernPath firstLeafBoxForInlineBox() const
+    {
+        ASSERT(box().isInlineBox());
+
+        auto& inlineBox = box().layoutBox();
+
+        // The next box is the first descendant of this box;
+        auto first = *this;
+        first.traverseNextOnLine();
+
+        if (!first.atEnd() && !first.isWithinInlineBox(inlineBox))
+            first.setAtEnd();
+
+        return first;
+    }
+
+    BoxModernPath lastLeafBoxForInlineBox() const
+    {
+        ASSERT(box().isInlineBox());
+
+        auto& inlineBox = box().layoutBox();
+
+        // FIXME: Get the last box index directly from the display box.
+        auto last = firstLeafBoxForInlineBox();
+        for (auto box = last; !box.atEnd() && box.isWithinInlineBox(inlineBox); box.traverseNextOnLine())
+            last = box;
+
+        return last;
+    }
+
</ins><span class="cx">     bool operator==(const BoxModernPath& other) const { return m_inlineContent == other.m_inlineContent && m_boxIndex == other.m_boxIndex; }
</span><span class="cx"> 
</span><span class="cx">     bool atEnd() const { return m_boxIndex == boxes().size(); }
</span><span class="lines">@@ -201,6 +232,16 @@
</span><span class="cx">     auto& inlineContent() const { return *m_inlineContent; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    bool isWithinInlineBox(const Layout::Box& inlineBox)
+    {
+        auto* layoutBox = &box().layoutBox().parent();
+        for (; layoutBox->isInlineBox(); layoutBox = &layoutBox->parent()) {
+            if (layoutBox == &inlineBox)
+                return true;
+        }
+        return false;
+    }
+
</ins><span class="cx">     void traverseNextBox()
</span><span class="cx">     {
</span><span class="cx">         ASSERT(!atEnd());
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationInlineIteratorInlineBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp      2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp 2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -59,6 +59,27 @@
</span><span class="cx">     return InlineBoxIterator(*this).traversePreviousInlineBox();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LeafBoxIterator InlineBox::firstLeafBox() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) -> LeafBoxIterator {
+        return { path.firstLeafBoxForInlineBox() };
+    });
+}
+
+LeafBoxIterator InlineBox::lastLeafBox() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) -> LeafBoxIterator {
+        return { path.lastLeafBoxForInlineBox() };
+    });
+}
+
+LeafBoxIterator InlineBox::endLeafBox() const
+{
+    if (auto last = lastLeafBox())
+        return last->nextOnLine();
+    return { };
+}
+
</ins><span class="cx"> InlineBoxIterator::InlineBoxIterator(Box::PathVariant&& pathVariant)
</span><span class="cx">     : BoxIterator(WTFMove(pathVariant))
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationInlineIteratorInlineBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h        2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h   2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -47,6 +47,10 @@
</span><span class="cx">     InlineBoxIterator nextInlineBox() const;
</span><span class="cx">     InlineBoxIterator previousInlineBox() const;
</span><span class="cx">     InlineBoxIterator iterator() const;
</span><ins>+
+    LeafBoxIterator firstLeafBox() const;
+    LeafBoxIterator lastLeafBox() const;
+    LeafBoxIterator endLeafBox() const;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class InlineBoxIterator : public BoxIterator {
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationLayoutIntegrationCoveragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp    2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp       2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -209,9 +209,6 @@
</span><span class="cx">     case AvoidanceReason::BoxDecorationBreakClone:
</span><span class="cx">         stream << "webkit-box-decoration-break: clone";
</span><span class="cx">         break;
</span><del>-    case AvoidanceReason::InlineBoxHasBackgroundClipText:
-        stream << "inline box has background-clip: text";
-        break;
</del><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -481,8 +478,6 @@
</span><span class="cx">     if (style.boxDecorationBreak() == BoxDecorationBreak::Clone)
</span><span class="cx">         SET_REASON_AND_RETURN_IF_NEEDED(BoxDecorationBreakClone, reasons, includeReasons);
</span><span class="cx"> #endif
</span><del>-    if (style.backgroundClip() == FillBox::Text)
-        SET_REASON_AND_RETURN_IF_NEEDED(InlineBoxHasBackgroundClipText, reasons, includeReasons);
</del><span class="cx">     if (style.hasOutline())
</span><span class="cx">         SET_REASON_AND_RETURN_IF_NEEDED(ContentHasOutline, reasons, includeReasons);
</span><span class="cx">     if (renderInline.isInFlowPositioned())
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutintegrationLayoutIntegrationCoverageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h      2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationCoverage.h 2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">     MultiColumnFlowIsFloating                    = 1LLU  << 50,
</span><span class="cx">     // Unused                                    = 1LLU  << 51,
</span><span class="cx">     // Unused                                    = 1LLU  << 52,
</span><del>-    InlineBoxHasBackgroundClipText               = 1LLU  << 53,
</del><ins>+    // Unused                                    = 1LLU  << 53,
</ins><span class="cx">     UnsupportedFieldset                          = 1LLU  << 54,
</span><span class="cx">     ChildBoxIsFloatingOrPositioned               = 1LLU  << 55,
</span><span class="cx">     ContentIsSVG                                 = 1LLU  << 56,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp  2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp     2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "ScrollingConstraints.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include "TextBoxPainter.h"
</ins><span class="cx"> #include "TransformState.h"
</span><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="lines">@@ -711,22 +712,28 @@
</span><span class="cx">     return view().imageQualityController().chooseInterpolationQuality(context, this, image, layer, size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const FloatRect& maskRect, const InlineIterator::InlineBoxIterator& box, const LayoutRect& scrolledPaintRect)
</del><ins>+void RenderBoxModelObject::paintMaskForTextFillBox(ImageBuffer* maskImage, const FloatRect& maskRect, const InlineIterator::InlineBoxIterator& inlineBox, const LayoutRect& scrolledPaintRect)
</ins><span class="cx"> {
</span><span class="cx">     GraphicsContext& maskImageContext = maskImage->context();
</span><span class="cx">     maskImageContext.translate(-maskRect.location());
</span><span class="cx"> 
</span><span class="cx">     // Now add the text to the clip. We do this by painting using a special paint phase that signals to
</span><del>-    // LegacyInlineTextBoxes that they should just add their contents to the clip.
-    PaintInfo info(maskImageContext, LayoutRect { maskRect }, PaintPhase::TextClip, PaintBehavior::ForceBlackText);
-    if (box) {
-        auto* legacyInlineBox = const_cast<LegacyInlineFlowBox*>(box->legacyInlineBox());
-        const auto& rootBox = legacyInlineBox->root();
-        legacyInlineBox->paint(info, LayoutPoint(scrolledPaintRect.x() - legacyInlineBox->x(), scrolledPaintRect.y() - legacyInlineBox->y()), rootBox.lineTop(), rootBox.lineBottom());
-    } else {
-        LayoutSize localOffset = is<RenderBox>(*this) ? downcast<RenderBox>(*this).locationOffset() : LayoutSize();
-        paint(info, scrolledPaintRect.location() - localOffset);
</del><ins>+    // the painter it should just modify the clip.
+    PaintInfo maskInfo(maskImageContext, LayoutRect { maskRect }, PaintPhase::TextClip, PaintBehavior::ForceBlackText);
+    if (inlineBox) {
+        auto paintOffset = scrolledPaintRect.location() - toLayoutSize(LayoutPoint(inlineBox->rect().location()));
+
+        for (auto box = inlineBox->firstLeafBox(), end = inlineBox->endLeafBox(); box != end; box.traverseNextOnLine()) {
+            if (!box->isText())
+                continue;
+            TextBoxPainter textBoxPainter(downcast<InlineIterator::TextBoxIterator>(box), maskInfo, paintOffset);
+            textBoxPainter.paint();
+        }
+        return;
</ins><span class="cx">     }
</span><ins>+
+    LayoutSize localOffset = is<RenderBox>(*this) ? downcast<RenderBox>(*this).locationOffset() : LayoutSize();
+    paint(maskInfo, scrolledPaintRect.location() - localOffset);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer& bgLayer, const LayoutRect& rect,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextBoxPaintercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextBoxPainter.cpp (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextBoxPainter.cpp        2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/rendering/TextBoxPainter.cpp   2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -56,8 +56,8 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-TextBoxPainter::TextBoxPainter(InlineIterator::TextBoxIterator&& textBox, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
-    : m_textBox(WTFMove(textBox))
</del><ins>+TextBoxPainter::TextBoxPainter(const InlineIterator::TextBoxIterator& textBox, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+    : m_textBox(textBox)
</ins><span class="cx">     , m_renderer(m_textBox->renderer())
</span><span class="cx">     , m_document(m_renderer.document())
</span><span class="cx">     , m_style(m_textBox->style())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingTextBoxPainterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/TextBoxPainter.h (284333 => 284334)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/TextBoxPainter.h  2021-10-17 05:58:00 UTC (rev 284333)
+++ trunk/Source/WebCore/rendering/TextBoxPainter.h     2021-10-17 14:45:44 UTC (rev 284334)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
</span><span class="cx">     TextBoxPainter(const LayoutIntegration::InlineContent&, const InlineDisplay::Box&, PaintInfo&, const LayoutPoint& paintOffset);
</span><span class="cx"> #endif
</span><ins>+    TextBoxPainter(const InlineIterator::TextBoxIterator&, PaintInfo&, const LayoutPoint& paintOffset);
+
</ins><span class="cx">     ~TextBoxPainter();
</span><span class="cx"> 
</span><span class="cx">     void paint();
</span><span class="lines">@@ -57,8 +59,6 @@
</span><span class="cx">     static FloatRect calculateUnionOfAllDocumentMarkerBounds(const LegacyInlineTextBox&);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    TextBoxPainter(InlineIterator::TextBoxIterator&&, PaintInfo&, const LayoutPoint& paintOffset);
-
</del><span class="cx">     auto& textBox() const { return *m_textBox; }
</span><span class="cx"> 
</span><span class="cx">     void paintBackground();
</span></span></pre>
</div>
</div>

</body>
</html>