mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 852804 - a11y::SelectionManager shouldn't hold a strong ref to focused element, r=tbsaunde
This commit is contained in:
parent
baa3b6d269
commit
b6bb324e88
@ -154,6 +154,10 @@ FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
|
||||
DocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(DOMDoc);
|
||||
if (document) {
|
||||
// Clear selection listener for previously focused element.
|
||||
if (targetNode->IsElement())
|
||||
SelectionMgr()->ClearControlSelectionListener();
|
||||
|
||||
document->HandleNotification<FocusManager, nsINode>
|
||||
(this, &FocusManager::ProcessDOMFocus, DOMDoc);
|
||||
}
|
||||
|
@ -36,17 +36,13 @@ SelectionManager::Shutdown()
|
||||
void
|
||||
SelectionManager::ClearControlSelectionListener()
|
||||
{
|
||||
if (!mCurrentControl)
|
||||
if (!mCurrCtrlFrame)
|
||||
return;
|
||||
|
||||
nsIFrame* frame = mCurrentControl->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
mCurrentControl = nullptr;
|
||||
|
||||
const nsFrameSelection* frameSel = frame->GetConstFrameSelection();
|
||||
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
|
||||
NS_ASSERTION(frameSel, "No frame selection for the element!");
|
||||
|
||||
mCurrCtrlFrame = nullptr;
|
||||
if (!frameSel)
|
||||
return;
|
||||
|
||||
@ -70,14 +66,13 @@ SelectionManager::SetControlSelectionListener(dom::Element* aFocusedElm)
|
||||
// the current focus.
|
||||
ClearControlSelectionListener();
|
||||
|
||||
mCurrentControl = aFocusedElm;
|
||||
mLastTextAccessible = nullptr;
|
||||
|
||||
nsIFrame* frame = aFocusedElm->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
mCurrCtrlFrame = aFocusedElm->GetPrimaryFrame();
|
||||
if (!mCurrCtrlFrame)
|
||||
return;
|
||||
|
||||
const nsFrameSelection* frameSel = frame->GetConstFrameSelection();
|
||||
const nsFrameSelection* frameSel = mCurrCtrlFrame->GetConstFrameSelection();
|
||||
NS_ASSERTION(frameSel, "No frame selection for focused element!");
|
||||
if (!frameSel)
|
||||
return;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_a11y_SelectionManager_h__
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISelectionListener.h"
|
||||
|
||||
class nsIContent;
|
||||
@ -101,7 +102,7 @@ protected:
|
||||
|
||||
private:
|
||||
// Currently focused control.
|
||||
nsCOMPtr<nsIContent> mCurrentControl;
|
||||
nsWeakFrame mCurrCtrlFrame;
|
||||
|
||||
// Info for the the last selection event.
|
||||
// If it was on a control, then its control's selection. Otherwise, it's for
|
||||
|
Loading…
Reference in New Issue
Block a user