Bug 1574520 - Clean up Inspector breadcrumbs for RTL r=gl

This remove reliance on isRtl (and thus hardcodes right and left directions) and removed redundant RTL/LTR CSS.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Itiel 2019-08-23 16:45:22 +00:00
Родитель 9266f1b83d
Коммит 479b566ed3
3 изменённых файлов: 14 добавлений и 31 удалений

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

@ -70,13 +70,6 @@ ArrowScrollBox.prototype = {
this.inner.addEventListener("overflow", this.onOverflow); this.inner.addEventListener("overflow", this.onOverflow);
}, },
/**
* Determine whether the current text directionality is RTL
*/
isRtl: function() {
return this.doc.dir === "rtl";
},
/** /**
* Scroll to the specified element using the current scroll behavior * Scroll to the specified element using the current scroll behavior
* @param {Element} element element to scroll * @param {Element} element element to scroll
@ -153,8 +146,7 @@ ArrowScrollBox.prototype = {
return; return;
} }
const block = this.isRtl() ? "end" : "start"; this.scrollToElement(element, "start");
this.scrollToElement(element, block);
}; };
this.clickOrHold(scrollToStart); this.clickOrHold(scrollToStart);
@ -170,8 +162,7 @@ ArrowScrollBox.prototype = {
return; return;
} }
const block = this.isRtl() ? "start" : "end"; this.scrollToElement(element, "end");
this.scrollToElement(element, block);
}; };
this.clickOrHold(scrollToEnd); this.clickOrHold(scrollToEnd);
@ -250,9 +241,7 @@ ArrowScrollBox.prototype = {
getFirstInvisibleElement: function() { getFirstInvisibleElement: function() {
const elementsList = Array.from(this.inner.childNodes).reverse(); const elementsList = Array.from(this.inner.childNodes).reverse();
const predicate = this.isRtl() const predicate = this.elementLeftOfContainer;
? this.elementRightOfContainer
: this.elementLeftOfContainer;
return this.findFirstWithBounds(elementsList, predicate); return this.findFirstWithBounds(elementsList, predicate);
}, },
@ -261,9 +250,7 @@ ArrowScrollBox.prototype = {
* non or partly visible element in the scroll box * non or partly visible element in the scroll box
*/ */
getLastInvisibleElement: function() { getLastInvisibleElement: function() {
const predicate = this.isRtl() const predicate = this.elementRightOfContainer;
? this.elementLeftOfContainer
: this.elementRightOfContainer;
return this.findFirstWithBounds(this.inner.childNodes, predicate); return this.findFirstWithBounds(this.inner.childNodes, predicate);
}, },

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

@ -15,11 +15,16 @@
/* Inspector HTMLBreadcrumbs */ /* Inspector HTMLBreadcrumbs */
.breadcrumbs-widget-container { .breadcrumbs-widget-container {
margin-inline-end: 3px; margin-right: 3px;
max-height: 24px; /* Set max-height for proper sizing on linux */ max-height: 24px; /* Set max-height for proper sizing on linux */
height: 24px; /* Set height to prevent starting small waiting for content */ height: 24px; /* Set height to prevent starting small waiting for content */
} }
.breadcrumbs-widget-container:-moz-locale-dir(rtl) {
margin-right: 0;
margin-left: 3px;
}
.scrollbutton-up, .scrollbutton-up,
.scrollbutton-down { .scrollbutton-down {
-moz-appearance: none; -moz-appearance: none;
@ -59,19 +64,13 @@
} }
/* Draw shadows to indicate there is more content 'behind' scrollbuttons. */ /* Draw shadows to indicate there is more content 'behind' scrollbuttons. */
.scrollbutton-up:-moz-locale-dir(ltr):not(:dir(rtl)), .scrollbutton-up {
.scrollbutton-up:dir(ltr),
.scrollbutton-down:-moz-locale-dir(rtl),
.scrollbutton-down:dir(rtl) {
border-right: solid 1px rgba(255, 255, 255, .1); border-right: solid 1px rgba(255, 255, 255, .1);
border-left: solid 1px transparent; border-left: solid 1px transparent;
box-shadow: 3px 0px 3px -3px var(--theme-sidebar-background); box-shadow: 3px 0px 3px -3px var(--theme-sidebar-background);
} }
.scrollbutton-down:-moz-locale-dir(ltr):not(:dir(rtl)), .scrollbutton-down {
.scrollbutton-down:dir(ltr),
.scrollbutton-up:-moz-locale-dir(rtl),
.scrollbutton-up:dir(rtl) {
border-right: solid 1px transparent; border-right: solid 1px transparent;
border-left: solid 1px rgba(255, 255, 255, .1); border-left: solid 1px rgba(255, 255, 255, .1);
box-shadow: -3px 0px 3px -3px var(--theme-sidebar-background); box-shadow: -3px 0px 3px -3px var(--theme-sidebar-background);
@ -83,10 +82,7 @@
border-color: transparent; border-color: transparent;
} }
.scrollbutton-up > .toolbarbutton-icon:-moz-locale-dir(rtl), .scrollbutton-down > .toolbarbutton-icon {
.scrollbutton-up > .toolbarbutton-icon:dir(rtl),
.scrollbutton-down > .toolbarbutton-icon:-moz-locale-dir(ltr):not(:dir(rtl)),
.scrollbutton-down > .toolbarbutton-icon:dir(ltr) {
transform: scaleX(-1); transform: scaleX(-1);
} }

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

@ -120,6 +120,7 @@ window {
#inspector-breadcrumbs-toolbar, #inspector-breadcrumbs-toolbar,
#inspector-breadcrumbs-toolbar * { #inspector-breadcrumbs-toolbar * {
box-sizing: border-box; box-sizing: border-box;
direction: ltr;
} }
#inspector-breadcrumbs { #inspector-breadcrumbs {
@ -146,7 +147,6 @@ window {
flex: 1; flex: 1;
display: flex; display: flex;
overflow: hidden; overflow: hidden;
direction: ltr;
} }
#inspector-breadcrumbs .breadcrumbs-widget-item { #inspector-breadcrumbs .breadcrumbs-widget-item {