Bug 1611661 - Give nsNumberControlFrame a TextInput type. r=mats

LayoutFrameType::NumberControl is unused, and nsNumberControlFrame inherits now
from nsTextControlFrame. There are three places that check for
LayoutFrameType::TextInput. Two direct ones:

 * ShouldApplyOverflowCLipping
 * nsFontInflationData

And one indirect via IsTextInputFrame, the one mentioned in comment 2. For all
those three, it makes sense for nsNumberControlFrame to be handled in the same
way as nsTextControlFrame.

Long term we may want to get rid of the concept of frame types and just use
queryFrame or some sugar of that sort, as it's error prone. But for now this
fixes the bug.

Differential Revision: https://phabricator.services.mozilla.com/D61088

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-01-28 21:10:26 +00:00
Родитель d81e89c89a
Коммит 78ba77f68b
5 изменённых файлов: 46 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,18 @@
<!doctype html>
<html class="reftest-wait">
<title>Test reference</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<div>
<input type="number" value="33">
</div>
<script>
SimpleTest.waitForFocus(function() {
document.querySelector('input').focus();
requestAnimationFrame(function() {
// Move after the 3
synthesizeKey("KEY_ArrowRight");
document.documentElement.className = "";
});
});
</script>

Просмотреть файл

@ -0,0 +1,23 @@
<!doctype html>
<html class="reftest-wait">
<title>Can edit input type=number with a user-select: none ancestor</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<div style="user-select: none">
<input type="number" value="322223">
</div>
<script>
SimpleTest.waitForFocus(function() {
document.querySelector('input').focus();
requestAnimationFrame(function() {
// Move after the 3
synthesizeKey("KEY_ArrowRight");
// Select "2222"
for (let i = 0; i < 4; ++i)
synthesizeKey("KEY_ArrowRight", { shiftKey: true });
// Rip it off.
synthesizeKey("KEY_Delete");
document.documentElement.removeAttribute("class");
});
});
</script>

Просмотреть файл

@ -357,6 +357,8 @@ support-files =
bug1550869-2-ref.html
bug1591282-1.html
bug1591282-1-ref.html
bug1611661.html
bug1611661-ref.html
image_rgrg-256x256.png
input-invalid-ref.html
input-maxlength-invalid-change.html

Просмотреть файл

@ -385,6 +385,8 @@ if (navigator.platform.includes("Linux")) {
[ 'bug1524266-3.html' , 'bug1524266-2-ref.html' ] ,
// Tries to select and delete non-editable content in a user-select subtree.
[ 'bug1524266-4.html' , 'bug1524266-2-ref.html' ] ,
// Tries to edit an <input type="number"> with arrows inside a user-select: none element.
[ 'bug1611661.html' , 'bug1611661-ref.html' ] ,
function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled_on_touch']]}, nextTest);} ,
]);
}

Просмотреть файл

@ -76,7 +76,7 @@ FRAME_CLASSES = [
Frame("nsMenuFrame", "Menu", NOT_LEAF),
Frame("nsMenuPopupFrame", "MenuPopup", DYNAMIC_LEAF),
Frame("nsMeterFrame", "Meter", LEAF),
Frame("nsNumberControlFrame", "NumberControl", LEAF),
Frame("nsNumberControlFrame", "TextInput", LEAF),
Frame("nsPluginFrame", "Object", LEAF),
Frame("nsPageBreakFrame", "PageBreak", LEAF),
Frame("nsPageContentFrame", "PageContent", NOT_LEAF),