mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Part2 of fix for bug #39821: Drag and Drop interferes with selection
Made GetSelectionController() a public method on the nsIFrame interface, so that nsEventStateManager::GenerateDragGesture() has access to it. This prevents D&D from interfering with selection in Ender-Lite. layout/base/public/nsIFrame.h layout/events/src/nsEventStateManager.cpp layout/html/base/src/nsFrame.h layout/html/base/src/nsFrame.cpp r=buster@netscape.com,brade@netscape.com,cmanske@netscape.com a=beppe@netscape.com
This commit is contained in:
parent
2e76a9364c
commit
1739a10bbd
@ -690,17 +690,30 @@ nsEventStateManager :: GenerateDragGesture ( nsIPresContext* aPresContext, nsGUI
|
||||
// Check if selection is tracking drag gestures, if so
|
||||
// don't interfere!
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_SUCCEEDED(rv) && shell){
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
if (NS_SUCCEEDED(rv) && frameSel){
|
||||
PRBool mouseDownState = PR_TRUE;
|
||||
frameSel->GetMouseDownState(&mouseDownState);
|
||||
if (mouseDownState) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
if (mGestureDownFrame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsresult rv = mGestureDownFrame->GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && selCon) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
|
||||
frameSel = do_QueryInterface(selCon);
|
||||
|
||||
if (! frameSel) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && shell)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && frameSel) {
|
||||
PRBool mouseDownState = PR_TRUE;
|
||||
frameSel->GetMouseDownState(&mouseDownState);
|
||||
if (mouseDownState) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ struct nsRect;
|
||||
struct nsStyleStruct;
|
||||
class nsIDOMRange;
|
||||
class nsICaret;
|
||||
class nsISelectionController;
|
||||
struct PRLogModuleInfo;
|
||||
|
||||
// IID for the nsIFrame interface
|
||||
@ -971,6 +972,13 @@ public:
|
||||
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected) const = 0;
|
||||
|
||||
/**
|
||||
* Called to retrieve the SelectionController associated with the frame.
|
||||
* @param aSelCon will contain the selection controller associated with
|
||||
* the frame.
|
||||
*/
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon) = 0;
|
||||
|
||||
/** EndSelection related calls
|
||||
*/
|
||||
|
||||
|
@ -690,17 +690,30 @@ nsEventStateManager :: GenerateDragGesture ( nsIPresContext* aPresContext, nsGUI
|
||||
// Check if selection is tracking drag gestures, if so
|
||||
// don't interfere!
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_SUCCEEDED(rv) && shell){
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
if (NS_SUCCEEDED(rv) && frameSel){
|
||||
PRBool mouseDownState = PR_TRUE;
|
||||
frameSel->GetMouseDownState(&mouseDownState);
|
||||
if (mouseDownState) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
if (mGestureDownFrame) {
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
nsresult rv = mGestureDownFrame->GetSelectionController(aPresContext, getter_AddRefs(selCon));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && selCon) {
|
||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||
|
||||
frameSel = do_QueryInterface(selCon);
|
||||
|
||||
if (! frameSel) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && shell)
|
||||
rv = shell->GetFrameSelection(getter_AddRefs(frameSel));
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && frameSel) {
|
||||
PRBool mouseDownState = PR_TRUE;
|
||||
frameSel->GetMouseDownState(&mouseDownState);
|
||||
if (mouseDownState) {
|
||||
StopTrackingDragGesture();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2166,7 +2166,7 @@ nsFrame::ParentDisablesSelection() const
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon)
|
||||
{
|
||||
if (!aPresContext || !aSelCon)
|
||||
|
@ -262,6 +262,7 @@ public:
|
||||
#endif
|
||||
NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected) const;
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon);
|
||||
NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ;
|
||||
NS_IMETHOD PeekOffsetParagraph(nsIPresContext* aPresContext,
|
||||
nsPeekOffsetStruct *aPos);
|
||||
@ -439,8 +440,6 @@ protected:
|
||||
// applies to its situation.
|
||||
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
|
||||
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon);
|
||||
|
||||
nsRect mRect;
|
||||
nsIContent* mContent;
|
||||
nsIStyleContext* mStyleContext;
|
||||
|
@ -74,6 +74,7 @@ struct nsRect;
|
||||
struct nsStyleStruct;
|
||||
class nsIDOMRange;
|
||||
class nsICaret;
|
||||
class nsISelectionController;
|
||||
struct PRLogModuleInfo;
|
||||
|
||||
// IID for the nsIFrame interface
|
||||
@ -971,6 +972,13 @@ public:
|
||||
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected) const = 0;
|
||||
|
||||
/**
|
||||
* Called to retrieve the SelectionController associated with the frame.
|
||||
* @param aSelCon will contain the selection controller associated with
|
||||
* the frame.
|
||||
*/
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon) = 0;
|
||||
|
||||
/** EndSelection related calls
|
||||
*/
|
||||
|
||||
|
@ -2166,7 +2166,7 @@ nsFrame::ParentDisablesSelection() const
|
||||
|
||||
|
||||
|
||||
nsresult
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon)
|
||||
{
|
||||
if (!aPresContext || !aSelCon)
|
||||
|
@ -262,6 +262,7 @@ public:
|
||||
#endif
|
||||
NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
||||
NS_IMETHOD GetSelected(PRBool *aSelected) const;
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon);
|
||||
NS_IMETHOD PeekOffset(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos) ;
|
||||
NS_IMETHOD PeekOffsetParagraph(nsIPresContext* aPresContext,
|
||||
nsPeekOffsetStruct *aPos);
|
||||
@ -439,8 +440,6 @@ protected:
|
||||
// applies to its situation.
|
||||
void SetOverflowClipRect(nsIRenderingContext& aRenderingContext);
|
||||
|
||||
NS_IMETHOD GetSelectionController(nsIPresContext *aPresContext, nsISelectionController **aSelCon);
|
||||
|
||||
nsRect mRect;
|
||||
nsIContent* mContent;
|
||||
nsIStyleContext* mStyleContext;
|
||||
|
Loading…
Reference in New Issue
Block a user