209989 After Find Again (Ctrl-G/F3), text highlighting color becomes green. Patch by Peter Kasting <pkasting@google.com>. r=mconnor sr=dbaron

This commit is contained in:
mark%moxienet.com 2006-06-17 01:05:26 +00:00
Родитель 0ccee130e1
Коммит a66ed53902
4 изменённых файлов: 49 добавлений и 58 удалений

Просмотреть файл

@ -3402,8 +3402,7 @@ nsDocViewerFocusListener::Focus(nsIDOMEvent* aEvent)
PRInt16 selectionStatus;
selCon->GetDisplaySelection(&selectionStatus);
//if selection was nsISelectionController::SELECTION_OFF, do nothing
//otherwise re-enable it.
// If selection was disabled, re-enable it.
if(selectionStatus == nsISelectionController::SELECTION_DISABLED ||
selectionStatus == nsISelectionController::SELECTION_HIDDEN)
{
@ -3428,9 +3427,9 @@ nsDocViewerFocusListener::Blur(nsIDOMEvent* aEvent)
PRInt16 selectionStatus;
selCon->GetDisplaySelection(&selectionStatus);
//if selection was nsISelectionController::SELECTION_OFF, do nothing
//otherwise re-enable it.
if(selectionStatus == nsISelectionController::SELECTION_ON)
// If selection was on, disable it.
if(selectionStatus == nsISelectionController::SELECTION_ON ||
selectionStatus == nsISelectionController::SELECTION_ATTENTION)
{
selCon->SetDisplaySelection(nsISelectionController::SELECTION_DISABLED);
selCon->RepaintSelection(nsISelectionController::SELECTION_NORMAL);

Просмотреть файл

@ -311,47 +311,33 @@ SelectionImageService::~SelectionImageService()
NS_IMETHODIMP
SelectionImageService::GetImage(PRInt16 aSelectionValue, imgIContainer **aContainer)
{
nsresult result;
if (aSelectionValue != nsISelectionController::SELECTION_ON)
{
if (!mDisabledContainer)
{
mDisabledContainer = do_CreateInstance("@mozilla.org/image/container;1",&result);
if (NS_FAILED(result))
return result;
if (mDisabledContainer)
{
nscolor disabledTextColor = NS_RGB(255, 255, 255);
nsCOMPtr<nsILookAndFeel> look;
look = do_GetService(kLookAndFeelCID,&result);
if (NS_SUCCEEDED(result) && look)
look->GetColor(nsILookAndFeel::eColor_TextSelectBackgroundDisabled, disabledTextColor);
CreateImage(disabledTextColor, mDisabledContainer);
}
}
*aContainer = mDisabledContainer;
*aContainer = nsnull;
nsCOMPtr<imgIContainer>* container = &mContainer;
nsILookAndFeel::nsColorID colorID;
if (aSelectionValue == nsISelectionController::SELECTION_ON) {
colorID = nsILookAndFeel::eColor_TextSelectBackground;
} else if (aSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
colorID = nsILookAndFeel::eColor_TextSelectBackgroundAttention;
} else {
container = &mDisabledContainer;
colorID = nsILookAndFeel::eColor_TextSelectBackgroundDisabled;
}
else
{
if (!mContainer)
{
mContainer = do_CreateInstance("@mozilla.org/image/container;1",&result);
if (NS_FAILED(result))
return result;
if (mContainer)
{
nscolor selectionTextColor = NS_RGB(255, 255, 255);
nsCOMPtr<nsILookAndFeel> look;
look = do_GetService(kLookAndFeelCID,&result);
if (NS_SUCCEEDED(result) && look)
look->GetColor(nsILookAndFeel::eColor_TextSelectBackground, selectionTextColor);
CreateImage(selectionTextColor, mContainer);
}
}
*aContainer = mContainer;
if (!*container) {
nsresult result;
*container = do_CreateInstance("@mozilla.org/image/container;1", &result);
if (NS_FAILED(result))
return result;
nscolor color = NS_RGB(255, 255, 255);
nsCOMPtr<nsILookAndFeel> look = do_GetService(kLookAndFeelCID);
if (look)
look->GetColor(colorID, color);
CreateImage(color, *container);
}
if (!*aContainer)
return NS_ERROR_OUT_OF_MEMORY;
*aContainer = *container;
NS_ADDREF(*aContainer);
return NS_OK;
}
@ -807,17 +793,20 @@ void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
#else
nscolor color = NS_RGB(255, 255, 255);
nsILookAndFeel::nsColorID lookandFeel;
nsILookAndFeel::nsColorID colorID;
nsresult result;
if (mSelectionValue != nsISelectionController::SELECTION_ON)
lookandFeel = nsILookAndFeel::eColor_TextSelectBackgroundDisabled;
else
lookandFeel = nsILookAndFeel::eColor_TextSelectBackground;
if (mSelectionValue == nsISelectionController::SELECTION_ON) {
colorID = nsILookAndFeel::eColor_TextSelectBackground;
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
colorID = nsILookAndFeel::eColor_TextSelectBackgroundAttention;
} else {
colorID = nsILookAndFeel::eColor_TextSelectBackgroundDisabled;
}
nsCOMPtr<nsILookAndFeel> look;
look = do_GetService(kLookAndFeelCID,&result);
look = do_GetService(kLookAndFeelCID, &result);
if (NS_SUCCEEDED(result) && look)
look->GetColor(lookandFeel, color);
look->GetColor(colorID, color);
gfxRGBA c(color);
c.a = .5;

Просмотреть файл

@ -5151,6 +5151,12 @@ nsTypedSelection::RemoveAllRanges()
// Turn off signal for table selection
mFrameSelection->ClearTableCellSelection();
// If this was an ATTENTION selection, change it back to normal now
if (mFrameSelection->GetDisplaySelection() ==
nsISelectionController::SELECTION_ATTENTION) {
mFrameSelection->SetDisplaySelection(nsISelectionController::SELECTION_ON);
}
return mFrameSelection->NotifySelectionListeners(GetType());
// Also need to notify the frames!
// PresShell::CharacterDataChanged should do that on DocumentChanged

Просмотреть файл

@ -613,9 +613,9 @@ var gFindBar = {
}
findToolbar.hidden = true;
this.changeSelectionColor(false);
this.setFoundLink(null);
this.mCurrentWindow = null;
this.changeSelectionColor(false);
if (this.mQuickFindTimeout) {
clearTimeout(this.mQuickFindTimeout);
this.mQuickFindTimeout = null;
@ -860,12 +860,11 @@ var gFindBar = {
if (highlightBtn.checked)
this.setHighlightTimeout();
this.changeSelectionColor(true);
var fastFind = getBrowser().fastFind;
fastFind.caseSensitive = this.shouldBeCaseSensitive(val);
this.setCaseSensitiveStr(val);
var res = fastFind.find(val, this.mFindMode == FIND_LINKS);
this.changeSelectionColor(true);
this.updateFoundLink(res);
this.updateStatus(res, true);
@ -980,10 +979,9 @@ var gFindBar = {
findNext: function ()
{
this.changeSelectionColor(true);
var fastFind = getBrowser().fastFind;
var res = fastFind.findNext();
this.changeSelectionColor(true);
this.updateFoundLink(res);
this.updateStatus(res, true);
@ -995,10 +993,9 @@ var gFindBar = {
findPrevious: function ()
{
this.changeSelectionColor(true);
var fastFind = getBrowser().fastFind;
var res = fastFind.findPrevious();
this.changeSelectionColor(true);
this.updateFoundLink(res);
this.updateStatus(res, false);