зеркало из https://github.com/mozilla/pjs.git
r: mjudge
table bacgrounds now sleected properly with disabled selection (grey selection)
This commit is contained in:
Родитель
cd9615f2fb
Коммит
9ef9e4b400
|
@ -576,10 +576,10 @@ NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext,
|
|||
return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRBool
|
||||
PRInt16
|
||||
nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
||||
{
|
||||
PRInt16 result = PR_FALSE;
|
||||
PRInt16 result = nsISelectionController::SELECTION_OFF;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
@ -600,14 +600,14 @@ nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
|||
}
|
||||
}
|
||||
if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) {
|
||||
result = PR_FALSE;
|
||||
result = nsISelectionController::SELECTION_OFF;
|
||||
isOkToTurnOn = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isOkToTurnOn && !result) {
|
||||
selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
|
||||
result = PR_TRUE;
|
||||
result = nsISelectionController::SELECTION_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ nsFrame::HandlePress(nsIPresContext* aPresContext,
|
|||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -974,7 +974,7 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
@ -1058,7 +1058,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult result;
|
||||
|
@ -1102,7 +1102,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext* aPresContext,
|
|||
if (IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_FALSE);
|
||||
|
||||
if (!DisplaySelection(aPresContext))
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;
|
||||
|
||||
nsresult result;
|
||||
|
|
|
@ -396,7 +396,7 @@ protected:
|
|||
nsFrame();
|
||||
virtual ~nsFrame();
|
||||
|
||||
PRBool DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
PRInt16 DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
|
||||
//this will modify aPos and return the next frame ect.
|
||||
NS_IMETHOD GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos);
|
||||
|
|
|
@ -3374,7 +3374,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -576,10 +576,10 @@ NS_IMETHODIMP nsFrame::FirstChild(nsIPresContext* aPresContext,
|
|||
return nsnull == aListName ? NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRBool
|
||||
PRInt16
|
||||
nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
||||
{
|
||||
PRInt16 result = PR_FALSE;
|
||||
PRInt16 result = nsISelectionController::SELECTION_OFF;
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
@ -600,14 +600,14 @@ nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
|||
}
|
||||
}
|
||||
if (userinterface->mUserSelect == NS_STYLE_USER_SELECT_NONE) {
|
||||
result = PR_FALSE;
|
||||
result = nsISelectionController::SELECTION_OFF;
|
||||
isOkToTurnOn = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isOkToTurnOn && !result) {
|
||||
selCon->SetDisplaySelection(nsISelectionController::SELECTION_ON);
|
||||
result = PR_TRUE;
|
||||
result = nsISelectionController::SELECTION_ON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -921,7 +921,7 @@ nsFrame::HandlePress(nsIPresContext* aPresContext,
|
|||
{
|
||||
if (!IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_TRUE);
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -974,7 +974,7 @@ nsFrame::HandleMultiplePress(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsMouseEvent *me = (nsMouseEvent *)aEvent;
|
||||
|
@ -1058,7 +1058,7 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult result;
|
||||
|
@ -1102,7 +1102,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsIPresContext* aPresContext,
|
|||
if (IsMouseCaptured(aPresContext))
|
||||
CaptureMouse(aPresContext, PR_FALSE);
|
||||
|
||||
if (!DisplaySelection(aPresContext))
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF)
|
||||
return NS_OK;
|
||||
|
||||
nsresult result;
|
||||
|
|
|
@ -396,7 +396,7 @@ protected:
|
|||
nsFrame();
|
||||
virtual ~nsFrame();
|
||||
|
||||
PRBool DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
PRInt16 DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn = PR_FALSE);
|
||||
|
||||
//this will modify aPos and return the next frame ect.
|
||||
NS_IMETHOD GetFrameFromDirection(nsIPresContext* aPresContext, nsPeekOffsetStruct *aPos);
|
||||
|
|
|
@ -3374,7 +3374,7 @@ nsTextFrame::HandleMultiplePress(nsIPresContext* aPresContext,
|
|||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
if (!DisplaySelection(aPresContext)) {
|
||||
if (DisplaySelection(aPresContext) == nsISelectionController::SELECTION_OFF) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
|
||||
//TABLECELL SELECTION
|
||||
PRBool displaySelection;
|
||||
PRInt16 displaySelection;
|
||||
displaySelection = DisplaySelection(aPresContext);
|
||||
if (displaySelection)
|
||||
{
|
||||
|
@ -278,11 +278,18 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
frameSelection->GetTableCellSelectionStyleColor(&myColor);
|
||||
nsILookAndFeel* look = nsnull;
|
||||
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {
|
||||
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, ((nsStyleColor *)myColor)->mBackgroundColor);//VERY BAD CAST..TEMPORARY
|
||||
NS_RELEASE(look);
|
||||
}
|
||||
if(displaySelection==nsISelectionController::SELECTION_DISABLED)
|
||||
{
|
||||
((nsStyleColor *)myColor)->mBackgroundColor = NS_RGB(176,176,176);// disabled color
|
||||
}
|
||||
else
|
||||
{
|
||||
nsILookAndFeel* look = nsnull;
|
||||
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {
|
||||
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, ((nsStyleColor *)myColor)->mBackgroundColor);//VERY BAD CAST..TEMPORARY
|
||||
NS_RELEASE(look);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,6 +408,25 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
|
|||
// Note that in current version, aRange and aSpread are ignored,
|
||||
// only this frame is considered
|
||||
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
||||
|
||||
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) && frameSelection)
|
||||
{
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
nsRect frameRect;
|
||||
GetRect(frameRect);
|
||||
nsRect rect(0, 0, frameRect.width, frameRect.height);
|
||||
Invalidate(aPresContext, rect, PR_FALSE);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
|
||||
|
||||
//TABLECELL SELECTION
|
||||
PRBool displaySelection;
|
||||
PRInt16 displaySelection;
|
||||
displaySelection = DisplaySelection(aPresContext);
|
||||
if (displaySelection)
|
||||
{
|
||||
|
@ -278,11 +278,18 @@ NS_METHOD nsTableCellFrame::Paint(nsIPresContext* aPresContext,
|
|||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
frameSelection->GetTableCellSelectionStyleColor(&myColor);
|
||||
nsILookAndFeel* look = nsnull;
|
||||
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {
|
||||
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, ((nsStyleColor *)myColor)->mBackgroundColor);//VERY BAD CAST..TEMPORARY
|
||||
NS_RELEASE(look);
|
||||
}
|
||||
if(displaySelection==nsISelectionController::SELECTION_DISABLED)
|
||||
{
|
||||
((nsStyleColor *)myColor)->mBackgroundColor = NS_RGB(176,176,176);// disabled color
|
||||
}
|
||||
else
|
||||
{
|
||||
nsILookAndFeel* look = nsnull;
|
||||
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(&look)) && look) {
|
||||
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, ((nsStyleColor *)myColor)->mBackgroundColor);//VERY BAD CAST..TEMPORARY
|
||||
NS_RELEASE(look);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,6 +408,25 @@ nsTableCellFrame::SetSelected(nsIPresContext* aPresContext,
|
|||
// Note that in current version, aRange and aSpread are ignored,
|
||||
// only this frame is considered
|
||||
nsFrame::SetSelected(aPresContext, aRange, aSelected, aSpread);
|
||||
|
||||
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) && frameSelection)
|
||||
{
|
||||
PRBool tableCellSelectionMode;
|
||||
result = frameSelection->GetTableCellSelection(&tableCellSelectionMode);
|
||||
if (NS_SUCCEEDED(result) && tableCellSelectionMode)
|
||||
{
|
||||
nsRect frameRect;
|
||||
GetRect(frameRect);
|
||||
nsRect rect(0, 0, frameRect.width, frameRect.height);
|
||||
Invalidate(aPresContext, rect, PR_FALSE);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче