- Revision
- 290645
- Author
- za...@apple.com
- Date
- 2022-03-01 07:09:55 -0800 (Tue, 01 Mar 2022)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (290644 => 290645)
--- trunk/LayoutTests/ChangeLog 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/LayoutTests/ChangeLog 2022-03-01 15:09:55 UTC (rev 290645)
@@ -1,3 +1,14 @@
+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-01 Kimmo Kinnunen <kkinnu...@apple.com>
WebGL GPUP OpenGL context is not used even if WebGL via Metal is deselected
Added: trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html (0 => 290645)
--- trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer-expected.html 2022-03-01 15:09:55 UTC (rev 290645)
@@ -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: trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html (0 => 290645)
--- trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/inline-box-with-self-paint-layer.html 2022-03-01 15:09:55 UTC (rev 290645)
@@ -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: trunk/Source/WebCore/ChangeLog (290644 => 290645)
--- trunk/Source/WebCore/ChangeLog 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/Source/WebCore/ChangeLog 2022-03-01 15:09:55 UTC (rev 290645)
@@ -1,3 +1,28 @@
+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-01 Antoine Quint <grao...@webkit.org>
[web-animations] web-animations/interfaces/Animatable/getAnimations-iframe.html is a unique failure
Modified: trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp (290644 => 290645)
--- trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/Source/WebCore/rendering/LegacyInlineFlowBox.cpp 2022-03-01 15:09:55 UTC (rev 290645)
@@ -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: trunk/Source/WebCore/rendering/LegacyInlineFlowBox.h (290644 => 290645)
--- trunk/Source/WebCore/rendering/LegacyInlineFlowBox.h 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/Source/WebCore/rendering/LegacyInlineFlowBox.h 2022-03-01 15:09:55 UTC (rev 290645)
@@ -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: trunk/Source/WebCore/rendering/LegacyLineLayout.cpp (290644 => 290645)
--- trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/Source/WebCore/rendering/LegacyLineLayout.cpp 2022-03-01 15:09:55 UTC (rev 290645)
@@ -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: trunk/Source/WebCore/rendering/RenderInline.cpp (290644 => 290645)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2022-03-01 14:42:27 UTC (rev 290644)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2022-03-01 15:09:55 UTC (rev 290645)
@@ -570,7 +570,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())