Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Invalid dir attribute should not affect directionality
https://bugs.webkit.org/show_bug.cgi?id=244439 Reviewed by Darin Adler and Alan Bujtas. An invalid dir content attribute value should not have any effect on the directionality of text. The issue was caused by WebKit adding unicode-bidi: embed style whenever there is dir content attribute regardless of whether its value is valid or not. New behavior of WebKit matches that of Gecko and Blink. * LayoutTests/fast/css/default-bidi-css-rules-expected.txt: Rebaselined. * LayoutTests/fast/css/default-bidi-css-rules.html: Ditto. * LayoutTests/fast/dom/HTMLElement/attr-dir-invalid-expected.html: Added. * LayoutTests/fast/dom/HTMLElement/attr-dir-invalid.html: Added. * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::collectPresentationalHintsForAttribute): Canonical link: https://commits.webkit.org/253878@main
- Loading branch information
Showing
5 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
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
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
12 changes: 12 additions & 0 deletions
12
LayoutTests/fast/dom/HTMLElement/attr-dir-invalid-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,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<div id="container" dir="auto"> | ||
<span id="rtl">ת</span><span>b</span> | ||
<span>a</span> | ||
</div> | ||
<style> | ||
#container { width: 100px; } | ||
</style> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<body> | ||
<div id="container" dir="auto"> | ||
<span id="rtl" dir="x">ת</span> | ||
<span>a</span> | ||
</div> | ||
<style> | ||
#container { width: 100px; } | ||
</style> | ||
<script> | ||
|
||
requestAnimationFrame(() => { | ||
setTimeout(() => { | ||
rtl.dir = 'x'; | ||
const span = document.createElement('span'); | ||
span.append('b'); | ||
rtl.after(span); | ||
document.documentElement.className = ''; | ||
}, 0); | ||
}); | ||
|
||
</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