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)");
if (position.indexOf("start_") == 0) {
container.dir = "reverse";
container.style.mozBoxDirection = "reverse";
this.setAttribute("side", isRTL ? "left" : "right");
} else {
container.dir = "";
container.style.removeProperty("-moz-box-direction");
this.setAttribute("side", isRTL ? "right" : "left");
}
} else if (

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

@ -415,36 +415,29 @@ void nsBoxFrame::GetInitialDirection(bool& aIsNormal) {
// horizontally inverted chrome.
aIsNormal = (StyleVisibility()->mDirection ==
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.
}
// Now check the style system to see if we should invert aIsNormal.
const nsStyleXUL* boxInfo = StyleXUL();
if (boxInfo->mBoxDirection == StyleBoxDirection::Reverse) {
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.

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

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

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

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

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

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