Closed Bug 1360162 Opened 2 years ago Closed 2 years ago

UpdateOverlayTextVisibility is called twice by input.value setter when input element has focus

Categories

(Core :: Editor, enhancement, P3)

55 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

UpdateOverlayTextVisibility uses OutputToString that is expensive.  We should add fast path to check whether empty or not (Bug 1360154).

UpdateOverlayTextVisibility() is called from EditorBase::NotifyEditorObserver() via EndPlaceHolderTransaction().  But nsTextEditorState::SetValue is also called UpdateOverlayTextVisibility() via ValueWasChanged.

So it is unnecessary to call UpdateOverlayTextVisibility when editor already calls UpdateOverlayTextVisibility.
Blocks: 1346723
Priority: -- → P3
Comment on attachment 8880236 [details]
Bug 1360162 - Don't call UpdateOverlayTextVisibility twice by input.value setter when input element has focus.

https://reviewboard.mozilla.org/r/151590/#review156588

::: dom/html/nsTextEditorState.cpp:2696
(Diff revision 1)
>            mTextListener->SetValueChanged(true);
>            mTextListener->SettingValue(false);
> +
> +          if (!notifyValueChanged) {
> +            // Listener doesn't update frame, but it is required for placeholder
> +            ValueWasChanged(true);
> +          }

Hmm, really tricky code... This can be regressed again easily. However, I have no better idea to fix this.
Attachment #8880236 - Flags: review?(masayuki) → review+
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/c36dabb0aba6
Don't call UpdateOverlayTextVisibility twice by input.value setter when input element has focus. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/c36dabb0aba6
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Assignee: nobody → m_kato
You need to log in before you can comment on or make changes to this bug.