bug 886208 - don't force editor creation in HyperTextAccessible::NativeState() r=surkov

This commit is contained in:
Trevor Saunders 2013-12-20 11:53:58 -05:00
parent 2808193d74
commit 417617ecf2
2 changed files with 28 additions and 4 deletions

View File

@ -27,6 +27,7 @@
#include "nsIPersistentProperties2.h"
#include "nsIScrollableFrame.h"
#include "nsIServiceManager.h"
#include "nsITextControlElement.h"
#include "nsTextFragment.h"
#include "mozilla/Selection.h"
#include "mozilla/MathAlgorithms.h"
@ -102,8 +103,19 @@ HyperTextAccessible::NativeState()
{
uint64_t states = AccessibleWrap::NativeState();
nsCOMPtr<nsIEditor> editor = GetEditor();
if (editor) {
nsCOMPtr<nsITextControlElement> textControl = do_QueryInterface(mContent);
bool editable = !!textControl;
Accessible* hyperText = this;
while (!editable && hyperText) {
if (hyperText->IsHyperText())
editable = hyperText->GetNode()->IsEditable();
if (hyperText->IsDoc())
break;
hyperText = hyperText->Parent();
}
if (editable) {
states |= states::EDITABLE;
} else if (mContent->Tag() == nsGkAtoms::article) {

View File

@ -733,17 +733,29 @@
states: STATE_PROTECTED,
extraStates: EXT_STATE_EDITABLE,
actions: "activate",
children: [ ]
children: [
{
role: ROLE_TEXT_LEAF
}
]
};
testElm("input_password", obj);
ok(getAccessible("input_password").firstChild.name != "44",
"text leaf for password shouldn't have its real value as its name!");
obj = {
role: ROLE_PASSWORD_TEXT,
states: STATE_PROTECTED | STATE_READONLY,
actions: "activate",
children: [ ]
children: [
{
role: ROLE_TEXT_LEAF
}
]
};
testElm("input_password_readonly", obj);
ok(getAccessible("input_password_readonly").firstChild.name != "44",
"text leaf for password shouldn't have its real value as its name!");
//////////////////////////////////////////////////////////////////////////
// HTML:input@type="radio"