Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
CSS Custom Highlights text decoration does not respect priority
https://bugs.webkit.org/show_bug.cgi?id=259321 rdar://112494779 Reviewed by Wenson Hsieh. Before if StyledMarkedText was of higher priority, just overrides textDecorationStyles. Added a function to compute the textDecorationStyles. Added WPT ref test for painting unclashing lower priority text decoration over higher priority highlight without text decorations. * LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html: Added. * Source/WebCore/rendering/StyledMarkedText.cpp: (WebCore::computeStylesForTextDecorations): (WebCore::coalesceAdjacentWithSameRanges): Canonical link: https://commits.webkit.org/266184@main
- Loading branch information
Showing
4 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...ghlight-api/painting/custom-highlight-painting-priority-text-decoration-001-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title> | ||
<style> | ||
#yellow-highlight { | ||
background-color: yellow; | ||
text-decoration: underline; | ||
text-decoration-color: red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<span id="yellow-highlight">Yellow</span> | ||
</body> | ||
</html> |
16 changes: 16 additions & 0 deletions
16
...ss-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title> | ||
<style> | ||
#yellow-highlight { | ||
background-color: yellow; | ||
text-decoration: underline; | ||
text-decoration-color: red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<span id="yellow-highlight">Yellow</span> | ||
</body> | ||
</html> |
39 changes: 39 additions & 0 deletions
39
...ss/css-highlight-api/painting/custom-highlight-painting-priority-text-decoration-001.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>CSS Highlight API Test: ::highlight text-decoration paints over higher priority when not clashing</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-highlight-api-1/#priorities"> | ||
<link rel="match" href="custom-highlight-painting-priority-text-decoration-001-ref.html"> | ||
<style> | ||
::highlight(yellow-highlight) { | ||
background-color: yellow; | ||
} | ||
::highlight(underline-highlight) { | ||
text-decoration: underline; | ||
text-decoration-color: red; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<span id="yellow-highlight">Yellow</span> | ||
|
||
<script> | ||
let yellow = document.getElementById("yellow-highlight"); | ||
let highlightYellow = new Highlight(new StaticRange({ | ||
startContainer: yellow.childNodes[0], | ||
startOffset: 0, | ||
endContainer: yellow.childNodes[0], | ||
endOffset: 6 | ||
})); | ||
let highlightUnderline = new Highlight(new StaticRange({ | ||
startContainer: yellow.childNodes[0], | ||
startOffset: 0, | ||
endContainer: yellow.childNodes[0], | ||
endOffset: 6 | ||
})); | ||
CSS.highlights.set("yellow-highlight", highlightYellow); | ||
CSS.highlights.set("underline-highlight", highlightUnderline); | ||
highlightYellow.priority = 10; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters