Skip to content
Permalink
Browse files
Invisible border should not trigger Repaint diff when currentColor ch…
…anges

https://bugs.webkit.org/show_bug.cgi?id=240763

Reviewed by Simon Fraser.

Let's check if the border is visible to decide if the currentColor should trigger Repaint diff.

Test: fast/repaint/currentColorChange-with-non-visible-border.html
* Source/WebCore/rendering/style/BorderData.cpp:
(WebCore::BorderData::isEquivalentForPainting const):
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border-expected.txt: Added.
* LayoutTests/fast/repaint/currentColorChange-with-non-visible-border.html: Added.

Canonical link: https://commits.webkit.org/250844@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed May 22, 2022
1 parent 46e09eb commit 7b0eb3579027ec10cad88ec73786f8bb212e0bfb
Showing 3 changed files with 32 additions and 2 deletions.
@@ -0,0 +1,26 @@
<style>
#color_change {
border-style: none;
border-width: 10px;
background-color: green;
width: 100px;
height: 100px;
}
</style>
<!-- current-color change should not trigger repaint unless the container has text content -->
<div id=color_change><div>
<pre id=result></pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
document.body.offsetHeight;
if (window.internals)
internals.startTrackingRepaints();
color_change.style.color = "red";
document.body.offsetHeight;

if (window.internals) {
result.innerText = internals.repaintRectsAsText();
internals.stopTrackingRepaints();
}
</script>
@@ -40,8 +40,11 @@ bool BorderData::isEquivalentForPainting(const BorderData& other, bool currentCo
if (!currentColorDiffers)
return true;

auto borderHasCurrentColor = RenderStyle::isCurrentColor(m_top.color()) || RenderStyle::isCurrentColor(m_right.color()) || RenderStyle::isCurrentColor(m_bottom.color()) || RenderStyle::isCurrentColor(m_left.color());
return !borderHasCurrentColor;
auto visibleBorderHasCurrentColor = (m_top.isVisible() && RenderStyle::isCurrentColor(m_top.color()))
|| (m_right.isVisible() && RenderStyle::isCurrentColor(m_right.color()))
|| (m_bottom.isVisible() && RenderStyle::isCurrentColor(m_bottom.color()))
|| (m_left.isVisible() && RenderStyle::isCurrentColor(m_left.color()));
return !visibleBorderHasCurrentColor;
}

TextStream& operator<<(TextStream& ts, const BorderValue& borderValue)

0 comments on commit 7b0eb35

Please sign in to comment.