this.boxObject.scrollByIndex(index); document.getAnonymousElementByAttribute(this, "anonid", "scrollbox"); document.getAnonymousElementByAttribute(this, "anonid", "scrollbutton-up"); document.getAnonymousElementByAttribute(this, "anonid", "scrollbutton-down"); null null null null 0 ? rect[end] + 1 : rect[start] - 1; var nextElement = this._elementFromPoint(x, index); if (!nextElement) return; var targetElement; if (this._isRTLScrollbox) index *= -1; while (index < 0 && nextElement) { if (this._canScrollToElement(nextElement)) targetElement = nextElement; nextElement = nextElement.previousSibling; index++; } while (index > 0 && nextElement) { if (this._canScrollToElement(nextElement)) targetElement = nextElement; nextElement = nextElement.nextSibling; index--; } if (!targetElement) return; this.ensureElementIsVisible(targetElement, aInstant); ]]> 0 ? rect[end] + 1 : rect[start] - 1; var pixelDelta = pageDelta * (rect[end] - rect[start]); var destinationPosition = containerEdge + pixelDelta; var nextElement = this._elementFromPoint(containerEdge, pageDelta); if (!nextElement) return; // We need to iterate over our elements in the direction of pageDelta. // pageDelta is the physical direction, so in a horizontal scroll box, // positive values scroll to the right no matter if the scrollbox is // LTR or RTL. But RTL changes how we need to advance the iteration // (whether to get the next or the previous sibling of the current // element). var logicalAdvanceDir = pageDelta * (this._isRTLScrollbox ? -1 : 1); var advance = logicalAdvanceDir > 0 ? (e => e.nextSibling) : (e => e.previousSibling); var extendsPastTarget = (pageDelta > 0) ? (e => e.getBoundingClientRect()[end] > destinationPosition) : (e => e.getBoundingClientRect()[start] < destinationPosition); // We want to scroll to the last element we encounter before we find // an element which extends past destinationPosition. var targetElement; do { if (this._canScrollToElement(nextElement)) targetElement = nextElement; nextElement = advance(nextElement); } while (nextElement && !extendsPastTarget(nextElement)); if (!targetElement) return; this.ensureElementIsVisible(targetElement, aInstant); ]]> elements[high].getBoundingClientRect()[end]) return null; var mid, rect; while (low <= high) { mid = Math.floor((low + high) / 2); rect = elements[mid].getBoundingClientRect(); if (rect[start] > aX) high = mid - 1; else if (rect[end] < aX) low = mid + 1; else return elements[mid]; } // There's no element at the requested coordinate, but the algorithm // from above yields an element next to it, in a random direction. // The desired scrolling direction leads to the correct element. if (!aPhysicalScrollDir) return null; if (aPhysicalScrollDir < 0 && rect[start] > aX) mid = Math.max(mid - 1, 0); else if (aPhysicalScrollDir > 0 && rect[end] < aX) mid = Math.min(mid + 1, elements.length - 1); return elements[mid]; ]]> [null, null] -1 false { setTimeout(() => { this._scrollButtonUpdatePending = false; let scrolledToStart = false; let scrolledToEnd = false; if (this.hasAttribute("notoverflowing")) { scrolledToStart = true; scrolledToEnd = true; } else { let [leftOrTop, rightOrBottom] = this._startEndProps; let leftOrTopEdge = ele => Math.round(this._boundsWithoutFlushing(ele)[leftOrTop]); let rightOrBottomEdge = ele => Math.round(this._boundsWithoutFlushing(ele)[rightOrBottom]); let elements = this._getScrollableElements(); let [leftOrTopElement, rightOrBottomElement] = [elements[0], elements[elements.length - 1]]; if (this._isRTLScrollbox) { [leftOrTopElement, rightOrBottomElement] = [rightOrBottomElement, leftOrTopElement]; } if (leftOrTopElement && leftOrTopEdge(leftOrTopElement) >= leftOrTopEdge(this._scrollbox)) { scrolledToStart = !this._isRTLScrollbox; scrolledToEnd = this._isRTLScrollbox; } else if (rightOrBottomElement && rightOrBottomEdge(rightOrBottomElement) <= rightOrBottomEdge(this._scrollbox)) { scrolledToStart = this._isRTLScrollbox; scrolledToEnd = !this._isRTLScrollbox; } } if (scrolledToEnd) { this.setAttribute("scrolledtoend", "true"); } else { this.removeAttribute("scrolledtoend"); } if (scrolledToStart) { this.setAttribute("scrolledtostart", "true"); } else { this.removeAttribute("scrolledtostart"); } }, 0); }); ]]> Math.abs(event.deltaX); let delta = isVertical ? event.deltaY : event.deltaX; let scrollByDelta = isVertical && this._isRTLScrollbox ? -delta : delta; if (this._prevMouseScrolls.every(prev => prev == isVertical)) { doScroll = true; if (event.deltaMode == event.DOM_DELTA_PIXEL) { scrollAmount = scrollByDelta; instant = true; } else if (event.deltaMode == event.DOM_DELTA_PAGE) { scrollAmount = scrollByDelta * this.scrollClientSize; } else { scrollAmount = scrollByDelta * this.lineScrollAmount; } } if (this._prevMouseScrolls.length > 1) this._prevMouseScrolls.shift(); this._prevMouseScrolls.push(isVertical); } if (doScroll) { this.scrollByPixels(scrollAmount, instant); } event.stopPropagation(); event.preventDefault(); ]]> 1) { // Multiple touch points detected, abort. In particular this aborts // the panning gesture when the user puts a second finger down after // already panning with one finger. Aborting at this point prevents // the pan gesture from being resumed until all fingers are lifted // (as opposed to when the user is back down to one finger). this._touchStart = -1; } else { this._touchStart = (this.orient == "vertical" ? event.touches[0].screenY : event.touches[0].screenX); } ]]> = 0) { var touchPoint = (this.orient == "vertical" ? event.touches[0].screenY : event.touches[0].screenX); var delta = this._touchStart - touchPoint; if (Math.abs(delta) > 0) { this.scrollByPixels(delta, true); this._touchStart = touchPoint; } event.preventDefault(); } ]]> 0 150 3) return; var scrollBack = (aEvent.originalTarget == this._scrollButtonUp); var scrollLeftOrUp = this._isRTLScrollbox ? !scrollBack : scrollBack; var targetElement; if (aEvent.detail == 2) { // scroll by the size of the scrollbox let [start, end] = this._startEndProps; let x; if (scrollLeftOrUp) x = this.scrollClientRect[start] - this.scrollClientSize; else x = this.scrollClientRect[end] + this.scrollClientSize; targetElement = this._elementFromPoint(x, scrollLeftOrUp ? -1 : 1); // the next partly-hidden element will become fully visible, // so don't scroll too far if (targetElement) targetElement = scrollBack ? targetElement.nextSibling : targetElement.previousSibling; } if (!targetElement) { // scroll to the first resp. last element let elements = this._getScrollableElements(); targetElement = scrollBack ? elements[0] : elements[elements.length - 1]; } this.ensureElementIsVisible(targetElement); ]]>