зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7fe084de5f
Коммит
5e95d30ef3
|
@ -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; }
|
||||||
|
|
Загрузка…
Ссылка в новой задаче