зеркало из https://github.com/mozilla/gecko-dev.git
table cell selection now shows up background. also small fix for nsBlockFrame to do the right thing for mouse capture.
This commit is contained in:
Родитель
230f38f70e
Коммит
5c4c46cd0d
|
@ -254,6 +254,10 @@ public:
|
|||
SelectionDetails **aReturnDetails, PRBool aSlowCheck);
|
||||
NS_IMETHOD SetMouseDownState(PRBool aState);
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState);
|
||||
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState){if (aState){*aState = mSelectingTableCellMode; return NS_OK;}return NS_ERROR_NULL_POINTER;}
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor);
|
||||
|
||||
NS_IMETHOD GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection);
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
|
||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
|
||||
|
@ -261,7 +265,7 @@ public:
|
|||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD SelectAll();
|
||||
/*END nsIFrameSelection interfacse*/
|
||||
|
||||
|
@ -324,6 +328,7 @@ private:
|
|||
nsCOMPtr<nsIContent> mStartSelectedCell;
|
||||
nsCOMPtr<nsIContent> mEndSelectedCell;
|
||||
PRBool mSelectingTableCells;
|
||||
PRBool mSelectingTableCellMode;
|
||||
PRInt32 mSelectedCellIndex;
|
||||
|
||||
//batching
|
||||
|
@ -344,6 +349,7 @@ public:
|
|||
static nsIAtom *sCellAtom;
|
||||
static nsIAtom *sTbodyAtom;
|
||||
static PRInt32 sInstanceCount;
|
||||
static nsStyleColor sTableStyleColor;
|
||||
};
|
||||
|
||||
class nsSelectionIterator : public nsIBidirectionalEnumerator
|
||||
|
@ -515,7 +521,7 @@ nsIAtom *nsSelection::sTableAtom = 0;
|
|||
nsIAtom *nsSelection::sCellAtom = 0;
|
||||
nsIAtom *nsSelection::sTbodyAtom = 0;
|
||||
PRInt32 nsSelection::sInstanceCount = 0;
|
||||
|
||||
nsStyleColor nsSelection::sTableStyleColor;
|
||||
|
||||
PRInt8
|
||||
GetIndexFromSelectionType(SelectionType aType)
|
||||
|
@ -716,10 +722,21 @@ nsSelection::nsSelection()
|
|||
sTableAtom = NS_NewAtom("table");
|
||||
sCellAtom = NS_NewAtom("td");
|
||||
sTbodyAtom = NS_NewAtom("tbody");
|
||||
sTableStyleColor.mColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mBackgroundColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mOpacity= (float)1;
|
||||
sTableStyleColor.mBackgroundAttachment=0;
|
||||
sTableStyleColor.mBackgroundFlags=NS_STYLE_BG_IMAGE_NONE;
|
||||
sTableStyleColor.mBackgroundRepeat=1;
|
||||
sTableStyleColor.mBackgroundXPosition=0;
|
||||
sTableStyleColor.mBackgroundYPosition=0;
|
||||
sTableStyleColor.mCursor=1;
|
||||
}
|
||||
mHint = HINTLEFT;
|
||||
sInstanceCount ++;
|
||||
mSelectingTableCells = PR_FALSE;
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
|
||||
mSelectedCellIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1483,10 @@ nsSelection::HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset,
|
|||
mHint = HINT(aHint);
|
||||
// Don't take focus when dragging off of a table
|
||||
if (!mSelectingTableCells)
|
||||
{
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
return TakeFocus(aNewFocus, aContentOffset, aContentEndOffset, aContinueSelection, aMultipleSelection);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1643,6 +1663,17 @@ nsSelection::GetMouseDownState(PRBool *aState)
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)
|
||||
{
|
||||
if (!aStyleColor)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aStyleColor = &sTableStyleColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection)
|
||||
{
|
||||
|
@ -2114,6 +2145,8 @@ printf("Mouse was clicked at: x=%d, y=%d\n", aMouseEvent->point.x, aMouseEvent->
|
|||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
mSelectingTableCells = PR_TRUE;
|
||||
mSelectingTableCellMode = PR_TRUE;//only shut off on normal mouse click.
|
||||
|
||||
mStartSelectedCell = selectedContent;
|
||||
mEndSelectedCell = selectedContent;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
|
||||
// IID for the nsIFrameSelection interface
|
||||
#define NS_IFRAMESELECTION_IID \
|
||||
{ 0xf46e4171, 0xdeaa, 0x11d1, \
|
||||
|
@ -218,6 +221,16 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
|
||||
|
||||
/**
|
||||
if we are in table cell selection mode. aka ctrl click in table cell
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState)=0;
|
||||
|
||||
/** GetTableCellSelectionStyleColor
|
||||
* this holds the color of the selection for table cells when they are selected.
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)=0;
|
||||
|
||||
/** GetSelection
|
||||
* no query interface for selection. must use this method now.
|
||||
* @param aSelectionType enum value defined in nsIDOMSelection for the domseleciton you want.
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStyleContext.h"
|
||||
|
||||
|
||||
// IID for the nsIFrameSelection interface
|
||||
#define NS_IFRAMESELECTION_IID \
|
||||
{ 0xf46e4171, 0xdeaa, 0x11d1, \
|
||||
|
@ -218,6 +221,16 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState)=0;
|
||||
|
||||
/**
|
||||
if we are in table cell selection mode. aka ctrl click in table cell
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState)=0;
|
||||
|
||||
/** GetTableCellSelectionStyleColor
|
||||
* this holds the color of the selection for table cells when they are selected.
|
||||
*/
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)=0;
|
||||
|
||||
/** GetSelection
|
||||
* no query interface for selection. must use this method now.
|
||||
* @param aSelectionType enum value defined in nsIDOMSelection for the domseleciton you want.
|
||||
|
|
|
@ -254,6 +254,10 @@ public:
|
|||
SelectionDetails **aReturnDetails, PRBool aSlowCheck);
|
||||
NS_IMETHOD SetMouseDownState(PRBool aState);
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState);
|
||||
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState){if (aState){*aState = mSelectingTableCellMode; return NS_OK;}return NS_ERROR_NULL_POINTER;}
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor);
|
||||
|
||||
NS_IMETHOD GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection);
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
|
||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
|
||||
|
@ -261,7 +265,7 @@ public:
|
|||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD SelectAll();
|
||||
/*END nsIFrameSelection interfacse*/
|
||||
|
||||
|
@ -324,6 +328,7 @@ private:
|
|||
nsCOMPtr<nsIContent> mStartSelectedCell;
|
||||
nsCOMPtr<nsIContent> mEndSelectedCell;
|
||||
PRBool mSelectingTableCells;
|
||||
PRBool mSelectingTableCellMode;
|
||||
PRInt32 mSelectedCellIndex;
|
||||
|
||||
//batching
|
||||
|
@ -344,6 +349,7 @@ public:
|
|||
static nsIAtom *sCellAtom;
|
||||
static nsIAtom *sTbodyAtom;
|
||||
static PRInt32 sInstanceCount;
|
||||
static nsStyleColor sTableStyleColor;
|
||||
};
|
||||
|
||||
class nsSelectionIterator : public nsIBidirectionalEnumerator
|
||||
|
@ -515,7 +521,7 @@ nsIAtom *nsSelection::sTableAtom = 0;
|
|||
nsIAtom *nsSelection::sCellAtom = 0;
|
||||
nsIAtom *nsSelection::sTbodyAtom = 0;
|
||||
PRInt32 nsSelection::sInstanceCount = 0;
|
||||
|
||||
nsStyleColor nsSelection::sTableStyleColor;
|
||||
|
||||
PRInt8
|
||||
GetIndexFromSelectionType(SelectionType aType)
|
||||
|
@ -716,10 +722,21 @@ nsSelection::nsSelection()
|
|||
sTableAtom = NS_NewAtom("table");
|
||||
sCellAtom = NS_NewAtom("td");
|
||||
sTbodyAtom = NS_NewAtom("tbody");
|
||||
sTableStyleColor.mColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mBackgroundColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mOpacity= (float)1;
|
||||
sTableStyleColor.mBackgroundAttachment=0;
|
||||
sTableStyleColor.mBackgroundFlags=NS_STYLE_BG_IMAGE_NONE;
|
||||
sTableStyleColor.mBackgroundRepeat=1;
|
||||
sTableStyleColor.mBackgroundXPosition=0;
|
||||
sTableStyleColor.mBackgroundYPosition=0;
|
||||
sTableStyleColor.mCursor=1;
|
||||
}
|
||||
mHint = HINTLEFT;
|
||||
sInstanceCount ++;
|
||||
mSelectingTableCells = PR_FALSE;
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
|
||||
mSelectedCellIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1483,10 @@ nsSelection::HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset,
|
|||
mHint = HINT(aHint);
|
||||
// Don't take focus when dragging off of a table
|
||||
if (!mSelectingTableCells)
|
||||
{
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
return TakeFocus(aNewFocus, aContentOffset, aContentEndOffset, aContinueSelection, aMultipleSelection);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1643,6 +1663,17 @@ nsSelection::GetMouseDownState(PRBool *aState)
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)
|
||||
{
|
||||
if (!aStyleColor)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aStyleColor = &sTableStyleColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection)
|
||||
{
|
||||
|
@ -2114,6 +2145,8 @@ printf("Mouse was clicked at: x=%d, y=%d\n", aMouseEvent->point.x, aMouseEvent->
|
|||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
mSelectingTableCells = PR_TRUE;
|
||||
mSelectingTableCellMode = PR_TRUE;//only shut off on normal mouse click.
|
||||
|
||||
mStartSelectedCell = selectedContent;
|
||||
mEndSelectedCell = selectedContent;
|
||||
}
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -254,6 +254,10 @@ public:
|
|||
SelectionDetails **aReturnDetails, PRBool aSlowCheck);
|
||||
NS_IMETHOD SetMouseDownState(PRBool aState);
|
||||
NS_IMETHOD GetMouseDownState(PRBool *aState);
|
||||
|
||||
NS_IMETHOD GetTableCellSelection(PRBool *aState){if (aState){*aState = mSelectingTableCellMode; return NS_OK;}return NS_ERROR_NULL_POINTER;}
|
||||
NS_IMETHOD GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor);
|
||||
|
||||
NS_IMETHOD GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection);
|
||||
NS_IMETHOD ScrollSelectionIntoView(SelectionType aType, SelectionRegion aRegion);
|
||||
NS_IMETHOD RepaintSelection(nsIPresContext* aPresContext, SelectionType aType);
|
||||
|
@ -261,7 +265,7 @@ public:
|
|||
NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend);
|
||||
NS_IMETHOD SelectAll();
|
||||
/*END nsIFrameSelection interfacse*/
|
||||
|
||||
|
@ -324,6 +328,7 @@ private:
|
|||
nsCOMPtr<nsIContent> mStartSelectedCell;
|
||||
nsCOMPtr<nsIContent> mEndSelectedCell;
|
||||
PRBool mSelectingTableCells;
|
||||
PRBool mSelectingTableCellMode;
|
||||
PRInt32 mSelectedCellIndex;
|
||||
|
||||
//batching
|
||||
|
@ -344,6 +349,7 @@ public:
|
|||
static nsIAtom *sCellAtom;
|
||||
static nsIAtom *sTbodyAtom;
|
||||
static PRInt32 sInstanceCount;
|
||||
static nsStyleColor sTableStyleColor;
|
||||
};
|
||||
|
||||
class nsSelectionIterator : public nsIBidirectionalEnumerator
|
||||
|
@ -515,7 +521,7 @@ nsIAtom *nsSelection::sTableAtom = 0;
|
|||
nsIAtom *nsSelection::sCellAtom = 0;
|
||||
nsIAtom *nsSelection::sTbodyAtom = 0;
|
||||
PRInt32 nsSelection::sInstanceCount = 0;
|
||||
|
||||
nsStyleColor nsSelection::sTableStyleColor;
|
||||
|
||||
PRInt8
|
||||
GetIndexFromSelectionType(SelectionType aType)
|
||||
|
@ -716,10 +722,21 @@ nsSelection::nsSelection()
|
|||
sTableAtom = NS_NewAtom("table");
|
||||
sCellAtom = NS_NewAtom("td");
|
||||
sTbodyAtom = NS_NewAtom("tbody");
|
||||
sTableStyleColor.mColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mBackgroundColor = NS_RGB(128,0,0);
|
||||
sTableStyleColor.mOpacity= (float)1;
|
||||
sTableStyleColor.mBackgroundAttachment=0;
|
||||
sTableStyleColor.mBackgroundFlags=NS_STYLE_BG_IMAGE_NONE;
|
||||
sTableStyleColor.mBackgroundRepeat=1;
|
||||
sTableStyleColor.mBackgroundXPosition=0;
|
||||
sTableStyleColor.mBackgroundYPosition=0;
|
||||
sTableStyleColor.mCursor=1;
|
||||
}
|
||||
mHint = HINTLEFT;
|
||||
sInstanceCount ++;
|
||||
mSelectingTableCells = PR_FALSE;
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
|
||||
mSelectedCellIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -1466,7 +1483,10 @@ nsSelection::HandleClick(nsIContent *aNewFocus, PRUint32 aContentOffset,
|
|||
mHint = HINT(aHint);
|
||||
// Don't take focus when dragging off of a table
|
||||
if (!mSelectingTableCells)
|
||||
{
|
||||
mSelectingTableCellMode = PR_FALSE;
|
||||
return TakeFocus(aNewFocus, aContentOffset, aContentEndOffset, aContinueSelection, aMultipleSelection);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1643,6 +1663,17 @@ nsSelection::GetMouseDownState(PRBool *aState)
|
|||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetTableCellSelectionStyleColor(const nsStyleColor **aStyleColor)
|
||||
{
|
||||
if (!aStyleColor)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
*aStyleColor = &sTableStyleColor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSelection::GetSelection(SelectionType aType, nsIDOMSelection **aDomSelection)
|
||||
{
|
||||
|
@ -2114,6 +2145,8 @@ printf("Mouse was clicked at: x=%d, y=%d\n", aMouseEvent->point.x, aMouseEvent->
|
|||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
mSelectingTableCells = PR_TRUE;
|
||||
mSelectingTableCellMode = PR_TRUE;//only shut off on normal mouse click.
|
||||
|
||||
mStartSelectedCell = selectedContent;
|
||||
mEndSelectedCell = selectedContent;
|
||||
}
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -6081,6 +6081,14 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN || aEvent->message == NS_MOUSE_MOVE ||
|
||||
aEvent->message == NS_MOUSE_LEFT_DOUBLECLICK ) {
|
||||
|
||||
//we have to add this because any frame that overrides nsFrame::HandleEvent for mouse down MUST capture the mouse events!!
|
||||
if (aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN)
|
||||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
}
|
||||
|
||||
nsresult result;
|
||||
nsIFrame *resultFrame = nsnull;//this will be passed the handle event when we
|
||||
//can tell who to pass it to
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
#include "nsIHTMLTableCellElement.h"
|
||||
#include "nsIDOMHTMLTableCellElement.h"
|
||||
|
||||
//TABLECELL SELECTION
|
||||
#include "nsIFrameSelection.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
|
||||
|
||||
|
@ -248,6 +251,38 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (disp->IsVisibleOrCollapsed()) {
|
||||
const nsStyleColor* myColor =
|
||||
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
|
||||
//TABLECELL SELECTION
|
||||
PRBool displaySelection;
|
||||
displaySelection = DisplaySelection(aPresContext);
|
||||
if (displaySelection)
|
||||
{
|
||||
nsFrameState frameState;
|
||||
PRBool isSelected;
|
||||
GetFrameState(&frameState);
|
||||
isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
||||
if (isSelected)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
frameSelection->GetTableCellSelectionStyleColor(&myColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//END SELECTION
|
||||
|
||||
const nsStyleSpacing* mySpacing =
|
||||
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
NS_ASSERTION(nsnull!=myColor, "bad style color");
|
||||
|
|
|
@ -47,6 +47,9 @@
|
|||
#include "nsIHTMLTableCellElement.h"
|
||||
#include "nsIDOMHTMLTableCellElement.h"
|
||||
|
||||
//TABLECELL SELECTION
|
||||
#include "nsIFrameSelection.h"
|
||||
|
||||
static NS_DEFINE_IID(kIHTMLTableCellElementIID, NS_IHTMLTABLECELLELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIDOMHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
|
||||
|
||||
|
@ -248,6 +251,38 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (disp->IsVisibleOrCollapsed()) {
|
||||
const nsStyleColor* myColor =
|
||||
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
|
||||
|
||||
//TABLECELL SELECTION
|
||||
PRBool displaySelection;
|
||||
displaySelection = DisplaySelection(aPresContext);
|
||||
if (displaySelection)
|
||||
{
|
||||
nsFrameState frameState;
|
||||
PRBool isSelected;
|
||||
GetFrameState(&frameState);
|
||||
isSelected = (frameState & NS_FRAME_SELECTED_CONTENT) == NS_FRAME_SELECTED_CONTENT;
|
||||
if (isSelected)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult result = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||
result = shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
frameSelection->GetTableCellSelectionStyleColor(&myColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//END SELECTION
|
||||
|
||||
const nsStyleSpacing* mySpacing =
|
||||
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
||||
NS_ASSERTION(nsnull!=myColor, "bad style color");
|
||||
|
|
Загрузка…
Ссылка в новой задаче