Bug 1596296 - Stop supporting XUL [dir="reverse"] attribute value. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D52946

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2019-11-15 02:20:10 +00:00
Родитель 7fe084de5f
Коммит 5e95d30ef3
5 изменённых файлов: 21 добавлений и 30 удалений

Просмотреть файл

@ -673,10 +673,10 @@
let isRTL = this.matches(":-moz-locale-dir(rtl)"); let isRTL = this.matches(":-moz-locale-dir(rtl)");
if (position.indexOf("start_") == 0) { if (position.indexOf("start_") == 0) {
container.dir = "reverse"; container.style.mozBoxDirection = "reverse";
this.setAttribute("side", isRTL ? "left" : "right"); this.setAttribute("side", isRTL ? "left" : "right");
} else { } else {
container.dir = ""; container.style.removeProperty("-moz-box-direction");
this.setAttribute("side", isRTL ? "right" : "left"); this.setAttribute("side", isRTL ? "right" : "left");
} }
} else if ( } else if (

Просмотреть файл

@ -415,36 +415,29 @@ void nsBoxFrame::GetInitialDirection(bool& aIsNormal) {
// horizontally inverted chrome. // horizontally inverted chrome.
aIsNormal = (StyleVisibility()->mDirection == aIsNormal = (StyleVisibility()->mDirection ==
NS_STYLE_DIRECTION_LTR); // If text runs RTL then so do we. NS_STYLE_DIRECTION_LTR); // If text runs RTL then so do we.
} else if (GetContent()->IsElement()) {
Element* element = GetContent()->AsElement();
// Now see if we have an attribute. The attribute overrides
// the style system 'direction' property.
static Element::AttrValuesArray strings[] = {nsGkAtoms::ltr,
nsGkAtoms::rtl, nullptr};
int32_t index = element->FindAttrValueIn(
kNameSpaceID_None, nsGkAtoms::dir, strings, eCaseMatters);
if (index >= 0) {
bool values[] = {true, false};
aIsNormal = values[index];
}
}
} else {
aIsNormal = true; // Assume a normal direction in the vertical case. aIsNormal = true; // Assume a normal direction in the vertical case.
}
// Now check the style system to see if we should invert aIsNormal. // Now check the style system to see if we should invert aIsNormal.
const nsStyleXUL* boxInfo = StyleXUL(); const nsStyleXUL* boxInfo = StyleXUL();
if (boxInfo->mBoxDirection == StyleBoxDirection::Reverse) { if (boxInfo->mBoxDirection == StyleBoxDirection::Reverse) {
aIsNormal = !aIsNormal; // Invert our direction. aIsNormal = !aIsNormal; // Invert our direction.
} }
if (!GetContent()->IsElement()) {
return;
}
Element* element = GetContent()->AsElement();
// Now see if we have an attribute. The attribute overrides
// the style system value.
if (IsXULHorizontal()) {
static Element::AttrValuesArray strings[] = {
nsGkAtoms::reverse, nsGkAtoms::ltr, nsGkAtoms::rtl, nullptr};
int32_t index = element->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::dir,
strings, eCaseMatters);
if (index >= 0) {
bool values[] = {!aIsNormal, true, false};
aIsNormal = values[index];
}
} else if (element->AttrValueIs(kNameSpaceID_None, nsGkAtoms::dir,
nsGkAtoms::reverse, eCaseMatters)) {
aIsNormal = !aIsNormal;
}
} }
/* Returns true if it was set. /* Returns true if it was set.

Просмотреть файл

@ -43,7 +43,7 @@ function test_richlistbox()
// Test that dir="reverse" is ignored and behaves the same as dir="normal". // Test that dir="reverse" is ignored and behaves the same as dir="normal".
for (let dir of ["reverse", "normal"]) { for (let dir of ["reverse", "normal"]) {
richListBox.dir = dir; richListBox.style.mozBoxDirection = dir;
richListBox.selectedIndex = 0; richListBox.selectedIndex = 0;
sendKey("DOWN"); sendKey("DOWN");
is(richListBox.currentIndex, 1, "Selection should move to the next item"); is(richListBox.currentIndex, 1, "Selection should move to the next item");

Просмотреть файл

@ -136,10 +136,10 @@
var isRTL = window.getComputedStyle(this).direction == "rtl"; var isRTL = window.getComputedStyle(this).direction == "rtl";
if (position.indexOf("start_") == 0) { if (position.indexOf("start_") == 0) {
container.dir = "reverse"; container.style.mozBoxDirection = "reverse";
this.setAttribute("side", isRTL ? "left" : "right"); this.setAttribute("side", isRTL ? "left" : "right");
} else { } else {
container.dir = ""; container.style.removeProperty("-moz-box-direction");
this.setAttribute("side", isRTL ? "right" : "left"); this.setAttribute("side", isRTL ? "right" : "left");
} }
} else if ( } else if (

Просмотреть файл

@ -566,8 +566,6 @@ tabmodalprompt {
[orient="vertical"] { -moz-box-orient: vertical; } [orient="vertical"] { -moz-box-orient: vertical; }
[orient="horizontal"] { -moz-box-orient: horizontal; } [orient="horizontal"] { -moz-box-orient: horizontal; }
[dir="reverse"] { -moz-box-direction: reverse; }
[align="start"] { -moz-box-align: start; } [align="start"] { -moz-box-align: start; }
[align="center"] { -moz-box-align: center; } [align="center"] { -moz-box-align: center; }
[align="end"] { -moz-box-align: end; } [align="end"] { -moz-box-align: end; }