Bug 701351 - Back out 0aeaa4995892 (XUL scrollbars) [r=mfinkle]

This removes the XUL scrollbars introduced in bug 695569, as
they no longer work with the layers code.
This commit is contained in:
Kartikaya Gupta 2011-11-21 18:15:29 -05:00
parent 7e3234a633
commit 81839bdfe3
2 changed files with 1 additions and 60 deletions

View File

@ -138,16 +138,12 @@ var BrowserApp = {
_selectedTab: null,
deck: null,
vertScroller: null,
horizScroller: null,
startup: function startup() {
window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();
dump("zerdatime " + Date.now() + " - browser chrome startup finished.");
this.deck = document.getElementById("browsers");
this.vertScroller = document.getElementById("vertical-scroller");
this.horizScroller = document.getElementById("horizontal-scroller");
BrowserEventHandler.init();
getBridge().setDrawMetadataProvider(this.getDrawMetadata.bind(this));
@ -542,46 +538,6 @@ var BrowserApp = {
focused.scrollIntoView(false);
},
updateScrollbarsFor: function(aElement) {
// only draw the scrollbars if we're scrolling the root content element
let doc = this.selectedBrowser.contentDocument;
if (aElement != doc.documentElement && aElement != doc.body)
return;
// draw the vertical scrollbar as needed
let scrollMax = aElement.scrollHeight;
let viewSize = aElement.clientHeight;
if (scrollMax > viewSize) {
let scrollPos = aElement.scrollTop;
let scrollerSize = this.selectedBrowser.clientHeight;
// scrollerSize may not equal viewSize if the user has zoomed
let barStart = Math.round(scrollerSize * scrollPos / scrollMax);
let barEnd = Math.round(scrollerSize * (scrollPos + viewSize) / scrollMax);
this.vertScroller.height = (barEnd - barStart);
this.vertScroller.style.MozTransform = "translateY(" + barStart + "px)";
this.vertScroller.setAttribute("panning", "true");
}
// draw the horizontal scrollbar as needed
scrollMax = aElement.scrollWidth;
viewSize = aElement.clientWidth;
if (scrollMax > viewSize) {
let scrollPos = aElement.scrollLeft;
let scrollerSize = this.selectedBrowser.clientWidth;
// scrollerSize may not equal viewSize if the user has zoomed
let barStart = Math.round(scrollerSize * scrollPos / scrollMax);
let barEnd = Math.round(scrollerSize * (scrollPos + viewSize) / scrollMax);
this.horizScroller.width = (barEnd - barStart);
this.horizScroller.style.MozTransform = "translateX(" + barStart + "px)";
this.horizScroller.setAttribute("panning", "true");
}
},
hideScrollbars: function() {
this.vertScroller.setAttribute("panning", "");
this.horizScroller.setAttribute("panning", "");
},
getDrawMetadata: function getDrawMetadata() {
return JSON.stringify(this.selectedTab.viewportMetrics);
},
@ -1389,11 +1345,6 @@ var BrowserEventHandler = {
case "mouseup":
this.panning = false;
// hide the scrollbars in case we're done scrolling. if the
// kinetic scrolling kicks in, it will re-enable the scrollbars
// anyway by calling _scrollElementBy below
BrowserApp.hideScrollbars();
if (Math.abs(aEvent.clientX - this.startX) > kDragThreshold ||
Math.abs(aEvent.clientY - this.startY) > kDragThreshold) {
this.blockClick = true;
@ -1549,7 +1500,6 @@ var BrowserEventHandler = {
}
if (!self._elementCanScroll(panElement, -dx, -dy)) {
BrowserApp.hideScrollbars();
return;
}
@ -1558,8 +1508,6 @@ var BrowserEventHandler = {
if (Math.abs(self.panX) >= kMinKineticSpeed ||
Math.abs(self.panY) >= kMinKineticSpeed)
window.mozRequestAnimationFrame(this);
else
BrowserApp.hideScrollbars();
}
};
@ -1677,7 +1625,6 @@ var BrowserEventHandler = {
_scrollElementBy: function(elem, x, y) {
elem.scrollTop = elem.scrollTop + y;
elem.scrollLeft = elem.scrollLeft + x;
BrowserApp.updateScrollbarsFor(elem);
},
_elementCanScroll: function(elem, x, y) {

View File

@ -1,7 +1,5 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://browser/skin/browser.css" type="text/css"?>
<window id="main-window"
onload="BrowserApp.startup();"
windowtype="navigator:browser"
@ -12,10 +10,6 @@
<script type="application/javascript" src="chrome://browser/content/exceptions.js"/>
<script type="application/javascript" src="chrome://browser/content/sanitize.js"/>
<stack flex="1">
<deck id="browsers" flex="1"/>
<box id="vertical-scroller" class="scroller" orient="vertical" end="2" top="0"/>
<box id="horizontal-scroller" class="scroller" orient="horizontal" left="0" bottom="2"/>
</stack>
<deck id="browsers" flex="1"/>
</window>