mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-02-06 02:30:56 +00:00
#433: M1368269 M1400399
This commit is contained in:
parent
e13d43ac6a
commit
ea7b13db83
@ -48,26 +48,20 @@ 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 +72,26 @@ 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 =
|
||||
nsCOMPtr<nsISelection> normalSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
||||
normalSel->AddSelectionListener(this);
|
||||
normalSel->AsSelection()->AddSelectionListener(this);
|
||||
mCurrCtrlNormalSel = do_GetWeakReference(normalSel);
|
||||
|
||||
// Register 'this' as selection listener for the spell check selection.
|
||||
Selection* spellSel =
|
||||
nsCOMPtr<nsISelection> spellSel =
|
||||
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
||||
spellSel->AddSelectionListener(this);
|
||||
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
|
||||
|
@ -145,7 +145,7 @@ XULTreeAccessible::Value(nsString& aValue)
|
||||
void
|
||||
XULTreeAccessible::Shutdown()
|
||||
{
|
||||
if (!mDoc->IsDefunct()) {
|
||||
if (mDoc && !mDoc->IsDefunct()) {
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ NS_IMPL_RELEASE_INHERITED(XULTreeGridRowAccessible,
|
||||
void
|
||||
XULTreeGridRowAccessible::Shutdown()
|
||||
{
|
||||
if (!mDoc->IsDefunct()) {
|
||||
if (mDoc && !mDoc->IsDefunct()) {
|
||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user