зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1547657: Null check frame in HyperTextAccessible::TextBounds. r=MarcoZ
Differential Revision: https://phabricator.services.mozilla.com/D78631
This commit is contained in:
Родитель
58a574a9c2
Коммит
b1c5fca60f
|
@ -1182,7 +1182,11 @@ nsIntRect HyperTextAccessible::TextBounds(int32_t aStartOffset,
|
|||
if (CharacterCount() == 0) {
|
||||
nsPresContext* presContext = mDoc->PresContext();
|
||||
// Empty content, use our own bound to at least get x,y coordinates
|
||||
return GetFrame()->GetScreenRectInAppUnits().ToNearestPixels(
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (!frame) {
|
||||
return nsIntRect();
|
||||
}
|
||||
return frame->GetScreenRectInAppUnits().ToNearestPixels(
|
||||
presContext->AppUnitsPerDevPixel());
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,6 @@ support-files = doc.html
|
|||
[test_passwords.html]
|
||||
[test_selection.html]
|
||||
[test_settext_input_event.html]
|
||||
[test_textBounds.html]
|
||||
[test_wordboundary.html]
|
||||
[test_words.html]
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>TextBounds tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../layout.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest() {
|
||||
// Returned rect should be all 0 if no frame; e.g. display: contents.
|
||||
testTextBounds(
|
||||
"displayContents", 0, 0, [0, 0, 0, 0], COORDTYPE_SCREEN_RELATIVE
|
||||
);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<section id="displayContents" style="display: contents;"></section>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче