зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1901457 part 4: Implement ITextProvider::get_SupportedTextSelection. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D214344
This commit is contained in:
Родитель
89e51400b5
Коммит
82324325a3
|
@ -4,6 +4,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
const SupportedTextSelection_None = 0;
|
||||
const SupportedTextSelection_Multiple = 2;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
/**
|
||||
* Test the Text pattern's DocumentRange property. This also tests where the
|
||||
* Text pattern is exposed.
|
||||
|
@ -662,3 +667,40 @@ addUiaTask(
|
|||
is(await runPython(`range.GetText(-1)`), "i", "range text correct");
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Test the Text pattern's SupportedTextSelection property.
|
||||
*/
|
||||
addUiaTask(
|
||||
`
|
||||
<style>
|
||||
body {
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
<input id="input">
|
||||
`,
|
||||
async function testTextSupportedTextSelection() {
|
||||
let result = await runPython(`
|
||||
global doc
|
||||
doc = getDocUia()
|
||||
input = findUiaByDomId(doc, "input")
|
||||
text = getUiaPattern(input, "Text")
|
||||
return text.SupportedTextSelection
|
||||
`);
|
||||
is(
|
||||
result,
|
||||
SupportedTextSelection_Multiple,
|
||||
"input SupportedTextSelection correct"
|
||||
);
|
||||
// The IA2 -> UIA bridge doesn't understand that text isn't selectable in
|
||||
// this document.
|
||||
if (gIsUiaEnabled) {
|
||||
is(
|
||||
await runPython(`getUiaPattern(doc, "Text").SupportedTextSelection`),
|
||||
SupportedTextSelection_None,
|
||||
"doc SupportedTextSelection correct"
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "UiaText.h"
|
||||
|
||||
#include "ia2AccessibleHypertext.h"
|
||||
#include "mozilla/a11y/States.h"
|
||||
#include "TextLeafRange.h"
|
||||
#include "UiaTextRange.h"
|
||||
|
||||
|
@ -67,5 +68,17 @@ UiaText::get_DocumentRange(__RPC__deref_out_opt ITextRangeProvider** aRetVal) {
|
|||
STDMETHODIMP
|
||||
UiaText::get_SupportedTextSelection(
|
||||
__RPC__out enum SupportedTextSelection* aRetVal) {
|
||||
return E_NOTIMPL;
|
||||
if (!aRetVal) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
Accessible* acc = Acc();
|
||||
if (!acc) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
if (acc->State() & states::SELECTABLE_TEXT) {
|
||||
*aRetVal = SupportedTextSelection_Multiple;
|
||||
} else {
|
||||
*aRetVal = SupportedTextSelection_None;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче