зеркало из https://github.com/mozilla/pjs.git
Fix for 32087, custom icon support in tabs and url bar. r=andreww, sr=hewitt
This commit is contained in:
Родитель
b17602248e
Коммит
476240ad2f
|
@ -42,11 +42,14 @@ const XREMOTESERVICE_CONTRACTID = "@mozilla.org/browser/xremoteservice;1";
|
||||||
|
|
||||||
var gURLBar = null;
|
var gURLBar = null;
|
||||||
var gProxyButton = null;
|
var gProxyButton = null;
|
||||||
|
var gProxyFavIcon = null;
|
||||||
|
var gProxyDeck = null;
|
||||||
var gNavigatorBundle;
|
var gNavigatorBundle;
|
||||||
var gBrandBundle;
|
var gBrandBundle;
|
||||||
var gNavigatorRegionBundle;
|
var gNavigatorRegionBundle;
|
||||||
var gBrandRegionBundle;
|
var gBrandRegionBundle;
|
||||||
var gLastValidURL = "";
|
var gLastValidURLStr = "";
|
||||||
|
var gLastValidURL = null;
|
||||||
var gHaveUpdatedToolbarState = false;
|
var gHaveUpdatedToolbarState = false;
|
||||||
var gClickSelectsAll = -1;
|
var gClickSelectsAll = -1;
|
||||||
|
|
||||||
|
@ -266,7 +269,7 @@ function Startup()
|
||||||
gBrowser = document.getElementById("content");
|
gBrowser = document.getElementById("content");
|
||||||
gURLBar = document.getElementById("urlbar");
|
gURLBar = document.getElementById("urlbar");
|
||||||
|
|
||||||
SetPageProxyState("invalid");
|
SetPageProxyState("invalid", null);
|
||||||
|
|
||||||
var webNavigation;
|
var webNavigation;
|
||||||
try {
|
try {
|
||||||
|
@ -1514,7 +1517,7 @@ function handleURLBarRevert()
|
||||||
if (url != "about:blank") {
|
if (url != "about:blank") {
|
||||||
gURLBar.value = url;
|
gURLBar.value = url;
|
||||||
gURLBar.select();
|
gURLBar.select();
|
||||||
SetPageProxyState("valid");
|
SetPageProxyState("valid", null); // XXX Build a URI and pass it in here.
|
||||||
} else { //if about:blank, urlbar becomes ""
|
} else { //if about:blank, urlbar becomes ""
|
||||||
gURLBar.value = "";
|
gURLBar.value = "";
|
||||||
}
|
}
|
||||||
|
@ -1533,23 +1536,39 @@ function handleURLBarCommand(aUserAction)
|
||||||
|
|
||||||
function UpdatePageProxyState()
|
function UpdatePageProxyState()
|
||||||
{
|
{
|
||||||
if (gURLBar.value != gLastValidURL)
|
if (gURLBar.value != gLastValidURLStr)
|
||||||
SetPageProxyState("invalid");
|
SetPageProxyState("invalid", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetPageProxyState(aState)
|
function SetPageProxyState(aState, aURI)
|
||||||
{
|
{
|
||||||
if (!gProxyButton)
|
if (!gProxyButton)
|
||||||
gProxyButton = document.getElementById("page-proxy-button");
|
gProxyButton = document.getElementById("page-proxy-button");
|
||||||
|
if (!gProxyFavIcon)
|
||||||
|
gProxyFavIcon = document.getElementById("page-proxy-favicon");
|
||||||
|
if (!gProxyDeck)
|
||||||
|
gProxyDeck = document.getElementById("page-proxy-deck");
|
||||||
|
|
||||||
gProxyButton.setAttribute("pageproxystate", aState);
|
gProxyButton.setAttribute("pageproxystate", aState);
|
||||||
|
|
||||||
if (aState == "valid") {
|
if (aState == "valid") {
|
||||||
gLastValidURL = gURLBar.value;
|
gLastValidURLStr = gURLBar.value;
|
||||||
gURLBar.addEventListener("input", UpdatePageProxyState, false);
|
gURLBar.addEventListener("input", UpdatePageProxyState, false);
|
||||||
} else if (aState == "invalid")
|
if (pref.getBoolPref("browser.chrome.site_icons") && aURI && "schemeIs" in aURI && (aURI.schemeIs("http") || aURI.schemeIs("https"))) {
|
||||||
|
var favurl = gBrowser.buildFavIconString(aURI);
|
||||||
|
if (favurl != gProxyFavIcon.src) {
|
||||||
|
gProxyFavIcon.setAttribute("src", favurl);
|
||||||
|
gProxyDeck.selectedIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gProxyDeck.selectedIndex = 0;
|
||||||
|
gProxyFavIcon.removeAttribute("src");
|
||||||
|
}
|
||||||
|
} else if (aState == "invalid") {
|
||||||
gURLBar.removeEventListener("input", UpdatePageProxyState, false);
|
gURLBar.removeEventListener("input", UpdatePageProxyState, false);
|
||||||
|
gProxyDeck.selectedIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PageProxyDragGesture(aEvent)
|
function PageProxyDragGesture(aEvent)
|
||||||
|
|
|
@ -179,9 +179,13 @@ Contributor(s): ______________________________________. -->
|
||||||
ontextrevert="return handleURLBarRevert();"
|
ontextrevert="return handleURLBarRevert();"
|
||||||
onfocus="URLBarFocusHandler(event);"
|
onfocus="URLBarFocusHandler(event);"
|
||||||
onblur="URLBarBlurHandler(event);">
|
onblur="URLBarBlurHandler(event);">
|
||||||
<image id="page-proxy-button" allowevents="true"
|
<deck id="page-proxy-deck">
|
||||||
ondraggesture="PageProxyDragGesture(event);"/>
|
<image id="page-proxy-button"
|
||||||
|
ondraggesture="PageProxyDragGesture(event);"/>
|
||||||
|
<image id="page-proxy-favicon" validate="never"
|
||||||
|
ondraggesture="PageProxyDragGesture(event);"
|
||||||
|
onload="this.parentNode.selectedIndex = 1; event.stopPropagation(); event.preventBubble();"/>
|
||||||
|
</deck>
|
||||||
<menupopup id="ubhist-popup" class="autocomplete-history-popup"
|
<menupopup id="ubhist-popup" class="autocomplete-history-popup"
|
||||||
popupalign="topleft" popupanchor="bottomleft"
|
popupalign="topleft" popupanchor="bottomleft"
|
||||||
onpopupshowing="createUBHistoryMenu(event.target);"
|
onpopupshowing="createUBHistoryMenu(event.target);"
|
||||||
|
|
|
@ -141,6 +141,11 @@ nsBrowserStatusHandler.prototype =
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLinkIconAvailable : function(aHref) {
|
||||||
|
if (gProxyFavIcon)
|
||||||
|
gProxyFavIcon.setAttribute("src", aHref);
|
||||||
|
},
|
||||||
|
|
||||||
onProgressChange : function (aWebProgress, aRequest,
|
onProgressChange : function (aWebProgress, aRequest,
|
||||||
aCurSelfProgress, aMaxSelfProgress,
|
aCurSelfProgress, aMaxSelfProgress,
|
||||||
aCurTotalProgress, aMaxTotalProgress)
|
aCurTotalProgress, aMaxTotalProgress)
|
||||||
|
@ -261,7 +266,7 @@ nsBrowserStatusHandler.prototype =
|
||||||
// Do not update urlbar if there was a subframe navigation
|
// Do not update urlbar if there was a subframe navigation
|
||||||
if (domWindow == domWindow.top) {
|
if (domWindow == domWindow.top) {
|
||||||
this.urlBar.value = location;
|
this.urlBar.value = location;
|
||||||
SetPageProxyState("valid");
|
SetPageProxyState("valid", aLocation);
|
||||||
}
|
}
|
||||||
UpdateBackForwardButtons();
|
UpdateBackForwardButtons();
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче