Bug 1501596 - Fix year popup control buttons for minimonth. r=Paenglab,MakeMyDay DONTBUILD

This commit is contained in:
Arshad Khan 2018-11-12 18:18:01 +05:30
Родитель a6d116d74b
Коммит b9eaed8867
4 изменённых файлов: 52 добавлений и 8 удалений

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

@ -110,9 +110,11 @@
<xul:menupopup anonid="years-popup" position="after_start"
onpopupshowing="moveYears('reset', 0); event.stopPropagation();"
onpopuphidden="firePopupListHidden();">
<xul:autorepeatbutton class="autorepeatbutton-up"
orient="vertical"
oncommand="moveYears('up', 1);"/>
<xul:toolbarbutton class="scrollbutton-up"
orient="vertical"
oncommand="moveYears('up', 1);"
onmouseenter="startScroll('up', 1);"
onmouseout="stopScroll();"/>
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
@ -122,9 +124,11 @@
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
<xul:menuitem class="minimonth-list" oncommand="onYearsPopupCommand(this)"/>
<xul:autorepeatbutton class="autorepeatbutton-down"
orient="vertical"
oncommand="moveYears('down', 1);"/>
<xul:toolbarbutton class="scrollbutton-down"
orient="vertical"
oncommand="moveYears('down', 1);"
onmouseenter="startScroll('down', 1);"
onmouseout="stopScroll();"/>
</xul:menupopup>
</xul:popupset>
</content>
@ -269,6 +273,22 @@
]]></body>
</method>
<method name="startScroll">
<parameter name="direction"/>
<parameter name="scrollOffset"/>
<body><![CDATA[
this.scrollInterval = setInterval(() => {
this.moveYears(direction, scrollOffset);
}, 50);
]]></body>
</method>
<method name="stopScroll">
<body><![CDATA[
clearInterval(this.scrollInterval);
]]></body>
</method>
<method name="moveYears">
<parameter name="direction"/>
<parameter name="scrollOffset"/>
@ -306,7 +326,7 @@
}
// Go through all visible years and set the new value. Be sure to
// skip the autorepeatbuttons.
// skip the scrollbuttons.
for (let i = 1; i < years.length - 1; i++) {
let value = parseInt(years[i].getAttribute("label"), 10) + offset;
years[i].setAttribute("label", value);

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

@ -111,3 +111,10 @@
.toolbarbutton-menubutton-dropmarker {
background: rgb(154, 154, 154) linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .4));
}
menupopup[anonid="years-popup"] .scrollbutton-up,
menupopup[anonid="years-popup"] .scrollbutton-down {
-moz-appearance: none;
border: 1px solid ThreeDShadow;
padding: 0;
}

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

@ -125,3 +125,20 @@
linear-gradient(-moz-dialog, -moz-dialog);
}
}
menupopup[anonid="years-popup"] .scrollbutton-up,
menupopup[anonid="years-popup"] .scrollbutton-down {
-moz-appearance: none;
border: 1px solid transparent;
padding: 1px;
}
menupopup[anonid="years-popup"] .scrollbutton-up:not([disabled="true"]):hover,
menupopup[anonid="years-popup"] .scrollbutton-down:not([disabled="true"]):hover {
margin: 1px;
border: 1px inset ThreeDFace;
padding-top: 2px;
padding-bottom: 1px;
padding-inline-start: 2px;
padding-inline-end: 1px;
}

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

@ -248,7 +248,7 @@ function goToDate(controller, year, month, day) {
let direction = yearDifference > 0 ? "up" : "down";
let scrollArrow = lookup(`
${MINIMONTH}/anon({"anonid":"minimonth-header"})/anon({"anonid":"minmonth-popupset"})/
anon({"anonid":"years-popup"})/{"class":"autorepeatbutton-${direction}"}`);
anon({"anonid":"years-popup"})/{"class":"scrollbutton-${direction}"}`);
// Pick year.
controller.click(lookup(`