mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-29 19:12:11 +00:00
applied bug1400399_pm.diff
This commit is contained in:
@@ -48,26 +48,21 @@ SelectionManager::SelectionManager() :
|
||||
void
|
||||
SelectionManager::ClearControlSelectionListener()
|
||||
{
|
||||
if (!mCurrCtrlFrame)
|
||||
return;
|
||||
|
||||
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
|
||||
NS_ASSERTION(frameSel, "No frame selection for the element!");
|
||||
|
||||
mCurrCtrlFrame = nullptr;
|
||||
if (!frameSel)
|
||||
return;
|
||||
|
||||
// Remove 'this' registered as selection listener for the normal selection.
|
||||
Selection* normalSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
normalSel->RemoveSelectionListener(this);
|
||||
nsCOMPtr<nsISelection> normalSel = do_QueryReferent(mCurrCtrlNormalSel);
|
||||
if (normalSel) {
|
||||
normalSel->AsSelection()->RemoveSelectionListener(this);
|
||||
mCurrCtrlNormalSel = nullptr;
|
||||
}
|
||||
|
||||
// Remove 'this' registered as selection listener for the spellcheck
|
||||
// selection.
|
||||
Selection* spellSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
||||
spellSel->RemoveSelectionListener(this);
|
||||
nsCOMPtr<nsISelection> spellSel = do_QueryReferent(mCurrCtrlSpellSel);
|
||||
if (spellSel) {
|
||||
spellSel->AsSelection()->RemoveSelectionListener(this);
|
||||
mCurrCtrlSpellSel = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -78,24 +73,24 @@ SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm)
|
||||
// the current focus.
|
||||
ClearControlSelectionListener();
|
||||
|
||||
mCurrCtrlFrame = aFocusedElm->GetPrimaryFrame();
|
||||
if (!mCurrCtrlFrame)
|
||||
nsIFrame* controlFrame = aFocusedElm->GetPrimaryFrame();
|
||||
if (!controlFrame)
|
||||
return;
|
||||
|
||||
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
|
||||
const nsFrameSelection* frameSel = controlFrame->GetConstFrameSelection();
|
||||
NS_ASSERTION(frameSel, "No frame selection for focused element!");
|
||||
if (!frameSel)
|
||||
return;
|
||||
|
||||
// Register 'this' as selection listener for the normal selection.
|
||||
Selection* normalSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
normalSel->AddSelectionListener(this);
|
||||
nsCOMPtr<nsISelection> normalSel = frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
normalSel->AsSelection()->AddSelectionListener(this);
|
||||
mCurrCtrlNormalSel = do_GetWeakReference(normalSel);
|
||||
|
||||
// Register 'this' as selection listener for the spell check selection.
|
||||
Selection* spellSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
||||
spellSel->AddSelectionListener(this);
|
||||
nsCOMPtr<nsISelection> spellSel = frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
||||
spellSel->AsSelection()->AddSelectionListener(this);
|
||||
mCurrCtrlSpellSel = do_GetWeakReference(spellSel);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -120,10 +120,11 @@ protected:
|
||||
void ProcessSelectionChanged(SelData* aSelData);
|
||||
|
||||
private:
|
||||
// Currently focused control.
|
||||
nsWeakFrame mCurrCtrlFrame;
|
||||
int32_t mCaretOffset;
|
||||
HyperTextAccessible* mAccWithCaret;
|
||||
// Currently focused controls.
|
||||
nsWeakPtr mCurrCtrlNormalSel;
|
||||
nsWeakPtr mCurrCtrlSpellSel;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
||||
Reference in New Issue
Block a user