Trunk/M092 topcrash @ nsMenuFrame::ActivateMenu, and a slew of dnd fixes (90151). r=dean sr=ben

This commit is contained in:
blakeross%telocity.com 2006-09-14 05:59:13 +00:00
parent 6ca281ea31
commit b61aacfd91
2 changed files with 20 additions and 9 deletions

View File

@ -262,7 +262,7 @@ Contributor(s): ______________________________________. -->
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
label="rdf:http://home.netscape.com/NC-rdf#Name"
ondraggesture="event.preventBubble(); return false;">
<menupopup ondraggesture="nsDragAndDrop.startDrag(event, homeButtonObserver);"/>
<menupopup ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarObserver);"/>
</menubutton>
</rule>

View File

@ -79,7 +79,21 @@ var personalToolbarObserver = {
// there.
if (navigator.platform != "Win32" && aEvent.target.localName != "button")
return;
if (aEvent.target.localName == "menu" || aEvent.target.localName == "menubutton") {
if (aEvent.target.getAttribute("type") == "http://home.netscape.com/NC-rdf#Folder") {
var child = aEvent.target.childNodes[0];
if (child && child.localName == "menupopup")
child.closePopup();
else {
var parent = aEvent.target.parentNode;
if (parent && parent.localName == "menupopup")
parent.closePopup();
}
}
}
var personalToolbar = document.getElementById("PersonalToolbar");
if (aEvent.target == personalToolbar) return;
@ -209,12 +223,7 @@ var personalToolbarObserver = {
onDragOver: function (aEvent, aFlavour, aDragSession)
{
var dropPosition
if (aEvent.target.getAttribute("type") == "http://home.netscape.com/NC-rdf#Folder"
&& aEvent.target.getAttribute("container") == "true")
dropPosition = this.DROP_ON;
else
dropPosition = this.determineDropPosition(aEvent);
var dropPosition = this.determineDropPosition(aEvent);
// bail if drop target is not a valid bookmark item or folder
var inner = document.getElementById("innermostBox");
@ -280,7 +289,7 @@ var personalToolbarObserver = {
// you can drop ONTO containers, so there is a "middle" region
if (overButton.getAttribute("container") == "true" &&
overButton.getAttribute("type") == "http://home.netscape.com/NC-rdf#Folder")
regionCount = 3;
return this.DROP_ON;
var regionWidth = overButtonBoxObject.width/regionCount;
@ -316,6 +325,8 @@ var personalToolbarObserver = {
case "menu":
case "menuitem":
var menu = aElement.parentNode.parentNode;
if (menu.getAttribute("type") != "http://home.netscape.com/NC-rdf#Folder")
return RDFUtils.getResource("NC:BookmarksRoot");
return RDFUtils.getResource(menu.id);
case "treecell":
var treeitem = aElement.parentNode.parentNode.parentNode.parentNode;