зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1786963 - Make cached TextBounds return rect of whole input if it is empty. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D155513
This commit is contained in:
Родитель
23b2e332ed
Коммит
ab16248fa6
|
@ -183,8 +183,14 @@ LayoutDeviceIntRect HyperTextAccessibleBase::CharBounds(int32_t aOffset,
|
|||
LayoutDeviceIntRect HyperTextAccessibleBase::TextBounds(int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
uint32_t aCoordType) {
|
||||
if (CharacterCount() == 0 ||
|
||||
(aEndOffset > -1 && aStartOffset >= aEndOffset)) {
|
||||
LayoutDeviceIntRect result;
|
||||
if (CharacterCount() == 0) {
|
||||
result = Acc()->Bounds();
|
||||
nsAccUtils::ConvertScreenCoordsTo(&result.x, &result.y, aCoordType, Acc());
|
||||
return result;
|
||||
}
|
||||
|
||||
if (aEndOffset > -1 && aStartOffset >= aEndOffset) {
|
||||
return LayoutDeviceIntRect();
|
||||
}
|
||||
|
||||
|
@ -204,7 +210,6 @@ LayoutDeviceIntRect HyperTextAccessibleBase::TextBounds(int32_t aStartOffset,
|
|||
endPoint = endPoint.FindBoundary(nsIAccessibleText::BOUNDARY_CHAR,
|
||||
eDirPrevious, false);
|
||||
|
||||
LayoutDeviceIntRect result;
|
||||
if (endPoint == currPoint) {
|
||||
result = currPoint.CharBounds();
|
||||
nsAccUtils::ConvertScreenCoordsTo(&result.x, &result.y, aCoordType, Acc());
|
||||
|
|
|
@ -20,6 +20,14 @@ async function runTests(browser, accDoc) {
|
|||
[x, y, width, height],
|
||||
COORDTYPE_SCREEN_RELATIVE
|
||||
);
|
||||
// A 0 range should return an empty rect.
|
||||
testTextBounds(
|
||||
hyperTextNode,
|
||||
0,
|
||||
0,
|
||||
[0, 0, 0, 0],
|
||||
COORDTYPE_SCREEN_RELATIVE
|
||||
);
|
||||
}
|
||||
|
||||
async function testEmptyInputNode(id) {
|
||||
|
@ -33,6 +41,8 @@ async function runTests(browser, accDoc) {
|
|||
[x, y, width, height],
|
||||
COORDTYPE_SCREEN_RELATIVE
|
||||
);
|
||||
// A 0 range in an empty input should still return
|
||||
// rect of input node.
|
||||
testTextBounds(
|
||||
inputNode,
|
||||
0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче