Bug 1366250, don't flush layout when calling element.focus() on already focused element. Ensure layout is flushed after changing input.type, r=ehsan

This commit is contained in:
Olli Pettay
2017-05-19 23:20:48 +03:00
parent 8937ee90df
commit 92e7031a10
5 changed files with 53 additions and 2 deletions

View File

@@ -4925,6 +4925,14 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
uint8_t oldType = mType;
MOZ_ASSERT(oldType != aNewType);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
// Input element can represent very different kinds of UIs, and we may
// need to flush styling even when focusing the already focused input
// element.
fm->NeedsFlushBeforeEventHandling(this);
}
if (aNewType == NS_FORM_INPUT_FILE || oldType == NS_FORM_INPUT_FILE) {
if (aNewType == NS_FORM_INPUT_FILE) {
mFileData.reset(new FileData());