Closed Bug 1360154 Opened 8 years ago Closed 8 years ago

nsIPlaintextEditor might have to have hasText property for UpdateOverlayTextVisibility

Categories

(Core :: DOM: Editor, enhancement)

55 Branch
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

Now, nsTextEditState::GetValue uses TextEditor::OutputToString to get current value when editor has focus. nsTextEditState::UpdateOverlayTextVisibility uses this to check whether current value is empty. I think that OutputToString is expensive whether value is empty or not. So nsIPlainEditor might have to have hasText property for this.
Summary: nsIPlainEditor might have to have hasText property for UpdateOverlayTextVisibility → nsIPlaintextEditor might have to have hasText property for UpdateOverlayTextVisibility
HTMLInputElement::IsValueEmpty might require it since element::UpdateState uses nsTextEditState::GetValue to check empty string.
Blocks: 1346723
Comment on attachment 8866635 [details] Bug 1360154 - Part 1. DocumentIsBody should return bool, not nsresult. https://reviewboard.mozilla.org/r/138238/#review141436
Attachment #8866635 - Flags: review?(masayuki) → review+
Comment on attachment 8866636 [details] Bug 1360154 - Part 2. Add fast path to check whether valus is emtpy. https://reviewboard.mozilla.org/r/138240/#review141438 ::: dom/html/nsTextEditorState.h:184 (Diff revision 1) > // not changed the cursor won't move. > eSetValue_MoveCursorToEndIfValueChanged = 1 << 3, > }; > MOZ_MUST_USE bool SetValue(const nsAString& aValue, uint32_t aFlags); > void GetValue(nsAString& aValue, bool aIgnoreWrap) const; > + bool HasValue(); HasValue() is unclear to me. I think that HasNonEmptyValue(), IsEmpty() or something is better.
Attachment #8866636 - Flags: review?(masayuki) → review+
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/autoland/rev/b508ea403285 Part 1. DocumentIsBody should return bool, not nsresult. r=masayuki https://hg.mozilla.org/integration/autoland/rev/fab114e7628c Part 2. Add fast path to check whether valus is emtpy. r=masayuki
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Assignee: nobody → m_kato
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: