Backed out changeset b46982cc0c0a from bug 572967 due to test failures

--HG--
extra : rebase_source : 8ef47209d527047ab2770ae44fb0467fdf2fa97d
This commit is contained in:
Gavin Sharp 2010-08-03 01:37:10 -04:00
Родитель 49c2704d31
Коммит 404c19684e
7 изменённых файлов: 18 добавлений и 85 удалений

Просмотреть файл

@ -325,7 +325,6 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
notifications are */
.notification-anchor-icon {
display: none;
-moz-user-focus: normal;
}
#notification-popup-box[anchorid="geo-notification-icon"] > #geo-notification-icon,

Просмотреть файл

@ -159,13 +159,9 @@ XPCOMUtils.defineLazyGetter(this, "Weave", function() {
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
let tmp = {};
Cu.import("resource://gre/modules/PopupNotifications.jsm", tmp);
try {
return new tmp.PopupNotifications(gBrowser,
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"));
} catch (ex) {
Cu.reportError(ex);
}
return new tmp.PopupNotifications(gBrowser,
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"));
});
let gInitialPages = [

Просмотреть файл

@ -679,8 +679,8 @@
onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
onblur="setTimeout(function() document.getElementById('identity-box').style.MozUserFocus = '', 0);">
<box id="notification-popup-box" hidden="true" align="center">
<image id="geo-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="addons-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="geo-notification-icon" class="notification-anchor-icon"/>
<image id="addons-notification-icon" class="notification-anchor-icon"/>
</box>
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events.

Просмотреть файл

@ -1007,10 +1007,6 @@ toolbar[iconsize="small"] #fullscreen-button {
height: 16px;
}
.notification-anchor-icon:focus {
outline: 1px dotted -moz-DialogText;
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

Просмотреть файл

@ -1863,11 +1863,6 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
margin: 0 2px;
}
.notification-anchor-icon:focus {
-moz-box-shadow: 0 0 3px 1px -moz-mac-focusring inset,
0 0 3px 2px -moz-mac-focusring;
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

Просмотреть файл

@ -1613,11 +1613,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
height: 16px;
}
.notification-anchor-icon:focus {
outline: 1px dotted -moz-DialogText;
outline-offset: -3px;
}
#geo-notification-icon {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}

Просмотреть файл

@ -69,7 +69,7 @@ Notification.prototype = {
get anchorElement() {
let anchorElement = null;
if (this.anchorID)
anchorElement = this.owner.iconBox.querySelector("#"+this.anchorID);
anchorElement = this.owner.window.document.getElementById(this.anchorID);
if (!anchorElement)
anchorElement = this.owner.iconBox;
@ -89,32 +89,17 @@ Notification.prototype = {
* populated with <popupnotification> children and displayed it as
* needed.
* @param iconBox
* Reference to a container element that should be hidden or
* unhidden when notifications are hidden or shown. It should be the
* parent of anchor elements whose IDs are passed to show().
* It is used as a fallback popup anchor if notifications specify
* invalid or non-existent anchor IDs.
* Optional reference to a container element that should be hidden or
* unhidden when notifications are hidden or shown. Used as a fallback
* popup anchor if notifications do not specify anchor IDs.
*/
function PopupNotifications(tabbrowser, panel, iconBox) {
if (!(tabbrowser instanceof Ci.nsIDOMXULElement))
throw "Invalid tabbrowser";
if (!(iconBox instanceof Ci.nsIDOMXULElement))
throw "Invalid iconBox";
if (!(panel instanceof Ci.nsIDOMXULElement))
throw "Invalid panel";
this.window = tabbrowser.ownerDocument.defaultView;
this.panel = panel;
this.iconBox = iconBox;
this.tabbrowser = tabbrowser;
let self = this;
this.iconBox.addEventListener("click", function (event) {
self._onIconBoxCommand(event);
}, false);
this.iconBox.addEventListener("keypress", function (event) {
self._onIconBoxCommand(event);
}, false);
this.panel.addEventListener("popuphidden", function (event) {
self._onPopupHidden(event);
}, true);
@ -186,9 +171,6 @@ PopupNotifications.prototype = {
* dismiss for this many page loads.
* timeout: A time in milliseconds. The notification will not
* automatically dismiss before this time.
* dismissed: Whether the notification should be added as a dismissed
* notification. Dismissed notifications can be activated
* by clicking on their anchorElement.
* @returns the Notification object corresponding to the added notification.
*/
show: function PopupNotifications_show(browser, id, message, anchorID,
@ -211,8 +193,6 @@ PopupNotifications.prototype = {
let notification = new Notification(id, message, anchorID, mainAction,
secondaryActions, browser, this, options);
if (options && options.dismissed)
notification.dismissed = true;
let existingNotification = this.getNotification(id, browser);
if (existingNotification)
@ -386,19 +366,19 @@ PopupNotifications.prototype = {
*/
_update: function PopupNotifications_update(anchor) {
let anchorElement, notificationsToShow = [];
let haveNotifications = this._currentNotifications.length > 0;
if (haveNotifications) {
if (this._currentNotifications.length > 0) {
// Only show the notifications that have the passed-in anchor (or the
// first notification's anchor, if none was passed in). Other
// notifications will be shown once these are dismissed.
anchorElement = anchor || this._currentNotifications[0].anchorElement;
this.iconBox.hidden = false;
this.iconBox.setAttribute("anchorid", anchorElement.id);
if (this.iconBox) {
this.iconBox.hidden = false;
this.iconBox.setAttribute("anchorid", anchorElement.id);
}
// Also filter out notifications that have been dismissed.
notificationsToShow = this._currentNotifications.filter(function (n) {
return !n.dismissed && n.anchorElement == anchorElement;
return n.anchorElement == anchorElement;
});
}
@ -410,9 +390,7 @@ PopupNotifications.prototype = {
this._hidePanel();
// Only hide the iconBox if we actually have no notifications (as opposed
// to not having any showable notifications)
if (this.iconBox && !haveNotifications)
if (this.iconBox)
this.iconBox.hidden = true;
}
},
@ -424,40 +402,14 @@ PopupNotifications.prototype = {
return browser.popupNotifications = [];
},
_onIconBoxCommand: function PopupNotifications_onIconBoxCommand(event) {
// Left click, space or enter only
let type = event.type;
if (type == "click" && event.button != 0)
return;
if (type == "keypress" &&
!(event.charCode == Ci.nsIDOMKeyEvent.DOM_VK_SPACE ||
event.keyCode == Ci.nsIDOMKeyEvent.DOM_VK_RETURN))
return;
if (this._currentNotifications.length == 0)
return;
let anchor = event.originalTarget;
// Mark notifications anchored to this anchor as un-dismissed
this._currentNotifications.forEach(function (n) {
if (n.anchorElement == anchor)
n.dismissed = false;
});
// ...and then show them.
this._update(anchor);
},
_onPopupHidden: function PopupNotifications_onPopupHidden(event) {
if (event.target != this.panel || this._ignoreDismissal)
return;
// Mark notifications as dismissed
// Remove notifications being dismissed
Array.forEach(this.panel.childNodes, function (nEl) {
let notificationObj = nEl.notification;
notificationObj.dismissed = true;
this._remove(notificationObj);
}, this);
this._update();