Bug 1300755 - Hide notification anchors on invalid pageproxystate. r=florian
MozReview-Commit-ID: 9T3EVKb9Fi3
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -517,28 +517,16 @@ toolbar:not(#TabsToolbar) > #personal-bo
#urlbar[pageproxystate="invalid"] > #urlbar-icons > .urlbar-icon,
#urlbar[pageproxystate="invalid"][focused="true"] > #urlbar-go-button ~ toolbarbutton,
#urlbar[pageproxystate="valid"] > #urlbar-go-button,
#urlbar:not([focused="true"]) > #urlbar-go-button {
visibility: collapse;
}
-#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon-labels {
- visibility: collapse;
-}
-
-#urlbar[pageproxystate="invalid"] > #identity-box {
- pointer-events: none;
-}
-
-#urlbar[pageproxystate="invalid"] > #identity-box > #notification-popup-box {
- pointer-events: auto;
-}
-
#identity-icon-labels {
max-width: 18em;
}
@media (max-width: 700px) {
#urlbar-container {
min-width: 45ch;
}
#identity-icon-labels {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2392,17 +2392,17 @@ function BrowserPageInfo(documentURL, in
// We didn't find a matching window, so open a new one.
return openDialog("chrome://browser/content/pageinfo/pageInfo.xul", "",
"chrome,toolbar,dialog=no,resizable", args);
}
function URLBarSetURI(aURI) {
var value = gBrowser.userTypedValue;
- var valid = false;
+ gURLBar.valueIsTyped = value != null;
if (value == null) {
let uri = aURI || gBrowser.currentURI;
// Strip off "wyciwyg://" and passwords for the location bar
try {
uri = Services.uriFixup.createExposableURI(uri);
} catch (e) {}
@@ -2417,23 +2417,20 @@ function URLBarSetURI(aURI) {
} else {
// We should deal with losslessDecodeURI throwing for exotic URIs
try {
value = losslessDecodeURI(uri);
} catch (ex) {
value = "about:blank";
}
}
-
- valid = !isBlankPageURL(uri.spec);
}
gURLBar.value = value;
- gURLBar.valueIsTyped = !valid;
- SetPageProxyState(valid ? "valid" : "invalid");
+ SetPageProxyState(gURLBar.valueIsTyped ? "invalid" : "valid");
}
function losslessDecodeURI(aURI) {
let scheme = aURI.scheme;
if (scheme == "moz-action")
throw new Error("losslessDecodeURI should never get a moz-action URI");
var value = aURI.spec;
@@ -2516,36 +2513,46 @@ function UpdateUrlbarSearchSplitterState
splitter.setAttribute("overflows", "false");
splitter.className = "chromeclass-toolbar-additional";
}
urlbar.parentNode.insertBefore(splitter, ibefore);
} else if (splitter)
splitter.parentNode.removeChild(splitter);
}
-function UpdatePageProxyState()
-{
+function InvalidatePageProxyState() {
if (gURLBar && gURLBar.value != gLastValidURLStr)
SetPageProxyState("invalid");
}
+function ValidatePageProxyState() {
+ SetPageProxyState("valid");
+}
+
function SetPageProxyState(aState)
{
if (!gURLBar)
return;
+ // about:blank is always invalid
+ if (isBlankPageURL(gBrowser.currentURI.spec)) {
+ aState = "invalid";
+ }
+
gURLBar.setAttribute("pageproxystate", aState);
// the page proxy state is set to valid via OnLocationChange, which
// gets called when we switch tabs.
if (aState == "valid") {
gLastValidURLStr = gURLBar.value;
- gURLBar.addEventListener("input", UpdatePageProxyState, false);
+ gURLBar.addEventListener("input", InvalidatePageProxyState, false);
+ gURLBar.removeEventListener("blur", ValidatePageProxyState, false);
} else if (aState == "invalid") {
- gURLBar.removeEventListener("input", UpdatePageProxyState, false);
+ gURLBar.removeEventListener("input", InvalidatePageProxyState, false);
+ gURLBar.addEventListener("blur", ValidatePageProxyState, false);
}
}
function PageProxyClickHandler(aEvent)
{
if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste"))
middleMousePaste(aEvent);
}
--- a/browser/themes/shared/identity-block/identity-block.inc.css
+++ b/browser/themes/shared/identity-block/identity-block.inc.css
@@ -67,21 +67,19 @@
width: 16px;
height: 16px;
}
#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon {
opacity: .3;
}
-#urlbar[actiontype="searchengine"] > #identity-box > #identity-icon {
+#urlbar[pageproxystate="invalid"][actiontype="searchengine"] > #identity-box > #identity-icon {
-moz-image-region: inherit;
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
- width: 16px;
- height: 16px;
}
/* SHARING ICON */
#sharing-icon {
width: 16px;
height: 16px;
margin-inline-start: -16px;
@@ -96,22 +94,22 @@
#identity-box[sharing="microphone"] > #sharing-icon {
list-style-image: url("chrome://browser/skin/notification-icons.svg#microphone-sharing");
}
#identity-box[sharing="screen"] > #sharing-icon {
list-style-image: url("chrome://browser/skin/notification-icons.svg#screen-sharing");
}
-#identity-box[sharing] > #sharing-icon {
+#urlbar[pageproxystate="valid"] > #identity-box[sharing] > #sharing-icon {
display: -moz-box;
animation-delay: -1.5s;
}
-#identity-box[sharing] > #identity-icon,
+#urlbar[pageproxystate="valid"] > #identity-box[sharing] > #identity-icon,
#sharing-icon {
animation: 3s linear pulse infinite;
}
@keyframes pulse {
0%, 16.66%, 83.33%, 100% {
opacity: 0;
}
@@ -136,16 +134,24 @@
#tracking-protection-icon:not([state]) {
margin-inline-end: -18px;
pointer-events: none;
opacity: 0;
/* Only animate the shield in, when it disappears hide it immediately. */
transition: none;
}
+#urlbar[pageproxystate="invalid"] > #identity-box {
+ pointer-events: none;
+}
+
+#urlbar[pageproxystate="invalid"] > #identity-box > #connection-icon,
+#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon-labels,
+#urlbar[pageproxystate="invalid"] > #identity-box > #notification-popup-box,
+#urlbar[pageproxystate="invalid"] > #identity-box > #blocked-permissions-container,
#urlbar[pageproxystate="invalid"] > #identity-box > #tracking-protection-icon {
visibility: collapse;
}
/* CONNECTION ICON */
#connection-icon {
width: 16px;