diff --git a/mozilla/content/shared/public/nsXULAtomList.h b/mozilla/content/shared/public/nsXULAtomList.h index ffc416e7ebd..db81bb1829c 100644 --- a/mozilla/content/shared/public/nsXULAtomList.h +++ b/mozilla/content/shared/public/nsXULAtomList.h @@ -117,12 +117,12 @@ XUL_ATOM(resizeafter, "resizeafter") XUL_ATOM(state, "state") // toolbar & toolbar d&d atoms -XUL_ATOM(tbDropLocation, "tb-droplocation") -XUL_ATOM(tbDropLocationCoord, "tb-droplocationcoord") -XUL_ATOM(tbDropOn, "tb-dropon") -XUL_ATOM(tbTriggerRepaint, "tb-triggerrepaint") +XUL_ATOM(ddDropLocation, "dd-droplocation") +XUL_ATOM(ddDropLocationCoord, "dd-droplocationcoord") +XUL_ATOM(ddDropOn, "dd-dropon") +XUL_ATOM(ddTriggerRepaint, "dd-triggerrepaint") XUL_ATOM(container, "container") -XUL_ATOM(tbDragDropArea, "dragdroparea") +XUL_ATOM(ddDragDropArea, "dragdroparea") XUL_ATOM(widget, "widget") XUL_ATOM(window, "window") diff --git a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp index 2907fe70cac..035343120e9 100644 --- a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp +++ b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp @@ -306,16 +306,6 @@ nsToolbarDragListener :: ItemMouseIsOver ( nsIDOMEvent* aDragEvent, nscoord* out nsresult nsToolbarDragListener::DragOver(nsIDOMEvent* aDragEvent) { - -#if 0 -nsCOMPtr c; -mToolbar->GetContent ( getter_AddRefs(c) ); -nsCOMPtr d ( do_QueryInterface(c) ); -nsCOMPtr t; -aDragEvent->GetTarget ( getter_AddRefs(t) ); -printf ( "DRAGOVER:: toolbar content is %ld, as DOMNode %ld, target is %ld\n", c, d, t ); -#endif - // Check to see if the mouse is over an item and which one it is. nscoord xLoc = 0; PRBool onChild; @@ -333,10 +323,10 @@ printf ( "DRAGOVER:: toolbar content is %ld, as DOMNode %ld, target is %ld\n", c // need the cast, because on some platforms, PR[U]int32 != long, but we're using "%ld" sprintf(buffer, "%ld", NS_STATIC_CAST(long, xLoc)); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::tbDropLocationCoord, buffer, PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); sprintf(buffer, "%ld", NS_STATIC_CAST(long, beforeIndex)); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::tbDropLocation, "1", PR_FALSE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::tbDropOn, onChild ? "true" : "false", PR_FALSE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, onChild ? "true" : "false", PR_FALSE ); } // cache the current drop location @@ -349,49 +339,85 @@ printf ( "DRAGOVER:: toolbar content is %ld, as DOMNode %ld, target is %ld\n", c } -//////////////////////////////////////////////////////////////////////// +// +// DragExit +// +// Handle when the mouse leaves the toolbar. We have to do some extra checking of both +// the target and the relatedNode to see if they are our children, but the gist is if +// the mouse leaves the toolbar for some other destination, reset the drop feedback +// attributes and trigger a repaint. +// nsresult nsToolbarDragListener::DragExit(nsIDOMEvent* aDragEvent) { -// there are some bugs that cause us to not be able to correctly track dragExit events -// so until then we just get on our knees and pray we don't get fooled again. -#if 0 -nsCOMPtr c; -mToolbar->GetContent ( getter_AddRefs(c) ); -nsCOMPtr d ( do_QueryInterface(c) ); -nsCOMPtr t; -aDragEvent->GetTarget ( getter_AddRefs(t) ); -printf ( "DRAGEXIT:: toolbar DOMNode %ld, target is %ld\n", d, t ); + nsCOMPtr mouseEvent ( do_QueryInterface(aDragEvent) ); + if ( !mouseEvent ) + return NS_OK; + + nsCOMPtr relatedNode; + mouseEvent->GetRelatedNode ( getter_AddRefs(relatedNode) ); + nsCOMPtr target; + aDragEvent->GetTarget ( getter_AddRefs(target) ); - nsCOMPtr content; - mToolbar->GetContent ( getter_AddRefs(content) ); - - // we will get a drag exit event on sub items because we catch the event on the way down. If - // the target is not our toolbar, then ignore it. - nsCOMPtr toolbarDOMNode ( do_QueryInterface(content) ); - nsCOMPtr eventTarget; - aDragEvent->GetTarget ( getter_AddRefs(eventTarget) ); - if ( eventTarget != toolbarDOMNode ) + // we only care about the case where the toolbar or one of its children + // is the target of this dragExit event. Recall we get all exit events because + // they will bubble up to us. + if ( !IsNodeAChild(target) ) return NS_OK; -printf("***REAL EXIT EVENT\n"); + if ( ! IsNodeAChild(relatedNode) ) { + nsCOMPtr myContent; + mToolbar->GetContent ( getter_AddRefs(myContent) ); - // tell the toolbar to not do any more drop feedback. Note that the toolbar code doesn't - // care at all about "tb-droplocation", only the coordinate so there is no need to send the - // AttributeChanged() about that attribute. - char buffer[10]; - sprintf(buffer, "%ld", -1); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::tbDropLocationCoord, buffer, PR_TRUE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::tbDropLocation, buffer, PR_FALSE ); + // tell the toolbar to not do any more drop feedback. Note that the toolbar code doesn't + // care at all about "tb-droplocation", only the coordinate so there is no need to send the + // AttributeChanged() about that attribute. + char buffer[10]; + sprintf(buffer, "%ld", -1); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE ); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaint, "1", PR_TRUE ); - // cache the current drop location - mCurrentDropLoc = -1; -#endif + // reset the current drop location + mCurrentDropLoc = -1; + } return NS_OK; // don't consume event } +// +// IsNodeAChild +// +// Returns TRUE if the given dom node is a child (or equals) this toolbar +// +PRBool +nsToolbarDragListener :: IsNodeAChild ( nsIDOMNode* inNode ) +{ + PRBool foundAsChild = PR_FALSE; + + nsCOMPtr myContent; + mToolbar->GetContent ( getter_AddRefs(myContent) ); + nsCOMPtr myContentAsNode ( do_QueryInterface(myContent) ); + + NS_ASSERTION ( myContent && myContentAsNode, "No content nodes" ); + + nsCOMPtr currNode ( inNode ); + while ( currNode ) { + // did we hit the toolbar? + if ( currNode == myContentAsNode ) { + foundAsChild = PR_TRUE; + break; + } + // if not, keep going + nsCOMPtr temp ( currNode ); + temp->GetParentNode(getter_AddRefs(currNode)); + } // while we're going up the parent chain + + return foundAsChild; + +} // IsNodeAChild + //////////////////////////////////////////////////////////////////////// nsresult @@ -420,7 +446,7 @@ nsToolbarDragListener :: LocateDropAreaFrame ( ) nsCOMPtr toolbarContent; mToolbar->GetContent ( getter_AddRefs(toolbarContent) ); if ( toolbarContent ) { - if ( toolbarContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::tbDragDropArea, dropAreaID) == NS_CONTENT_ATTR_HAS_VALUE ) + if ( toolbarContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::ddDragDropArea, dropAreaID) == NS_CONTENT_ATTR_HAS_VALUE ) dropAreaIsSubframe = PR_TRUE; } diff --git a/mozilla/layout/xul/base/src/nsToolbarDragListener.h b/mozilla/layout/xul/base/src/nsToolbarDragListener.h index 09eb2bcaf25..005ddec8fe3 100644 --- a/mozilla/layout/xul/base/src/nsToolbarDragListener.h +++ b/mozilla/layout/xul/base/src/nsToolbarDragListener.h @@ -60,6 +60,9 @@ protected: // is a container and the drop would be "on" that item. void ItemMouseIsOver(nsIDOMEvent* aDragEvent, nscoord* outXLoc, PRUint32* outIndex, PRBool* outOnChild); + // Utility to help determine if a node is a child of the toolbar + PRBool IsNodeAChild ( nsIDOMNode* inNode ) ; + // Find the frame (or subframe) that contains the buttons that can be dragged. nsIFrame* LocateDropAreaFrame ( ) ; diff --git a/mozilla/layout/xul/base/src/nsToolbarFrame.cpp b/mozilla/layout/xul/base/src/nsToolbarFrame.cpp index 7f22de7b3f2..547aab89624 100644 --- a/mozilla/layout/xul/base/src/nsToolbarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsToolbarFrame.cpp @@ -209,10 +209,10 @@ nsToolbarFrame :: ~nsToolbarFrame ( ) // // Init // -// Setup event listeners for drag and drop. Our frame's lifetime is bounded by the +// Setup event capturers for drag and drop. Our frame's lifetime is bounded by the // lifetime of the content model, so we're guaranteed that the content node won't go away on us. As -// a result, our drag listener can't go away before the frame is deleted. Since the content -// node holds owning references to our drag listener, which we tear down in the dtor, there is no +// a result, our drag capturer can't go away before the frame is deleted. Since the content +// node holds owning references to our drag capturer, which we tear down in the dtor, there is no // need to hold an owning ref to it ourselves. // NS_IMETHODIMP @@ -227,8 +227,8 @@ nsToolbarFrame::Init ( nsIPresContext& aPresContext, nsIContent* aContent, nsCOMPtr receiver(do_QueryInterface(content)); // register our drag over and exit capturers. These annotate the content object - // with enough info to determine where the drop would happen so that JS can - // do the right thing. + // with enough info to determine where the drop would happen so that JS down the + // line can do the right thing. mDragListener = new nsToolbarDragListener(this, &aPresContext); receiver->AddEventListener("dragover", mDragListener, PR_TRUE); receiver->AddEventListener("dragexit", mDragListener, PR_TRUE); @@ -264,8 +264,7 @@ nsToolbarFrame::Init ( nsIPresContext& aPresContext, nsIContent* aContent, // // Paint // -// Paint our background and border like normal frames, but before we draw the -// children, draw our grippies for each toolbar. +// Used to draw the drop feedback based on attributes set by the drag event capturer // NS_IMETHODIMP nsToolbarFrame :: Paint ( nsIPresContext& aPresContext, @@ -276,15 +275,18 @@ nsToolbarFrame :: Paint ( nsIPresContext& aPresContext, nsresult res = nsBoxFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer ); if (mXDropLoc != -1) { - // XXX this is temporary + // go looking for the psuedo-style that describes the drop feedback marker. If we don't + // have it yet, go looking for it. if (!mMarkerStyle) { nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-drop-marker")) ); aPresContext.ProbePseudoStyleContextFor(mContent, atom, mStyleContext, PR_FALSE, getter_AddRefs(mMarkerStyle)); } + nscolor color; if (mMarkerStyle) { - const nsStyleColor* styleColor = (const nsStyleColor*)mMarkerStyle->GetStyleData(eStyleStruct_Color); + const nsStyleColor* styleColor = + NS_STATIC_CAST(const nsStyleColor*, mMarkerStyle->GetStyleData(eStyleStruct_Color)); color = styleColor->mColor; } else { color = NS_RGB(0,0,0); @@ -333,38 +335,6 @@ nsToolbarFrame :: GetFrameForPoint ( nsIPresContext* aPresContext, } // GetFrameForPoint -// -// HandleEvent -// -// Process events that come to this frame. If they end up here, they are -// almost certainly drag and drop events. -// -NS_IMETHODIMP -nsToolbarFrame :: HandleEvent ( nsIPresContext& aPresContext, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus) -{ - if ( !aEvent ) - return nsEventStatus_eIgnore; - - switch (aEvent->message) { - case NS_DRAGDROP_ENTER: - - if (!mMarkerStyle) { - nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-drop-marker")) ); - aPresContext.ProbePseudoStyleContextFor(mContent, atom, mStyleContext, - PR_FALSE, - getter_AddRefs(mMarkerStyle)); - } - break; - - } - - //XXX this needs to change when I am really handling the D&D events - return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus); - -} // HandleEvent - #if NOT_YET_NEEDED /** @@ -435,9 +405,9 @@ nsToolbarFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIContent* a { nsresult rv = NS_OK; - if ( aAttribute == nsXULAtoms::tbTriggerRepaint ) + if ( aAttribute == nsXULAtoms::ddTriggerRepaint ) ForceDrawFrame ( aPresContext, this ); - else if ( aAttribute == nsXULAtoms::tbDropLocationCoord ) { + else if ( aAttribute == nsXULAtoms::ddDropLocationCoord ) { nsAutoString attribute; aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute ); char* iHateNSString = attribute.ToNewCString(); diff --git a/mozilla/layout/xul/base/src/nsToolbarFrame.h b/mozilla/layout/xul/base/src/nsToolbarFrame.h index b5b554609c2..0e6d7d9e1be 100644 --- a/mozilla/layout/xul/base/src/nsToolbarFrame.h +++ b/mozilla/layout/xul/base/src/nsToolbarFrame.h @@ -77,9 +77,6 @@ public: NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext, const nsPoint& aPoint, // Overridden to capture events nsIFrame** aFrame); - NS_IMETHOD HandleEvent(nsIPresContext& aPresContext, - nsGUIEvent* aEvent, - nsEventStatus& aEventStatus); NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, PRInt32 aNameSpaceID, diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp index 548b35073b4..e39a04a95c9 100644 --- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -42,6 +42,10 @@ #include "nsISupportsArray.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" +#include "nsIDOMEventReceiver.h" +#include "nsIDOMDragListener.h" +#include "nsTreeItemDragCapturer.h" + // // NS_NewTreeFrame @@ -71,12 +75,20 @@ nsTreeRowGroupFrame::nsTreeRowGroupFrame() mLinkupFrame(nsnull), mIsLazy(PR_FALSE), mIsFull(PR_FALSE), mScrollbar(nsnull), mShouldHaveScrollbar(PR_FALSE), mContentChain(nsnull), mFrameConstructor(nsnull), - mRowGroupHeight(0), mCurrentIndex(0), mRowCount(0) + mRowGroupHeight(0), mCurrentIndex(0), mRowCount(0), + mYDropLoc(-1), mDropOnContainer(PR_FALSE) { } // Destructor nsTreeRowGroupFrame::~nsTreeRowGroupFrame() { + nsCOMPtr content; + GetContent(getter_AddRefs(content)); + nsCOMPtr reciever(do_QueryInterface(content)); + + // NOTE: the Remove will delete the drag capturer + reciever->RemoveEventListenerByIID((nsIDOMDragListener *)mDragCapturer, nsIDOMDragListener::GetIID()); + NS_IF_RELEASE(mContentChain); } @@ -111,6 +123,38 @@ nsTreeRowGroupFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr) return nsTableRowGroupFrame::QueryInterface(aIID, aInstancePtr); } + +// +// Init +// +// Setup event capturers for drag and drop. Our frame's lifetime is bounded by the +// lifetime of the content model, so we're guaranteed that the content node won't go away on us. As +// a result, our drag capturer can't go away before the frame is deleted. Since the content +// node holds owning references to our drag capturer, which we tear down in the dtor, there is no +// need to hold an owning ref to it ourselves. +// +NS_IMETHODIMP +nsTreeRowGroupFrame::Init ( nsIPresContext& aPresContext, nsIContent* aContent, + nsIFrame* aParent, nsIStyleContext* aContext, nsIFrame* aPrevInFlow) +{ + nsresult rv = nsTableRowGroupFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); + + nsCOMPtr content; + GetContent(getter_AddRefs(content)); + nsCOMPtr receiver(do_QueryInterface(content)); + + // register our drag over and exit capturers. These annotate the content object + // with enough info to determine where the drop would happen so that JS down the + // line can do the right thing. + mDragCapturer = new nsTreeItemDragCapturer(this, &aPresContext); + receiver->AddEventListener("dragover", mDragCapturer, PR_TRUE); + receiver->AddEventListener("dragexit", mDragCapturer, PR_TRUE); + + return NS_OK; + +} // Init + + void nsTreeRowGroupFrame::DestroyRows(nsTableFrame* aTableFrame, nsIPresContext& aPresContext, PRInt32& rowsToLose) { // We need to destroy frames until our row count has been properly @@ -780,7 +824,7 @@ void nsTreeRowGroupFrame::PaintChildren(nsIPresContext& aPresContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) { - nsTableRowGroupFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); + nsHTMLContainerFrame::PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); if (mScrollbar) { nsIView *pView; @@ -1591,3 +1635,130 @@ nsTreeRowGroupFrame::MarkTreeAsDirty(nsIPresContext& aPresContext, nsTreeFrame* } } } + +// +// pinkerton +// code copied from the toolbar to bootstrap tree d&d. I hope to god +// it goes away and i don't forget about it. +// +// We really _want_ to use CSS to do the drawing/etc, but changing the +// borders of the cells would cause reflows and that could really suck. +// As a first stab, let's try just to paint ourselves. +// + +#include "nsIView.h" +#include "nsIViewManager.h" + + +//XXX NOTE: try to consolodate with the version in the toolbar code. +static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame); +static void ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame * aFrame) +{ + if (aFrame == nsnull) { + return; + } + nsRect rect; + nsIView * view; + nsPoint pnt; + aFrame->GetOffsetFromView(aPresContext, pnt, &view); + aFrame->GetRect(rect); + rect.x = pnt.x; + rect.y = pnt.y; + if (view) { + nsCOMPtr viewMgr; + view->GetViewManager(*getter_AddRefs(viewMgr)); + if (viewMgr) + viewMgr->UpdateView(view, rect, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_IMMEDIATE); + } + +} + + +// +// AttributeChanged +// +// Track several attributes set by the d&d drop feedback tracking mechanism. The first +// is the "dd-triggerrepaint" attribute so JS can trigger a repaint when it +// needs up update the drop feedback. The second is the x (or y, if bar is vertical) +// coordinate of where the drop feedback bar should be drawn. +// +NS_IMETHODIMP +nsTreeRowGroupFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIContent* aChild, + PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aHint) +{ + nsresult rv = NS_OK; + + if ( aAttribute == nsXULAtoms::ddTriggerRepaint ) + ForceDrawFrame ( aPresContext, this ); + else if ( aAttribute == nsXULAtoms::ddDropLocationCoord ) { + nsAutoString attribute; + aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute ); + char* iHateNSString = attribute.ToNewCString(); + mYDropLoc = atoi( iHateNSString ); + nsAllocator::Free ( iHateNSString ); + } + else if ( aAttribute == nsXULAtoms::ddDropOn ) { + nsAutoString attribute; + aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute ); + attribute.ToLowerCase(); + mDropOnContainer = attribute.Equals("true"); + } + else + rv = nsTableRowGroupFrame::AttributeChanged ( aPresContext, aChild, aNameSpaceID, aAttribute, aHint ); + + return rv; + +} // AttributeChanged + + + +// +// Paint +// +// Used to draw the drop feedback based on attributes set by the drag event capturer +// +NS_IMETHODIMP +nsTreeRowGroupFrame :: Paint ( nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer) +{ + nsresult res = nsTableRowGroupFrame::Paint ( aPresContext, aRenderingContext, aDirtyRect, aWhichLayer ); + + if ( mYDropLoc != -1 || mDropOnContainer ) { + // go looking for the psuedo-style that describes the drop feedback marker. If we don't + // have it yet, go looking for it. + if (!mMarkerStyle) { + nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-drop-marker")) ); + aPresContext.ProbePseudoStyleContextFor(mContent, atom, mStyleContext, + PR_FALSE, getter_AddRefs(mMarkerStyle)); + } + + nscolor color; + if ( mMarkerStyle ) { + const nsStyleColor* styleColor = + NS_STATIC_CAST(const nsStyleColor*, mMarkerStyle->GetStyleData(eStyleStruct_Color)); + color = styleColor->mColor; + } + else + color = NS_RGB(0,0,0); + + // draw different drop feedback depending on if we are dropping on the + // container or above/below it + if ( !mDropOnContainer ) { + + //XXX compute horiz indentation, fix up constants. + + aRenderingContext.SetColor(color); + nsRect dividingLine ( 0, mYDropLoc, 20*50, 30 ); + aRenderingContext.FillRect(dividingLine); + } + else { + aRenderingContext.SetColor(NS_RGB(0x7F,0x7F,0x7F)); + nsRect treeItemBounds ( 0, 0, mRect.width, mRect.height ); + aRenderingContext.DrawRect ( treeItemBounds ); + } + } + + return res; + +} // Paint + diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h index a1342051b02..828e928503b 100644 --- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.h @@ -23,16 +23,25 @@ #include "nsTableRowGroupFrame.h" #include "nsVoidArray.h" #include "nsIScrollbarListener.h" +#include "nsIStyleContext.h" +#include "nsCOMPtr.h" class nsTreeFrame; +class nsTreeCellFrame; class nsCSSFrameConstructor; class nsISupportsArray; +class nsTreeItemDragCapturer; + class nsTreeRowGroupFrame : public nsTableRowGroupFrame, public nsIScrollbarListener { public: friend nsresult NS_NewTreeRowGroupFrame(nsIFrame** aNewFrame); + // hook in to setup d&d capturers + NS_IMETHOD Init ( nsIPresContext& aPresContext, nsIContent* aContent, + nsIFrame* aParent, nsIStyleContext* aContext, nsIFrame* aPrevInFlow) ; + NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, nsIAtom** aListName) const; NS_IMETHOD FirstChild(nsIAtom* aListName, nsIFrame** aFirstChild) const; @@ -68,6 +77,13 @@ public: void OnContentInserted(nsIPresContext& aPresContext, nsIFrame* aNextSibling); void OnContentRemoved(nsIPresContext& aPresContext, nsIFrame* aChildFrame); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, + PRInt32 aNameSpaceID, nsIAtom* aAttribute, PRInt32 aHint) ; + + // nsIHTMLReflow overrides + NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer); + virtual nsIFrame* GetFirstFrame(); virtual nsIFrame* GetLastFrame(); virtual void GetNextFrame(nsIFrame* aFrame, nsIFrame** aResult); @@ -187,4 +203,14 @@ protected: // Data Members PRInt32 mCurrentIndex; // Our current scrolled index. PRInt32 mRowCount; // The current number of visible rows. + // our event capturer registered with the content model. See the discussion + // in Init() for why this is a weak ref. + nsTreeItemDragCapturer* mDragCapturer; + + // only used during drag and drop for drop feedback. These are not + // guaranteed to be meaningful when no drop is underway. + PRInt32 mYDropLoc; + PRBool mDropOnContainer; + nsCOMPtr mMarkerStyle; + }; // class nsTreeRowGroupFrame diff --git a/mozilla/layout/xul/content/src/nsXULAtomList.h b/mozilla/layout/xul/content/src/nsXULAtomList.h index ffc416e7ebd..db81bb1829c 100644 --- a/mozilla/layout/xul/content/src/nsXULAtomList.h +++ b/mozilla/layout/xul/content/src/nsXULAtomList.h @@ -117,12 +117,12 @@ XUL_ATOM(resizeafter, "resizeafter") XUL_ATOM(state, "state") // toolbar & toolbar d&d atoms -XUL_ATOM(tbDropLocation, "tb-droplocation") -XUL_ATOM(tbDropLocationCoord, "tb-droplocationcoord") -XUL_ATOM(tbDropOn, "tb-dropon") -XUL_ATOM(tbTriggerRepaint, "tb-triggerrepaint") +XUL_ATOM(ddDropLocation, "dd-droplocation") +XUL_ATOM(ddDropLocationCoord, "dd-droplocationcoord") +XUL_ATOM(ddDropOn, "dd-dropon") +XUL_ATOM(ddTriggerRepaint, "dd-triggerrepaint") XUL_ATOM(container, "container") -XUL_ATOM(tbDragDropArea, "dragdroparea") +XUL_ATOM(ddDragDropArea, "dragdroparea") XUL_ATOM(widget, "widget") XUL_ATOM(window, "window")