зеркало из https://github.com/mozilla/pjs.git
Bug 751497 - replace nsHTMLSelectOptionAccessible::GetSelectState by nice inline, r=surkov, f=hub
This commit is contained in:
Родитель
a6c3e1d6f6
Коммит
fcae4144fb
|
@ -265,9 +265,12 @@ nsHTMLSelectOptionAccessible::NativeState()
|
|||
// because we don't want EDITABLE or SELECTABLE_TEXT
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
PRUint64 selectState = 0;
|
||||
nsIContent* selectContent = GetSelectState(&selectState);
|
||||
if (!selectContent || selectState & states::INVISIBLE)
|
||||
nsAccessible* select = GetSelect();
|
||||
if (!select)
|
||||
return state;
|
||||
|
||||
PRUint64 selectState = select->State();
|
||||
if (selectState & states::INVISIBLE)
|
||||
return state;
|
||||
|
||||
// Focusable and selectable
|
||||
|
@ -391,30 +394,6 @@ nsHTMLSelectOptionAccessible::ContainerWidget() const
|
|||
return mParent && mParent->IsListControl() ? mParent : nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: private methods
|
||||
|
||||
nsIContent*
|
||||
nsHTMLSelectOptionAccessible::GetSelectState(PRUint64* aState)
|
||||
{
|
||||
*aState = 0;
|
||||
|
||||
nsIContent* selectNode = mContent;
|
||||
while (selectNode && selectNode->Tag() != nsGkAtoms::select) {
|
||||
selectNode = selectNode->GetParent();
|
||||
}
|
||||
|
||||
if (selectNode) {
|
||||
nsAccessible* select = mDoc->GetAccessible(selectNode);
|
||||
if (select) {
|
||||
*aState = select->State();
|
||||
return selectNode;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptGroupAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -133,11 +133,17 @@ public:
|
|||
private:
|
||||
|
||||
/**
|
||||
* Get Select element's accessible state
|
||||
* @param aState, Select element state
|
||||
* @return Select element content, returns null if not avaliable
|
||||
* Return a select accessible the option belongs to if any.
|
||||
*/
|
||||
nsIContent* GetSelectState(PRUint64* aState);
|
||||
nsAccessible* GetSelect() const
|
||||
{
|
||||
if (mParent && mParent->IsListControl()) {
|
||||
nsAccessible* combobox = mParent->Parent();
|
||||
return combobox && combobox->IsCombobox() ? combobox : mParent.get();
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a combobox accessible the option belongs to if any.
|
||||
|
@ -146,7 +152,7 @@ private:
|
|||
{
|
||||
if (mParent && mParent->IsListControl()) {
|
||||
nsAccessible* combobox = mParent->Parent();
|
||||
return combobox->IsCombobox() ? combobox : nsnull;
|
||||
return combobox && combobox->IsCombobox() ? combobox : nsnull;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
|
Загрузка…
Ссылка в новой задаче