Bug 1377826 - Don't allow anonymous text node to affect ancestor direction. r?ehsan
Given that elements in anonymous subtree have already been excluded from
participating in auto direction, it shouldn't make anything worse to
also exclude anonymous text node from that.
MozReview-Commit-ID: DJKiHqkvVvJ
--- a/dom/base/DirectionalityUtils.cpp
+++ b/dom/base/DirectionalityUtils.cpp
@@ -281,22 +281,24 @@ GetDirectionFromChar(uint32_t ch)
case eCharType_LeftToRight:
return eDir_LTR;
default:
return eDir_NotSet;
}
}
-inline static bool NodeAffectsDirAutoAncestor(nsINode* aTextNode)
+inline static bool
+NodeAffectsDirAutoAncestor(nsINode* aTextNode)
{
Element* parent = aTextNode->GetParentElement();
return (parent &&
!DoesNotParticipateInAutoDirection(parent) &&
- parent->NodeOrAncestorHasDirAuto());
+ parent->NodeOrAncestorHasDirAuto() &&
+ !aTextNode->IsInAnonymousSubtree());
}
Directionality
GetDirectionFromText(const char16_t* aText, const uint32_t aLength,
uint32_t* aFirstStrong)
{
const char16_t* start = aText;
const char16_t* end = aText + aLength;
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/1377826.html
@@ -0,0 +1,5 @@
+<li id='a' dir='auto'>
+<select>
+<option dir='rtl'>
+ࣃ
+</html>
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -209,12 +209,13 @@ pref(dom.IntersectionObserver.enabled,tr
pref(dom.IntersectionObserver.enabled,true) load 1326194-2.html
pref(dom.IntersectionObserver.enabled,true) load 1332939.html
pref(dom.webcomponents.enabled,true) load 1341693.html
pref(dom.IntersectionObserver.enabled,true) load 1353529.xul
pref(dom.IntersectionObserver.enabled,true) load 1369363.xul
load 1370072.html
pref(clipboard.autocopy,true) load 1370737.html
pref(dom.IntersectionObserver.enabled,true) load 1370968.html
+load 1377826.html
load structured_clone_container_throws.html
HTTP(..) load xhr_abortinprogress.html
load xhr_empty_datauri.html
load xhr_html_nullresponse.html