change the input method highligh code from 2 style to 4 styles. r=mjudge
This commit is contained in:
@@ -56,8 +56,10 @@ class nsILayoutHistoryState;
|
|||||||
|
|
||||||
typedef enum SelectionType{SELECTION_NORMAL = 0,
|
typedef enum SelectionType{SELECTION_NORMAL = 0,
|
||||||
SELECTION_SPELLCHECK,
|
SELECTION_SPELLCHECK,
|
||||||
SELECTION_IME_SOLID,
|
SELECTION_IME_RAWINPUT,
|
||||||
SELECTION_IME_DASHED,
|
SELECTION_IME_SELECTEDRAWTEXT,
|
||||||
|
SELECTION_IME_CONVERTEDTEXT,
|
||||||
|
SELECTION_IME_SELECTEDCONVERTEDTEXT,
|
||||||
NUM_SELECTIONTYPES} SelectionType;
|
NUM_SELECTIONTYPES} SelectionType;
|
||||||
|
|
||||||
typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
|
typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
|
||||||
|
|||||||
@@ -56,8 +56,10 @@ class nsILayoutHistoryState;
|
|||||||
|
|
||||||
typedef enum SelectionType{SELECTION_NORMAL = 0,
|
typedef enum SelectionType{SELECTION_NORMAL = 0,
|
||||||
SELECTION_SPELLCHECK,
|
SELECTION_SPELLCHECK,
|
||||||
SELECTION_IME_SOLID,
|
SELECTION_IME_RAWINPUT,
|
||||||
SELECTION_IME_DASHED,
|
SELECTION_IME_SELECTEDRAWTEXT,
|
||||||
|
SELECTION_IME_CONVERTEDTEXT,
|
||||||
|
SELECTION_IME_SELECTEDCONVERTEDTEXT,
|
||||||
NUM_SELECTIONTYPES} SelectionType;
|
NUM_SELECTIONTYPES} SelectionType;
|
||||||
|
|
||||||
typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
|
typedef enum SelectionRegion{SELECTION_ANCHOR_REGION = 0,
|
||||||
|
|||||||
@@ -898,6 +898,9 @@ RenderSelectionCursor(nsIRenderingContext& aRenderingContext,
|
|||||||
|
|
||||||
// XXX letter-spacing
|
// XXX letter-spacing
|
||||||
// XXX word-spacing
|
// XXX word-spacing
|
||||||
|
#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_MAC)
|
||||||
|
#define USE_INVERT_FOR_SELECTION
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||||
@@ -1012,7 +1015,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
|||||||
//
|
//
|
||||||
// For platforms that dont implement InvertRect(), the selection will be
|
// For platforms that dont implement InvertRect(), the selection will be
|
||||||
// a non-filled rectangle.
|
// a non-filled rectangle.
|
||||||
#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_MAC)
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
#else
|
#else
|
||||||
@@ -1020,20 +1023,44 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
|||||||
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
#endif
|
#endif
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_SPELLCHECK:{
|
case SELECTION_SPELLCHECK:{
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset, aY + baseline - offset, textWidth, size);
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_IME_SOLID:{
|
case SELECTION_IME_SELECTEDRAWTEXT:{
|
||||||
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#else
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,128));
|
||||||
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#endif
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(0,0,255));
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset+size, textWidth-2, size);
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_IME_DASHED:{
|
case SELECTION_IME_RAWINPUT:{
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(128,0,255));
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset+size, textWidth-2, size);
|
||||||
|
}break;
|
||||||
|
case SELECTION_IME_SELECTEDCONVERTEDTEXT:{
|
||||||
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#else
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,128));
|
||||||
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#endif
|
||||||
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset, textWidth-2, size*2);
|
||||||
|
}break;
|
||||||
|
case SELECTION_IME_CONVERTEDTEXT:{
|
||||||
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset, textWidth-2, size*2);
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
NS_ASSERTION(0,"what type of selection do i not know about?");
|
NS_ASSERTION(0,"what type of selection do i not know about?");
|
||||||
|
|||||||
@@ -898,6 +898,9 @@ RenderSelectionCursor(nsIRenderingContext& aRenderingContext,
|
|||||||
|
|
||||||
// XXX letter-spacing
|
// XXX letter-spacing
|
||||||
// XXX word-spacing
|
// XXX word-spacing
|
||||||
|
#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_MAC)
|
||||||
|
#define USE_INVERT_FOR_SELECTION
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
||||||
@@ -1012,7 +1015,7 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
|||||||
//
|
//
|
||||||
// For platforms that dont implement InvertRect(), the selection will be
|
// For platforms that dont implement InvertRect(), the selection will be
|
||||||
// a non-filled rectangle.
|
// a non-filled rectangle.
|
||||||
#if defined(XP_PC) || defined(XP_UNIX) || defined(XP_MAC)
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
#else
|
#else
|
||||||
@@ -1020,20 +1023,44 @@ nsTextFrame::PaintTextDecorations(nsIRenderingContext& aRenderingContext,
|
|||||||
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
#endif
|
#endif
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_SPELLCHECK:{
|
case SELECTION_SPELLCHECK:{
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset, aY + baseline - offset, textWidth, size);
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_IME_SOLID:{
|
case SELECTION_IME_SELECTEDRAWTEXT:{
|
||||||
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#else
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,128));
|
||||||
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#endif
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(0,0,255));
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset+size, textWidth-2, size);
|
||||||
}break;
|
}break;
|
||||||
case SELECTION_IME_DASHED:{
|
case SELECTION_IME_RAWINPUT:{
|
||||||
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
aRenderingContext.SetColor(NS_RGB(128,0,255));
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
aRenderingContext.FillRect(aX, aY + baseline - offset, aWidth, size);
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset+size, textWidth-2, size);
|
||||||
|
}break;
|
||||||
|
case SELECTION_IME_SELECTEDCONVERTEDTEXT:{
|
||||||
|
#ifdef USE_INVERT_FOR_SELECTION
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,255));
|
||||||
|
aRenderingContext.InvertRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#else
|
||||||
|
aRenderingContext.SetColor(NS_RGB(255,255,128));
|
||||||
|
aRenderingContext.DrawRect(aX + startOffset, aY, textWidth, rect.height);
|
||||||
|
#endif
|
||||||
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset, textWidth-2, size*2);
|
||||||
|
}break;
|
||||||
|
case SELECTION_IME_CONVERTEDTEXT:{
|
||||||
|
aTextStyle.mNormalFont->GetUnderline(offset, size);
|
||||||
|
aRenderingContext.SetColor(NS_RGB(189,33,66));
|
||||||
|
aRenderingContext.FillRect(aX + startOffset+1, aY + baseline - offset, textWidth-2, size*2);
|
||||||
}break;
|
}break;
|
||||||
default:
|
default:
|
||||||
NS_ASSERTION(0,"what type of selection do i not know about?");
|
NS_ASSERTION(0,"what type of selection do i not know about?");
|
||||||
|
|||||||
Reference in New Issue
Block a user