зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1825054 - Don't get stuck in endless loop when getting bounds. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D173864
This commit is contained in:
Родитель
78935b829e
Коммит
545741bece
|
@ -1782,7 +1782,9 @@ LayoutDeviceIntRect TextLeafRange::Bounds() const {
|
|||
nsIAccessibleText::BOUNDARY_LINE_START, eDirNext);
|
||||
TextLeafPoint lastPointInLine = lineStartPoint.FindBoundary(
|
||||
nsIAccessibleText::BOUNDARY_CHAR, eDirPrevious);
|
||||
if (mEnd <= lastPointInLine) {
|
||||
// If currPoint is the end of the document, lineStartPoint will be equal
|
||||
// to currPoint and we would be in an endless loop.
|
||||
if (lineStartPoint == currPoint || mEnd <= lastPointInLine) {
|
||||
lastPointInLine = mEnd;
|
||||
locatedFinalLine = true;
|
||||
}
|
||||
|
|
|
@ -378,3 +378,22 @@ addAccessibleTask(
|
|||
is(str, "hello", "Left word at start of input should be right word");
|
||||
}
|
||||
);
|
||||
|
||||
addAccessibleTask(`<p id="p">hello world</p>`, async (browser, accDoc) => {
|
||||
let macDoc = accDoc.nativeInterface.QueryInterface(
|
||||
Ci.nsIAccessibleMacInterface
|
||||
);
|
||||
|
||||
let p = getNativeInterface(accDoc, "p");
|
||||
let range = macDoc.getParameterizedAttributeValue(
|
||||
"AXTextMarkerRangeForUIElement",
|
||||
p
|
||||
);
|
||||
|
||||
let bounds = macDoc.getParameterizedAttributeValue(
|
||||
"AXBoundsForTextMarkerRange",
|
||||
range
|
||||
);
|
||||
|
||||
ok(bounds.origin && bounds.size, "Returned valid bounds");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче