Skip to content

Commit

Permalink
REGRESSION: fast/history/visited-link-caret-color.html is a consisten…
Browse files Browse the repository at this point in the history
…t image failure

https://bugs.webkit.org/show_bug.cgi?id=259469
rdar://111077813

Reviewed by Megan Gardner and Aditya Keerthi.

When the caret doesn't need to use the system accent color, it should just get the color the normal
way, which already both accounts for the visited-ness and any color filter.

* LayoutTests/fast/history/visited-link-caret-color-expected.html:
* LayoutTests/fast/history/visited-link-caret-color.html:
* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::CaretBase::computeCaretColor):

Canonical link: https://commits.webkit.org/266295@main
  • Loading branch information
rr-codes committed Jul 25, 2023
1 parent d9c2f80 commit eb3e815
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#test-container {
height: 50px;
width: 50px;
overflow: hidden;
}

#mock-caret {
height: inherit;
width: inherit;
width: 50px;
height: 100px;
position: absolute;
top: 100px;
left: 8px;
background-color: green;
}
</style>
Expand Down
5 changes: 3 additions & 2 deletions LayoutTests/fast/history/visited-link-caret-color.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<style>
#test-container {
height: 50px;
width: 50px;
height: 150px;
width: 100px;
overflow: hidden;
outline: none;
}
Expand All @@ -15,6 +15,7 @@
width: inherit;
transform-origin: left top;
transform: scale(50, 50);
clip-path: inset(1px 99px 0px 0px);
font-size: 10px; /* Needed for the caret to render in Firefox. */
}

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/editing/FrameSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ Color CaretBase::computeCaretColor(const RenderStyle& elementStyle, const Node*
return elementStyle.colorByApplyingColorFilter(systemAccentColor);
}

return elementStyle.colorByApplyingColorFilter(elementStyle.colorResolvingCurrentColor(elementStyle.caretColor()));
return elementStyle.visitedDependentColorWithColorFilter(CSSPropertyCaretColor);
#else
RefPtr parentElement = node ? node->parentElement() : nullptr;
auto* parentStyle = parentElement && parentElement->renderer() ? &parentElement->renderer()->style() : nullptr;
Expand Down

0 comments on commit eb3e815

Please sign in to comment.