From c4915bdc61bf8b19c9631a3e92f8836e89c9b419 Mon Sep 17 00:00:00 2001 From: "sdwilsh@shawnwilsher.com" Date: Tue, 26 Jun 2007 17:25:25 -0700 Subject: [PATCH] =?UTF-8?q?Bug=20366797=20-=20Revise=20the=20Location=20Ba?= =?UTF-8?q?r.=20=20Patch=20by=20D=C3=A3o=20Gottwald=20?= =?UTF-8?q?.=20r=3Dgavin.sharp,=20ui-r=3Dbeltzner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- browser/base/content/browser.css | 4 + browser/base/content/browser.js | 13 +- browser/base/content/browser.xul | 4 + browser/base/content/urlbarBindings.xml | 492 ++++++++++++++++++- browser/themes/pinstripe/browser/browser.css | 50 ++ browser/themes/winstripe/browser/browser.css | 50 ++ 6 files changed, 611 insertions(+), 2 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 3a5069551a6d..3330848d5b47 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -3,6 +3,10 @@ searchbar { } /* ::::: location bar ::::: */ +#urlbar { + -moz-binding: url(chrome://browser/content/urlbarBindings.xml#urlbar); +} + #PopupAutoComplete { -moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-result-popup"); } diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7561b38df7d6..98af79a85e57 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1016,8 +1016,10 @@ function delayedStartup() goButtonStack.setAttribute("hidden", "true"); } - if (gURLBar) + if (gURLBar) { + gURLBar.addEventListener("dragover", URLBarOnDragOver, true); gURLBar.addEventListener("dragdrop", URLBarOnDrop, true); + } gBrowser.addEventListener("pageshow", function(evt) { setTimeout(pageShowEventHandlers, 0, evt); }, true); @@ -2469,12 +2471,21 @@ function PageProxyClickHandler(aEvent) return true; } +function URLBarOnDragOver(evt) +{ + nsDragAndDrop.dragOver(evt, urlbarObserver); +} + function URLBarOnDrop(evt) { nsDragAndDrop.drop(evt, urlbarObserver); } var urlbarObserver = { + onDragOver: function () + { + return true; + }, onDrop: function (aEvent, aXferData, aDragSession) { var url = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType); diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 7404282573b0..bc91b23d2863 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -132,6 +132,10 @@ + + + #ifndef MOZ_PLACES diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index fff7bf3af3ff..3bb141d84ecf 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -22,6 +22,7 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Dão Gottwald # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -37,7 +38,496 @@ # # ***** END LICENSE BLOCK ***** - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [] + + + + [] + + + document.getAnonymousElementByAttribute(this, "anonid", "textbox-input-box"); + + + document.getAnonymousElementByAttribute(this, "anonid", "presentation-box"); + + + document.getAnonymousElementByAttribute(this, "anonid", "overflow-ellipsis"); + + + document.getAnonymousElementByAttribute(this, "anonid", "prePath"); + + + document.getAnonymousElementByAttribute(this, "anonid", "protocol"); + + + document.getAnonymousElementByAttribute(this, "anonid", "subdomain"); + + + document.getAnonymousElementByAttribute(this, "anonid", "domain"); + + + document.getAnonymousElementByAttribute(this, "anonid", "port"); + + + document.getAnonymousElementByAttribute(this, "anonid", "directory"); + + + document.getAnonymousElementByAttribute(this, "anonid", "fileBaseName"); + + + document.getAnonymousElementByAttribute(this, "anonid", "fileExtension"); + + + document.getAnonymousElementByAttribute(this, "anonid", "param"); + + + document.getAnonymousElementByAttribute(this, "anonid", "query"); + + + document.getAnonymousElementByAttribute(this, "anonid", "ref"); + + + document.getElementById("urlTooltip"); + + + this._urlTooltip.getElementsByTagName("label")[0]; + + + Components.classes["@mozilla.org/network/effective-tld-service;1"] + .getService(Components.interfaces.nsIEffectiveTLDService); + + + Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService); + + + Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefService) + .getBranch("browser.urlbar.") + .QueryInterface(Components.interfaces.nsIPrefBranch2); + + + true + + + + + + + + + + + + 1 ? arguments : arguments[0]; + ]]> + + + + + -1; + this._subDomain.removeAttribute("value"); + this._port.removeAttribute("value"); + + var host = this._uri.host; + if (host) { + //XXX workaround for bug 364129 + if (!/^[.0-9]+$/.test(host)) { + // getEffectiveTLDLength might convert our host and return a misleading length. + // To avoid this, pass the ASCII host, count the dots of its effective TLD + // and use that number to operate on our actual host. + + var asciiHost = this._uri.asciiHost; + var domainSegments = host.split("."); + var cSubdomain = domainSegments.length - + asciiHost.slice(asciiHost.length - + this._tldService.getEffectiveTLDLength(asciiHost)) + .split(".").length - 1; + if (cSubdomain > 0) { + host = domainSegments; + var subdomain = host.splice(0, cSubdomain); + this._subDomain.setAttribute("value", subdomain.join(".") + "."); + host = host.join("."); + } + } + this._domain.setAttribute("value", host); + if (this._uri.port > -1) + this._port.setAttribute("value", ":" + this._uri.port); + } else { + this._domain.removeAttribute("value"); + } + + [directory, fileBaseName, fileExtension, param, query, ref] + = this._decodeURI(this._uri.directory, + this._uri.fileBaseName, + this._uri.fileExtension, + this._uri.param, + this._uri.query, + this._uri.ref); + + this._directory.setAttribute("value", directory); + this._fileBaseName.setAttribute("value", fileBaseName); + this._fileExtension.setAttribute("value", fileExtension ? "." + fileExtension : ""); + this._param.setAttribute("value", param ? ";" + param : ""); + this._query.setAttribute("value", query ? "?" + query : ""); + this._ref.setAttribute("value", ref ? "#" + ref : ""); + ]]> + + + + + + + + + 0) { + opacity -= opacity * DECLINATION_REL + DECLINATION_ABS; + if (opacity < 0) + opacity = 0; + this._blendingTimers.push(setTimeout(processFrame, delay, opacity, delay == INITIAL_DELAY)); + delay += FRAME_LENGTH; + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + pBO.screenX + pBO.width) + return; + } + this._mouseover = true; + setTimeout(function(self) { + if (self._mouseover) { + self.plain = true; + if (!self._focused && self._contentIsCropped) + self._initURLTooltip(function() { + return this.plain ? this.value : null; + }, self, "start"); + } + }, 60, this); + ]]> + + + + + + + + + + diff --git a/browser/themes/pinstripe/browser/browser.css b/browser/themes/pinstripe/browser/browser.css index c17abae1f311..8f8c41cb00b6 100755 --- a/browser/themes/pinstripe/browser/browser.css +++ b/browser/themes/pinstripe/browser/browser.css @@ -24,6 +24,7 @@ * Pierre Chanial (chanial@noos.fr) * Kevin Gerich (webmail@kmgerich.com) * Pamela Greene (pamg.bugs@gmail.com) + * Dao Gottwald (dao@design-noir.de) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -865,6 +866,55 @@ toolbar[iconsize="small"] #paste-button:hover:active { font: icon !important; } +.textbox-presentation-box , +.textbox-presentation-box > * , +.textbox-presentation > * , +.textbox-presentation-prePath > * { + margin: 0; + padding: 0; + cursor: text; +} + +.textbox-overflow-ellipsis { + -moz-margin-start: .3em; +} + +.textbox-presentation-box { + -moz-box-align: center; + margin: 0 3px; + /*XXX Gecko 1.9 quirk*/ + -moz-padding-start: 1px; +} + +#urlbar[protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-slash , +#urlbar[protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-subdomain { + -moz-box-flex: 1; + text-align: right; +} + +#urlbar[chromedir="rtl"][protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-slash , +#urlbar[chromedir="rtl"][protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-subdomain { + text-align: left; +} + +.textbox-presentation { + color: graytext; +} + +.textbox-presentation-domain { + color: -moz-fieldtext; +} + +#urlbar[level="high"] .textbox-presentation , +#urlbar[level="low"] .textbox-presentation { + color: rgb(150, 150, 130); +} + +#urlbar[level="low"] .textbox-presentation-domain , +#urlbar[level="high"] .textbox-presentation-domain { + color: black; +} + #urlbar[level="high"] > .autocomplete-textbox-container, #urlbar[level="low"] > .autocomplete-textbox-container { diff --git a/browser/themes/winstripe/browser/browser.css b/browser/themes/winstripe/browser/browser.css index 3ddb163b7782..8f323d87fb3a 100644 --- a/browser/themes/winstripe/browser/browser.css +++ b/browser/themes/winstripe/browser/browser.css @@ -25,6 +25,7 @@ * Dean Tessman (dean_tessman@hotmail.com) * Blake Ross (blake@cs.stanford.edu) * Pamela Greene (pamg.bugs@gmail.com) + * Dao Gottwald (dao@design-noir.de) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -870,6 +871,55 @@ toolbar[iconsize="small"] #paste-button:not([disabled="true"]):hover:active { border: 1px solid; } +.textbox-presentation-box , +.textbox-presentation-box > * , +.textbox-presentation > * , +.textbox-presentation-prePath > * { + margin: 0; + padding: 0; + cursor: text; +} + +.textbox-overflow-ellipsis { + -moz-margin-start: .3em; +} + +.textbox-presentation-box { + -moz-box-align: center; + margin: 0 3px; + /*XXX Gecko 1.9 quirk*/ + -moz-padding-start: 1px; +} + +#urlbar[protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-slash , +#urlbar[protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-subdomain { + -moz-box-flex: 1; + text-align: right; +} + +#urlbar[chromedir="rtl"][protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-slash , +#urlbar[chromedir="rtl"][protocolhidden="true"] .textbox-presentation-prePath > .textbox-presentation-subdomain { + text-align: left; +} + +.textbox-presentation { + color: graytext; +} + +.textbox-presentation-domain { + color: -moz-fieldtext; +} + +#urlbar[level="high"] .textbox-presentation , +#urlbar[level="low"] .textbox-presentation { + color: rgb(150, 150, 130); +} + +#urlbar[level="low"] .textbox-presentation-domain , +#urlbar[level="high"] .textbox-presentation-domain { + color: black; +} + #urlbar-container { -moz-box-orient: horizontal; -moz-box-align: stretch;