зеркало из https://github.com/mozilla/pjs.git
drawing selection as tri-state. on-off-disabled. hardcoded disable color to grey right now. r=mjudge
This commit is contained in:
Родитель
0bca489fe4
Коммит
05840e5f32
|
@ -314,8 +314,10 @@ public:
|
|||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const = 0;
|
||||
virtual void SetDisplaySelection(PRBool aToggle) = 0;
|
||||
virtual PRBool GetDisplaySelection() const = 0;
|
||||
|
||||
enum{SELECTION_OFF = 0, SELECTION_ON = 1, SELECTION_DISABLED = 2 };
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle) = 0;
|
||||
virtual PRInt8 GetDisplaySelection() const = 0;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
|
|
|
@ -3382,12 +3382,12 @@ nsIContent* nsDocument::GetNextContent(const nsIContent *aContent) const
|
|||
return result;
|
||||
}
|
||||
|
||||
void nsDocument::SetDisplaySelection(PRBool aToggle)
|
||||
void nsDocument::SetDisplaySelection(PRInt8 aToggle)
|
||||
{
|
||||
mDisplaySelection = aToggle;
|
||||
}
|
||||
|
||||
PRBool nsDocument::GetDisplaySelection() const
|
||||
PRInt8 nsDocument::GetDisplaySelection() const
|
||||
{
|
||||
return mDisplaySelection;
|
||||
}
|
||||
|
|
|
@ -394,8 +394,8 @@ public:
|
|||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
||||
virtual PRInt8 GetDisplaySelection() const;
|
||||
|
||||
// nsIJSScriptObject interface
|
||||
virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj,
|
||||
|
@ -469,7 +469,7 @@ protected:
|
|||
void* mScriptObject;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
PRBool mDisplaySelection;
|
||||
PRInt8 mDisplaySelection;
|
||||
PRBool mInDestructor;
|
||||
nsDOMStyleSheetCollection *mDOMStyleSheets;
|
||||
nsINameSpaceManager* mNameSpaceManager;
|
||||
|
|
|
@ -3553,7 +3553,7 @@ NS_IMETHODIMP nsHTMLDocument::FindNext(const nsString &aSearchStr, PRBool aMatch
|
|||
NS_IF_RELEASE(start);
|
||||
NS_IF_RELEASE(end);
|
||||
|
||||
SetDisplaySelection(PR_TRUE);
|
||||
SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
|
||||
|
||||
if (aIsFound && doReplace) {
|
||||
|
|
|
@ -1742,7 +1742,7 @@ nsXULDocument::SelectAll()
|
|||
startPnt->SetPoint(start, -1, PR_TRUE);
|
||||
endPnt->SetPoint(end, -1, PR_FALSE);
|
||||
#endif
|
||||
SetDisplaySelection(PR_TRUE);
|
||||
SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1929,12 +1929,12 @@ nsXULDocument::GetNextContent(const nsIContent *aContent) const
|
|||
}
|
||||
|
||||
void
|
||||
nsXULDocument::SetDisplaySelection(PRBool aToggle)
|
||||
nsXULDocument::SetDisplaySelection(PRInt8 aToggle)
|
||||
{
|
||||
mDisplaySelection = aToggle;
|
||||
}
|
||||
|
||||
PRBool
|
||||
PRInt8
|
||||
nsXULDocument::GetDisplaySelection() const
|
||||
{
|
||||
return mDisplaySelection;
|
||||
|
|
|
@ -268,9 +268,9 @@ public:
|
|||
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
||||
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
virtual PRInt8 GetDisplaySelection() const;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
|
@ -529,7 +529,7 @@ protected:
|
|||
nsString mCharSetID;
|
||||
nsVoidArray mStyleSheets;
|
||||
nsCOMPtr<nsIDOMSelection> mSelection; // [OWNER]
|
||||
PRBool mDisplaySelection;
|
||||
PRInt8 mDisplaySelection;
|
||||
PRBool mIsKeyBindingDoc;
|
||||
nsVoidArray mPresShells;
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
||||
|
|
|
@ -1145,7 +1145,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent)
|
|||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(PR_TRUE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
}
|
||||
}
|
||||
#ifdef USE_HACK_REPAINT
|
||||
|
@ -1191,20 +1191,11 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
|
|||
editor->GetDocument(getter_AddRefs(domDoc));
|
||||
if (domDoc)
|
||||
{
|
||||
if ((flags & nsIHTMLEditor::eEditorPlaintextMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorSingleLineMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorPasswordMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorReadonlyMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorDisabledMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorFilterInputMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorMailMask))
|
||||
{//HACK UNTIL UNFOCUSED SELECTION DRAWS CORRECTLY
|
||||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(PR_FALSE);
|
||||
}
|
||||
}//END HACK
|
||||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_DISABLED);
|
||||
}
|
||||
}
|
||||
#ifdef USE_HACK_REPAINT
|
||||
// begin hack repaint
|
||||
|
|
|
@ -1145,7 +1145,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent)
|
|||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(PR_TRUE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
}
|
||||
}
|
||||
#ifdef USE_HACK_REPAINT
|
||||
|
@ -1191,20 +1191,11 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
|
|||
editor->GetDocument(getter_AddRefs(domDoc));
|
||||
if (domDoc)
|
||||
{
|
||||
if ((flags & nsIHTMLEditor::eEditorPlaintextMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorSingleLineMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorPasswordMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorReadonlyMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorDisabledMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorFilterInputMask) ||
|
||||
(flags & nsIHTMLEditor::eEditorMailMask))
|
||||
{//HACK UNTIL UNFOCUSED SELECTION DRAWS CORRECTLY
|
||||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(PR_FALSE);
|
||||
}
|
||||
}//END HACK
|
||||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(domDoc);
|
||||
if (doc)
|
||||
{
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_DISABLED);
|
||||
}
|
||||
}
|
||||
#ifdef USE_HACK_REPAINT
|
||||
// begin hack repaint
|
||||
|
|
|
@ -995,7 +995,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
result = docShell->GetItemType(&docShellType);
|
||||
if (NS_SUCCEEDED(result)){
|
||||
if (nsIDocShellTreeItem::typeContent == docShellType){
|
||||
mDocument->SetDisplaySelection(PR_TRUE);
|
||||
mDocument->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,8 +314,10 @@ public:
|
|||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const = 0;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const = 0;
|
||||
virtual void SetDisplaySelection(PRBool aToggle) = 0;
|
||||
virtual PRBool GetDisplaySelection() const = 0;
|
||||
|
||||
enum{SELECTION_OFF = 0, SELECTION_ON = 1, SELECTION_DISABLED = 2 };
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle) = 0;
|
||||
virtual PRInt8 GetDisplaySelection() const = 0;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
|
|
|
@ -3382,12 +3382,12 @@ nsIContent* nsDocument::GetNextContent(const nsIContent *aContent) const
|
|||
return result;
|
||||
}
|
||||
|
||||
void nsDocument::SetDisplaySelection(PRBool aToggle)
|
||||
void nsDocument::SetDisplaySelection(PRInt8 aToggle)
|
||||
{
|
||||
mDisplaySelection = aToggle;
|
||||
}
|
||||
|
||||
PRBool nsDocument::GetDisplaySelection() const
|
||||
PRInt8 nsDocument::GetDisplaySelection() const
|
||||
{
|
||||
return mDisplaySelection;
|
||||
}
|
||||
|
|
|
@ -394,8 +394,8 @@ public:
|
|||
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetPrevContent(const nsIContent *aContent) const;
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
||||
virtual PRInt8 GetDisplaySelection() const;
|
||||
|
||||
// nsIJSScriptObject interface
|
||||
virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj,
|
||||
|
@ -469,7 +469,7 @@ protected:
|
|||
void* mScriptObject;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||
nsIEventListenerManager* mListenerManager;
|
||||
PRBool mDisplaySelection;
|
||||
PRInt8 mDisplaySelection;
|
||||
PRBool mInDestructor;
|
||||
nsDOMStyleSheetCollection *mDOMStyleSheets;
|
||||
nsINameSpaceManager* mNameSpaceManager;
|
||||
|
|
|
@ -606,7 +606,7 @@ nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
|||
}
|
||||
}
|
||||
if (isOkToTurnOn && !result) {
|
||||
doc->SetDisplaySelection(PR_TRUE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -780,9 +780,12 @@ inline nscolor EnsureDifferentColors(nscolor colorA, nscolor colorB)
|
|||
//helper class for drawing multiply selected text
|
||||
class DrawSelectionIterator
|
||||
{
|
||||
enum {DISABLED_COLOR = NS_RGB(176,176,176)};
|
||||
enum {SELECTION_TYPES_WE_CARE_ABOUT=SELECTION_NONE+SELECTION_NORMAL};
|
||||
public:
|
||||
DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle);
|
||||
DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle,
|
||||
PRInt8 aSelectionStatus);
|
||||
~DrawSelectionIterator();
|
||||
PRBool First();
|
||||
PRBool Next();
|
||||
|
@ -807,12 +810,14 @@ private:
|
|||
PRBool mDone;
|
||||
PRUint8 * mTypes;
|
||||
PRBool mInit;
|
||||
PRInt8 mSelectionStatus;//see nsIDocument.h SetDisplaySelection()
|
||||
nscolor mDisabledColor;
|
||||
//private methods
|
||||
void FillCurrentData();
|
||||
};
|
||||
|
||||
DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle)
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle, PRInt8 aSelectionStatus)
|
||||
:mOldStyle(aTextStyle)
|
||||
{
|
||||
mDetails = aSelDetails;
|
||||
|
@ -821,6 +826,9 @@ DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails
|
|||
mLength = aTextLength;
|
||||
mTypes = nsnull;
|
||||
mInit = PR_FALSE;
|
||||
mSelectionStatus = aSelectionStatus;
|
||||
mDisabledColor = EnsureDifferentColors(DISABLED_COLOR, mOldStyle.mSelectionBGColor);
|
||||
|
||||
if (!aSelDetails)
|
||||
{
|
||||
mDone = PR_TRUE;
|
||||
|
@ -1009,13 +1017,13 @@ DrawSelectionIterator::CurrentBackGroundColor(nscolor &aColor)
|
|||
{
|
||||
if (mCurrentIdx == (PRUint32)mDetails->mStart)
|
||||
{
|
||||
aColor = mOldStyle.mSelectionBGColor;
|
||||
aColor = (mSelectionStatus==nsIDocument::SELECTION_ON)?mOldStyle.mSelectionBGColor:mDisabledColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (mTypes[mCurrentIdx] | SELECTION_NORMAL)
|
||||
{
|
||||
aColor = mOldStyle.mSelectionBGColor;
|
||||
aColor = (mSelectionStatus==nsIDocument::SELECTION_ON)?mOldStyle.mSelectionBGColor:mDisabledColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -1723,7 +1731,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
|
|||
{
|
||||
nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aPresContext)));
|
||||
|
||||
PRBool displaySelection;
|
||||
PRInt8 displaySelection;
|
||||
displaySelection = doc->GetDisplaySelection();
|
||||
|
||||
// Make enough space to transform
|
||||
|
@ -1796,7 +1804,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
|
|||
}
|
||||
//while we have substrings...
|
||||
PRBool drawn = PR_FALSE;
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle);
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle, displaySelection);
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
@ -2295,7 +2303,7 @@ nsTextFrame::PaintTextSlowly(nsIPresContext* aPresContext,
|
|||
sdptr = sdptr->mNext;
|
||||
}
|
||||
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle);
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle, displaySelection);
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
@ -2482,7 +2490,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
|
|||
sdptr->mEnd = ip[sdptr->mEnd] - mContentOffset;
|
||||
sdptr = sdptr->mNext;
|
||||
}
|
||||
DrawSelectionIterator iter(details,(PRUnichar *)text,(PRUint32)textLength,aTextStyle);//ITS OK TO CAST HERE THE RESULT WE USE WILLNOT DO BAD CONVERSION
|
||||
DrawSelectionIterator iter(details,(PRUnichar *)text,(PRUint32)textLength,aTextStyle, displaySelection);//ITS OK TO CAST HERE THE RESULT WE USE WILLNOT DO BAD CONVERSION
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
|
|
@ -606,7 +606,7 @@ nsFrame::DisplaySelection(nsIPresContext* aPresContext, PRBool isOkToTurnOn)
|
|||
}
|
||||
}
|
||||
if (isOkToTurnOn && !result) {
|
||||
doc->SetDisplaySelection(PR_TRUE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -995,7 +995,7 @@ PresShell::Init(nsIDocument* aDocument,
|
|||
result = docShell->GetItemType(&docShellType);
|
||||
if (NS_SUCCEEDED(result)){
|
||||
if (nsIDocShellTreeItem::typeContent == docShellType){
|
||||
mDocument->SetDisplaySelection(PR_TRUE);
|
||||
mDocument->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -780,9 +780,12 @@ inline nscolor EnsureDifferentColors(nscolor colorA, nscolor colorB)
|
|||
//helper class for drawing multiply selected text
|
||||
class DrawSelectionIterator
|
||||
{
|
||||
enum {DISABLED_COLOR = NS_RGB(176,176,176)};
|
||||
enum {SELECTION_TYPES_WE_CARE_ABOUT=SELECTION_NONE+SELECTION_NORMAL};
|
||||
public:
|
||||
DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle);
|
||||
DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle,
|
||||
PRInt8 aSelectionStatus);
|
||||
~DrawSelectionIterator();
|
||||
PRBool First();
|
||||
PRBool Next();
|
||||
|
@ -807,12 +810,14 @@ private:
|
|||
PRBool mDone;
|
||||
PRUint8 * mTypes;
|
||||
PRBool mInit;
|
||||
PRInt8 mSelectionStatus;//see nsIDocument.h SetDisplaySelection()
|
||||
nscolor mDisabledColor;
|
||||
//private methods
|
||||
void FillCurrentData();
|
||||
};
|
||||
|
||||
DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails, PRUnichar *aText,
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle)
|
||||
PRUint32 aTextLength, nsTextFrame::TextStyle &aTextStyle, PRInt8 aSelectionStatus)
|
||||
:mOldStyle(aTextStyle)
|
||||
{
|
||||
mDetails = aSelDetails;
|
||||
|
@ -821,6 +826,9 @@ DrawSelectionIterator::DrawSelectionIterator(const SelectionDetails *aSelDetails
|
|||
mLength = aTextLength;
|
||||
mTypes = nsnull;
|
||||
mInit = PR_FALSE;
|
||||
mSelectionStatus = aSelectionStatus;
|
||||
mDisabledColor = EnsureDifferentColors(DISABLED_COLOR, mOldStyle.mSelectionBGColor);
|
||||
|
||||
if (!aSelDetails)
|
||||
{
|
||||
mDone = PR_TRUE;
|
||||
|
@ -1009,13 +1017,13 @@ DrawSelectionIterator::CurrentBackGroundColor(nscolor &aColor)
|
|||
{
|
||||
if (mCurrentIdx == (PRUint32)mDetails->mStart)
|
||||
{
|
||||
aColor = mOldStyle.mSelectionBGColor;
|
||||
aColor = (mSelectionStatus==nsIDocument::SELECTION_ON)?mOldStyle.mSelectionBGColor:mDisabledColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (mTypes[mCurrentIdx] | SELECTION_NORMAL)
|
||||
{
|
||||
aColor = mOldStyle.mSelectionBGColor;
|
||||
aColor = (mSelectionStatus==nsIDocument::SELECTION_ON)?mOldStyle.mSelectionBGColor:mDisabledColor;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -1723,7 +1731,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
|
|||
{
|
||||
nsCOMPtr<nsIDocument> doc(getter_AddRefs(GetDocument(aPresContext)));
|
||||
|
||||
PRBool displaySelection;
|
||||
PRInt8 displaySelection;
|
||||
displaySelection = doc->GetDisplaySelection();
|
||||
|
||||
// Make enough space to transform
|
||||
|
@ -1796,7 +1804,7 @@ nsTextFrame::PaintUnicodeText(nsIPresContext* aPresContext,
|
|||
}
|
||||
//while we have substrings...
|
||||
PRBool drawn = PR_FALSE;
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle);
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle, displaySelection);
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
@ -2295,7 +2303,7 @@ nsTextFrame::PaintTextSlowly(nsIPresContext* aPresContext,
|
|||
sdptr = sdptr->mNext;
|
||||
}
|
||||
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle);
|
||||
DrawSelectionIterator iter(details,text,(PRUint32)textLength,aTextStyle, displaySelection);
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
@ -2482,7 +2490,7 @@ nsTextFrame::PaintAsciiText(nsIPresContext* aPresContext,
|
|||
sdptr->mEnd = ip[sdptr->mEnd] - mContentOffset;
|
||||
sdptr = sdptr->mNext;
|
||||
}
|
||||
DrawSelectionIterator iter(details,(PRUnichar *)text,(PRUint32)textLength,aTextStyle);//ITS OK TO CAST HERE THE RESULT WE USE WILLNOT DO BAD CONVERSION
|
||||
DrawSelectionIterator iter(details,(PRUnichar *)text,(PRUint32)textLength,aTextStyle, displaySelection);//ITS OK TO CAST HERE THE RESULT WE USE WILLNOT DO BAD CONVERSION
|
||||
if (!iter.IsDone() && iter.First())
|
||||
{
|
||||
nscoord currentX = dx;
|
||||
|
|
|
@ -3553,7 +3553,7 @@ NS_IMETHODIMP nsHTMLDocument::FindNext(const nsString &aSearchStr, PRBool aMatch
|
|||
NS_IF_RELEASE(start);
|
||||
NS_IF_RELEASE(end);
|
||||
|
||||
SetDisplaySelection(PR_TRUE);
|
||||
SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
|
||||
|
||||
if (aIsFound && doReplace) {
|
||||
|
|
|
@ -1223,7 +1223,7 @@ nsGfxTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document");
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
doc->SetDisplaySelection(PR_FALSE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_OFF);
|
||||
}
|
||||
else
|
||||
{ // unset readonly
|
||||
|
@ -1233,7 +1233,7 @@ nsGfxTextControlFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||
presShell->GetDocument(getter_AddRefs(doc));
|
||||
NS_ASSERTION(doc, "null document");
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
doc->SetDisplaySelection(PR_TRUE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
}
|
||||
mEditor->SetFlags(flags);
|
||||
}
|
||||
|
@ -3417,7 +3417,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc
|
|||
aPresShell->SetCaretEnabled(PR_FALSE);
|
||||
nsCOMPtr<nsIDocument>doc = do_QueryInterface(aDoc);
|
||||
if (doc) {
|
||||
doc->SetDisplaySelection(PR_FALSE);
|
||||
doc->SetDisplaySelection(nsIDocument::SELECTION_OFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1742,7 +1742,7 @@ nsXULDocument::SelectAll()
|
|||
startPnt->SetPoint(start, -1, PR_TRUE);
|
||||
endPnt->SetPoint(end, -1, PR_FALSE);
|
||||
#endif
|
||||
SetDisplaySelection(PR_TRUE);
|
||||
SetDisplaySelection(nsIDocument::SELECTION_ON);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1929,12 +1929,12 @@ nsXULDocument::GetNextContent(const nsIContent *aContent) const
|
|||
}
|
||||
|
||||
void
|
||||
nsXULDocument::SetDisplaySelection(PRBool aToggle)
|
||||
nsXULDocument::SetDisplaySelection(PRInt8 aToggle)
|
||||
{
|
||||
mDisplaySelection = aToggle;
|
||||
}
|
||||
|
||||
PRBool
|
||||
PRInt8
|
||||
nsXULDocument::GetDisplaySelection() const
|
||||
{
|
||||
return mDisplaySelection;
|
||||
|
|
|
@ -268,9 +268,9 @@ public:
|
|||
|
||||
virtual nsIContent* GetNextContent(const nsIContent *aContent) const;
|
||||
|
||||
virtual void SetDisplaySelection(PRBool aToggle);
|
||||
virtual void SetDisplaySelection(PRInt8 aToggle);
|
||||
|
||||
virtual PRBool GetDisplaySelection() const;
|
||||
virtual PRInt8 GetDisplaySelection() const;
|
||||
|
||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
|
@ -529,7 +529,7 @@ protected:
|
|||
nsString mCharSetID;
|
||||
nsVoidArray mStyleSheets;
|
||||
nsCOMPtr<nsIDOMSelection> mSelection; // [OWNER]
|
||||
PRBool mDisplaySelection;
|
||||
PRInt8 mDisplaySelection;
|
||||
PRBool mIsKeyBindingDoc;
|
||||
nsVoidArray mPresShells;
|
||||
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
|
||||
|
|
|
@ -3355,7 +3355,7 @@ nsBrowserWindow::DoToggleSelection()
|
|||
nsCOMPtr<nsIDocument> doc;
|
||||
shell->GetDocument(getter_AddRefs(doc));
|
||||
if (doc) {
|
||||
PRBool current = doc->GetDisplaySelection();
|
||||
PRInt8 current = doc->GetDisplaySelection();
|
||||
doc->SetDisplaySelection(!current);
|
||||
ForceRefresh();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче