mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-08 05:29:36 +00:00
#433: M1368269 M1400399
This commit is contained in:
parent
e13d43ac6a
commit
ea7b13db83
|
@ -48,26 +48,20 @@ SelectionManager::SelectionManager() :
|
||||||
void
|
void
|
||||||
SelectionManager::ClearControlSelectionListener()
|
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.
|
// Remove 'this' registered as selection listener for the normal selection.
|
||||||
Selection* normalSel =
|
nsCOMPtr<nsISelection> normalSel = do_QueryReferent(mCurrCtrlNormalSel);
|
||||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
if (normalSel) {
|
||||||
normalSel->RemoveSelectionListener(this);
|
normalSel->AsSelection()->RemoveSelectionListener(this);
|
||||||
|
mCurrCtrlNormalSel = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Remove 'this' registered as selection listener for the spellcheck
|
// Remove 'this' registered as selection listener for the spellcheck
|
||||||
// selection.
|
// selection.
|
||||||
Selection* spellSel =
|
nsCOMPtr<nsISelection> spellSel = do_QueryReferent(mCurrCtrlSpellSel);
|
||||||
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
if (spellSel) {
|
||||||
spellSel->RemoveSelectionListener(this);
|
spellSel->AsSelection()->RemoveSelectionListener(this);
|
||||||
|
mCurrCtrlSpellSel = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -78,24 +72,26 @@ SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm)
|
||||||
// the current focus.
|
// the current focus.
|
||||||
ClearControlSelectionListener();
|
ClearControlSelectionListener();
|
||||||
|
|
||||||
mCurrCtrlFrame = aFocusedElm->GetPrimaryFrame();
|
nsIFrame* controlFrame = aFocusedElm->GetPrimaryFrame();
|
||||||
if (!mCurrCtrlFrame)
|
if (!controlFrame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
|
const nsFrameSelection* frameSel = controlFrame->GetConstFrameSelection();
|
||||||
NS_ASSERTION(frameSel, "No frame selection for focused element!");
|
NS_ASSERTION(frameSel, "No frame selection for focused element!");
|
||||||
if (!frameSel)
|
if (!frameSel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Register 'this' as selection listener for the normal selection.
|
// Register 'this' as selection listener for the normal selection.
|
||||||
Selection* normalSel =
|
nsCOMPtr<nsISelection> normalSel =
|
||||||
frameSel->GetSelection(nsISelectionController::SELECTION_NORMAL);
|
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.
|
// Register 'this' as selection listener for the spell check selection.
|
||||||
Selection* spellSel =
|
nsCOMPtr<nsISelection> spellSel =
|
||||||
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
frameSel->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
|
||||||
spellSel->AddSelectionListener(this);
|
spellSel->AsSelection()->AddSelectionListener(this);
|
||||||
|
mCurrCtrlSpellSel = do_GetWeakReference(spellSel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -120,10 +120,11 @@ protected:
|
||||||
void ProcessSelectionChanged(SelData* aSelData);
|
void ProcessSelectionChanged(SelData* aSelData);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Currently focused control.
|
|
||||||
nsWeakFrame mCurrCtrlFrame;
|
|
||||||
int32_t mCaretOffset;
|
int32_t mCaretOffset;
|
||||||
HyperTextAccessible* mAccWithCaret;
|
HyperTextAccessible* mAccWithCaret;
|
||||||
|
// Currently focused controls.
|
||||||
|
nsWeakPtr mCurrCtrlNormalSel;
|
||||||
|
nsWeakPtr mCurrCtrlSpellSel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace a11y
|
} // namespace a11y
|
||||||
|
|
|
@ -145,7 +145,7 @@ XULTreeAccessible::Value(nsString& aValue)
|
||||||
void
|
void
|
||||||
XULTreeAccessible::Shutdown()
|
XULTreeAccessible::Shutdown()
|
||||||
{
|
{
|
||||||
if (!mDoc->IsDefunct()) {
|
if (mDoc && !mDoc->IsDefunct()) {
|
||||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ NS_IMPL_RELEASE_INHERITED(XULTreeGridRowAccessible,
|
||||||
void
|
void
|
||||||
XULTreeGridRowAccessible::Shutdown()
|
XULTreeGridRowAccessible::Shutdown()
|
||||||
{
|
{
|
||||||
if (!mDoc->IsDefunct()) {
|
if (mDoc && !mDoc->IsDefunct()) {
|
||||||
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
UnbindCacheEntriesFromDocument(mAccessibleCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user