Граф коммитов

50 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez f8df240e86 Bug 1776909 - Simplify TextControlState reuse. r=smaug
Bug 1776896 happened because we have manual code to cleanup every member
for reuse. Instead, reuse the individual block of memory and use the
destructor to clean up.

Differential Revision: https://phabricator.services.mozilla.com/D150489
2022-06-28 20:34:44 +00:00
Emilio Cobos Álvarez 569a522d01 Bug 1771806 - Record last interactive value in TextControlState. r=masayuki
One unfortunate-ish thing of storing it in TextControlState is that we
can't preserve it across type changes, but that seems ok for now
according to my conversations with Serg.

In the future we might want to move the value to HTMLInputElement itself
or something, we'll see, but this should help folks fix some
long-standing quality issues in the password manager / autofill
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D150148
2022-06-28 08:49:12 +00:00
Emilio Cobos Álvarez 9e7c428de0 Bug 1776238 - Pack TextControlState a bit better. r=masayuki
I've confirmed that with this we can add a new string without going over
the current limit of 128 bytes here:

  https://searchfox.org/mozilla-central/rev/6d0ba065e3d41822337c708c8c0aca334ddd9218/dom/html/TextControlState.cpp#1426

Differential Revision: https://phabricator.services.mozilla.com/D150145
2022-06-24 05:41:01 +00:00
Masayuki Nakano 0b53199bb0 Bug 1676702 - part 3: Make `TextControlState` store unmasked range while it does not have `TextEditor` r=m_kato
`TextControlState` is alive during reframing, but `TextEditor` is not so.
Therefore, `TextControlState` should take the `PasswordMaskData` before
`TextEditor` is destroyed.  And if `TextEditor` is recreated, and the value
hasn't been modified, unmasked range should be restored in the new editor.

Depends on D118757

Differential Revision: https://phabricator.services.mozilla.com/D118758
2021-06-28 04:37:54 +00:00
Masayuki Nakano 63d372da2f Bug 1676702 - part 2: Make `TextControlState` initialize `TextEditor` with `PasswordMaskData` r=m_kato
During a `TextControlState` alive, `PasswordMaskData` should be alive too.
Otherwise, we cannot keep unmasked range at reframing.

Depends on D118756

Differential Revision: https://phabricator.services.mozilla.com/D118757
2021-06-28 04:37:54 +00:00
Kagami Sascha Rosylight 1638851116 Bug 1712255 - Defer SetMaxLength in SetValueFromSetRangeText r=masayuki
Capping selection range in SetValue early makes the subsequent SetSelectionRange call unable to detect actual selection range change. This patch defers it so that select events can be consistently fired.

Differential Revision: https://phabricator.services.mozilla.com/D115729
2021-05-24 03:11:27 +00:00
Emilio Cobos Álvarez 678b10493d Bug 1698315 - Manage placeholder and autofill preview visibility using CSS rather than custom code. r=masayuki
Should be much simpler and doesn't need to deal with the different
stuff. We already have pseudo-classes for this, :autofill and
:placeholder-shown.

I initially wrote this because this is the only limitation that forces
us to have the placeholder text as a direct child of the text control
frame. In the end I kept that as-is, but this simplification is still
worth it.

We remove dom.placeholder.show_on_focus because it doesn't behave
correctly (it doesn't match the :placeholder-shown pseudo-class and it
should). It was introduced in bug 807613 and never turned to false by
default. I suspect nobody will miss this, but if somebody complains
about it we can reintroduce it properly (handling the pref in DOM
instead, changing the right state bits).

Differential Revision: https://phabricator.services.mozilla.com/D108304
2021-03-15 08:52:43 +00:00
Chris Peterson 2d4ca059e8 Bug 1691889 - Replace MOZ_MUST_USE with [[nodiscard]] in dom/. r=peterv
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction.

Differential Revision: https://phabricator.services.mozilla.com/D107355
2021-03-10 08:19:25 +00:00
Kagami Sascha Rosylight efd2005f93 Bug 1682313 - Make sure mMaxLength exists in SetSelectionRange r=masayuki
Cloning a textarea element without a dirty value flag does not call SetValue() and thus gets no max length. This makes sure it always gets one before setting selection range.

Differential Revision: https://phabricator.services.mozilla.com/D99734
2020-12-15 02:06:38 +00:00
Kagami Sascha Rosylight 2e396db5f4 Bug 1680951 - Do not scroll when calling select() r=masayuki
This is intended to be a hotfix for the URL bar regression. Ideally there should be a spec or this behavior should be removed completely.

Previously select() scrolled back to the start position before the regression, but this fix does not restore that behavior.

Differential Revision: https://phabricator.services.mozilla.com/D98972
2020-12-09 20:59:17 +00:00
Kagami Sascha Rosylight e724df62d2 Bug 1681615 - Detect selection changes through the setters r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D99291
2020-12-10 12:58:04 +00:00
Masayuki Nakano 81be9a4e86 Bug 1681240 - Make `TextControlState::SetValueFlags` an enum class r=saschanaz
Using integer as a bit field may cause simple mistake and may not be easy
to read, and we have `EnumSet` class which can treat an `enum class` as
a bit flags so that we should make it an `enum class` and use it with the
`EnumSet` class.

Differential Revision: https://phabricator.services.mozilla.com/D99172
2020-12-09 23:34:28 +00:00
Butkovits Atila c405a6ab26 Backed out changeset 29bbd5887d66 (bug 1680951) for failure on browser_blockingCookies.js. CLOSED TREE 2020-12-08 14:46:48 +02:00
Kagami Sascha Rosylight f7757cbe10 Bug 1680951 - Do not scroll when calling select() r=masayuki
This is intended to be a hotfix for the URL bar regression. Ideally there should be a spec or this behavior should be removed completely.

Previously select() scrolled back to the start position before the regression, but this fix does not restore that behavior.

Differential Revision: https://phabricator.services.mozilla.com/D98972
2020-12-08 07:52:07 +00:00
Kagami Sascha Rosylight a8b38a9593 Bug 1680548 - Cache the max length in TextControlState::SelectionProperties r=masayuki
GetValue() is not a cheap operation, and this allows to skip it in SetSelectionRange.

Differential Revision: https://phabricator.services.mozilla.com/D98659
2020-12-05 09:34:59 +00:00
Bogdan Tara a32cbcf59f Backed out changeset b9fa2c214287 (bug 1680548) for multiple mochitest failures 2020-12-05 10:52:56 +02:00
Kagami Sascha Rosylight 551f1c01d0 Bug 1680548 - Cache the max length in TextControlState::SelectionProperties r=masayuki
GetValue() is not a cheap operation, and this allows to skip it in SetSelectionRange.

Differential Revision: https://phabricator.services.mozilla.com/D98659
2020-12-05 07:34:41 +00:00
Mihai Alexandru Michis dbc93934c8 Backed out changeset 651187869807 (bug 1680548) for causing valgrid bustages in nsTextControlFrame. 2020-12-05 03:15:59 +02:00
Kagami Sascha Rosylight 4379c3417b Bug 1680548 - Cache the max length in TextControlState::SelectionProperties r=masayuki
GetValue() is not a cheap operation, and this allows to skip it in SetSelectionRange.

Differential Revision: https://phabricator.services.mozilla.com/D98659
2020-12-04 22:19:33 +00:00
Emilio Cobos Álvarez a0c580e9a2 Bug 1676785 - Simplify XUL special code-path for <input> value setter. r=masayuki
This allows us to remove nsISelectionController.selectAll() and related
code too, and should not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97011
2020-12-02 12:48:41 +00:00
Mihai Alexandru Michis 89a2d40ee0 Backed out changeset 93cf5f317f98 (bug 1676785) for causing mochitest failures in test_input_value_set_preserve_undo.xhtml
CLOSED TREE
2020-12-02 14:05:18 +02:00
Emilio Cobos Álvarez 2b6c54e6c1 Bug 1676785 - Simplify XUL special code-path for <input> value setter. r=masayuki
This allows us to remove nsISelectionController.selectAll() and related
code too, and should not change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D97011
2020-12-02 10:44:25 +00:00
Simon Giesecke f15895390e Bug 1673931 - Avoid including Element.h from header files.
Differential Revision: https://phabricator.services.mozilla.com/D96535

Depends on D96534
2020-11-23 16:08:40 +00:00
Emilio Cobos Álvarez ff61891772 Bug 1653011 - Simplify and make WeakPtr<Derived> usable and compact. r=froydnj,sg,geckoview-reviewers,jgilbert,kvark,snorp
Having two classes in the inheritance chain inherit from SupportsWeakPtr
now won't compile, but you can use WeakPtr<Derived> when any base class
inherits from SupportsWeakPtr.

Differential Revision: https://phabricator.services.mozilla.com/D83674
2020-07-23 14:51:46 +00:00
Emilio Cobos Álvarez 04828e3a4a Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ
This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

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

--HG--
extra : moz-landing-system : lando
2020-03-19 13:18:16 +00:00
Mihai Alexandru Michis 58bc354025 Backed out changeset 9eeee9ec66d9 (bug 253870) for causing failures in browser_bug1261299.js
CLOSED TREE
2020-03-16 22:32:41 +02:00
Emilio Cobos Álvarez 9f28f89085 Bug 253870 - Make disabled form controls selectable. r=masayuki,MarcoZ
This rejiggers a bit the way selection focus is handled so that focusing a
disabled form control with the mouse handles selection properly, and hides the
document selection and so on.

This matches the behavior of other browsers as far as I can tell.

Given now readonly and disabled editors behave the same, we can simplify a bit
the surrounding editor code.

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

--HG--
extra : moz-landing-system : lando
2020-03-16 17:41:07 +00:00
Emilio Cobos Álvarez 5e3adf766b Bug 1401657 - Make editor value changes always notify. r=masayuki
Not doing so is unsound in some cases, see the two referenced bugs.

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

--HG--
extra : moz-landing-system : lando
2020-03-13 02:29:48 +00:00
Emilio Cobos Álvarez ad58a97570 Bug 1616620 - maxlength shouldn't apply to <input type=number>. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D63474

--HG--
extra : moz-landing-system : lando
2020-02-20 15:28:51 +00:00
Emilio Cobos Álvarez 873a349556 Bug 1611701 - Tweak NODE_IS_EDITABLE flag handling for NAC so that it works consistently for <input type=number>. r=bzbarsky,masayuki,whimboo
I thought this would fix <input type=number style="user-select: none">, but
turns out it doesn't.

<input type=number> doesn't have the editor root as a root of the anonymous
subtree, so the current hack wouldn't work, as the anon root wouldn't have the
editable flag. So tweak the code a bit to handle stuff in a simpler way than
setting the flags after the fact, and set the NAC-root flag earlier to avoid
the mOuterWrapper->AppendChildTo(root) call forgetting about root's flags.

I had to tweak one AccessibleCaret test, but that's because it uses <textarea>
with user-select: none, and our behavior there is not particularly sane. It just
happened to work because that test-case also had a bunch of contenteditable
elements, and we stop matching this rule:

  https://searchfox.org/mozilla-central/rev/220a3bd6063fcbe5ca50e88dcabdc7dee0aca448/layout/style/contenteditable.css#22

Because the anonymous div now properly matches :-moz-read-write, which made the
rule apply and the test work. See comment 4 of this bug.

I'll fix this stuff up and add some tests for our behavior here in bug 1611699.

I refactored the dragdrop tests to cover more input types, but I ended up not
being able to use them because they're dependent on the content.

Instead I added an extra test and changed the refactor so that it applies to
<input type=search>, as there's layout work going on in bug 558594, and it'd be
unfortunate to regress this there too.

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

--HG--
extra : moz-landing-system : lando
2020-02-06 22:15:19 +00:00
Emilio Cobos Álvarez cbd110d718 Bug 1611713 - Remove TextControlState::GetParentNumberControl. r=masayuki
Can't return anything useful anymore since bug 981248.

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

--HG--
extra : moz-landing-system : lando
2020-01-27 00:00:09 +00:00
Masayuki Nakano b1bf7e0db4 Bug 1540043 - part 1: Move all constants and methods of `nsIPlaintextEditor` to `nsIEditor` and make `nsIPlaintextEditor` inherit `nsIEditor` r=m_kato
For preparing to remove `nsIPlaintextEditor` interface, this patch moves
all of them to `nsIEditor`, but for avoiding bustage in comm-central, makes
`nsIPlaintextEditor` inherit `nsIEditor` for now (i.e., even with this patch,
script can access old `nsIPlaintextEditor` members with the interface.

In C++ code, this patch moves `SetWrapColumn()`, `InsertTextAsAction()`,
`InsertTextAsSubAction()` and `InsertLineBreakAsSubAction()` because
they do common things between `TextEditor` and `HTMLEditor`.  On the other
hand, this does not move `TextEditor::GetTextLength()` because it's designed
only for `TextEditor`.

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

--HG--
rename : editor/libeditor/tests/test_nsIPlaintextEditor_insertLineBreak.html => editor/libeditor/tests/test_nsIEditor_insertLineBreak.html
extra : moz-landing-system : lando
2020-01-24 08:33:42 +00:00
Masayuki Nakano a2a7b27d8d Bug 1599971 - part 5: Mark `TextControlState::UnbindFromFrame()` as `MOZ_CAN_RUN_SCRIPT` r=m_kato,emilio
Note that `TextControlState::BindToFrame()` may also run script if it's
called without script blocker.  However, it shouldn't occur.  Therefore,
we don't need to mark it `MOZ_CAN_RUN_SCRIPT`, but we should check
script blocker existence with `MOZ_ASSERT`.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 03:04:20 +00:00
Masayuki Nakano c13f925d16 Bug 1599971 - part 4: Mark `TextControlState::GetTextEditor()` as `MOZ_CAN_RUN_SCRIPT` r=m_kato
If `PreareEditor()` returns `NS_OK`, but if the instance is deleted at returning
from it, `GetTextEditor()` will access `mTextEditor`.  Therefore, this patch
makes `PrepareEditor()` return error if the instance is destroyed at its end.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 03:03:31 +00:00
Masayuki Nakano 0b75352ba4 Bug 1599971 - part 3: Mark `nsITextControlFrame::SetSelectionRange()` as `MOZ_CAN_RUN_SCRIPT` r=m_kato
Similar to the previous patch, it may notify selection listeners of native
anonymous tree in `<input>` and `<textarea>` element.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 03:02:53 +00:00
Masayuki Nakano f9203c9b66 Bug 1599971 - part 2: Mark `TextControlState::DeleteOrCacheForReuse()` and `TextControlState::Reuse()` as `MOZ_CAN_RUN_SCRIPT` r=m_kato
They are really complicated and can run script while the instance is being
destroyed.  Therefore, they should have their own `AutoTextControlHandlingState`
as "kungFuDeathGrip".

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

--HG--
extra : moz-landing-system : lando
2019-12-11 03:02:46 +00:00
Masayuki Nakano a26ed4b301 Bug 1599971 - part 1: Mark constructors of `AutoTextControlHandlingState` as `MOZ_CAN_RUN_SCRIPT` r=m_kato
The destructor of `AutoTextControlHandlingState`is marked as
`MOZ_CAN_RUN_SCRIPT`, but it's not checked at build time.  And this does not
need to be created when the method does not run script.  Therefore, we should
mark its constructor as `MOZ_CAN_RUN_SCRIPT` instead since it's stack only
class so that its constructor and destructor are always called from same
method.

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

--HG--
extra : moz-landing-system : lando
2019-12-11 03:01:37 +00:00
Masayuki Nakano 3f7057ece8 Bug 1597679 - part 3: Create methods to compare given string with values of `TextControlState`, `nsTextControlFrame`, `HTMLInputElement` and `HTMLTextAreaElement` r=smaug
For avoiding unnecessary copy of string buffer only for comparing setting
value and current value, especially with `nsAutoString`, this patch
creates `*Equals()` methods for every class.

And also this avoids to call `nsContentUtils::PlatformToDOMLineBreaks()` in
most paths.

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

--HG--
extra : moz-landing-system : lando
2019-11-25 06:35:17 +00:00
Masayuki Nakano 20699e2189 Bug 1597679 - part 2: Make `nsITextControlElement` inherit `nsGenericHTMLFormElementWithState` r=smaug
Sub classes of `nsITextControlElement` are only `HTMLInputElement` and
`HTMLTextAreaElement`. And both base class is
`nsGenericHTMLFormElementWithState`.  Therefore, we can make
`nsITextControlElement` inherit `nsGenericHTMLFormElementWithState` and
make `HTMLInputElement` and `HTMLTextAreaElement` inherit
`nsITextControlElement`.  Then, we can get rid of a lot of QI between
`nsINode`/`nsIContent`/`Element` and `nsITextControlElement` (and note that
some of them in a hot path).

Additionally, this patch renames `nsITextControlElement` to
`mozilla::TextControlElement`.

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

--HG--
rename : dom/html/nsITextControlElement.h => dom/html/TextControlElement.h
extra : moz-landing-system : lando
2019-11-25 06:35:15 +00:00
Masayuki Nakano 384ee1a2e7 Bug 1597679 - part 1: Cache multiple `TextControlState` instances for reuse r=Ehsan
Previously, we cache only one `TextControlState` instance to reuse.  However,
`HTMLTextAreaElement` also started to allocate it in the heap rather than
a part of its instance.  Therefore, we should have more room to cache the
instances for saving the allocation cost.

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

--HG--
extra : moz-landing-system : lando
2019-11-25 06:33:53 +00:00
Coroiu Cristina 84bf2b6d25 Backed out 3 changesets (bug 1597679) for Android debug build bustage at build/src/dom/base/nsContentAreaDragDrop.cpp
Backed out changeset 6a73b58e0db4 (bug 1597679)
Backed out changeset 90a172eff2de (bug 1597679)
Backed out changeset d4a156cf28ff (bug 1597679)

--HG--
rename : dom/html/TextControlElement.h => dom/html/nsITextControlElement.h
2019-11-24 09:02:53 +02:00
Masayuki Nakano 12437404e1 Bug 1597679 - part 3: Create methods to compare given string with values of `TextControlState`, `nsTextControlFrame`, `HTMLInputElement` and `HTMLTextAreaElement` r=smaug
For avoiding unnecessary copy of string buffer only for comparing setting
value and current value, especially with `nsAutoString`, this patch
creates `*Equals()` methods for every class.

And also this avoids to call `nsContentUtils::PlatformToDOMLineBreaks()` in
most paths.

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

--HG--
extra : moz-landing-system : lando
2019-11-24 05:38:16 +00:00
Masayuki Nakano eea1784f2d Bug 1597679 - part 2: Make `nsITextControlElement` inherit `nsGenericHTMLFormElementWithState` r=smaug
Sub classes of `nsITextControlElement` are only `HTMLInputElement` and
`HTMLTextAreaElement`. And both base class is
`nsGenericHTMLFormElementWithState`.  Therefore, we can make
`nsITextControlElement` inherit `nsGenericHTMLFormElementWithState` and
make `HTMLInputElement` and `HTMLTextAreaElement` inherit
`nsITextControlElement`.  Then, we can get rid of a lot of QI between
`nsINode`/`nsIContent`/`Element` and `nsITextControlElement` (and note that
some of them in a hot path).

Additionally, this patch renames `nsITextControlElement` to
`mozilla::TextControlElement`.

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

--HG--
rename : dom/html/nsITextControlElement.h => dom/html/TextControlElement.h
extra : moz-landing-system : lando
2019-11-24 05:38:02 +00:00
Masayuki Nakano efafd8cb17 Bug 1597679 - part 1: Cache multiple `TextControlState` instances for reuse r=Ehsan
Previously, we cache only one `TextControlState` instance to reuse.  However,
`HTMLTextAreaElement` also started to allocate it in the heap rather than
a part of its instance.  Therefore, we should have more room to cache the
instances for saving the allocation cost.

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

--HG--
extra : moz-landing-system : lando
2019-11-24 05:37:26 +00:00
Masayuki Nakano 129b58687c Bug 1588745 - part 6: Post processing of setting value with TextEditor should be done before dispatching "input" event r=Ehsan
Currently, "input" event is fired when the `AutoScriptBlocker` in `SetValue()`
is deleted.  So, for keeping same behavior, the post processing after calling
`TextEditor` methods should be done before editor dispatches "input" event.

Fortunately, `TextInputListener::OnEditActionHandled()` is a good chance to
do that.  Therefore, this patch makes it notify `TextControlState` and
`AutoTextControlHandlingState`.

Note that ideally, each method of `TextEditor` should return
`NS_ERROR_OUT_OF_MEMORY` coming from
`AutoTextControlHandlingState::OnEditActionHandled()`.  However, it requires
a lot of changes in editor classes, and the case is really rare since editor
does not use fallible allocation.  Therefore, it must be okay to crash in
editor if `OnEditActionHandled()` returns `NS_ERROR_OUT_OF_MEMORY`.

Depends on D51395

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

--HG--
extra : moz-landing-system : lando
2019-11-03 02:50:00 +00:00
Masayuki Nakano 4ea46b632e Bug 1588745 - part 5: Split `TextControlState::SetValue()` r=Ehsan
`TextControlState::SetValue()` does 4 things.
1. Committing composition if there is and if possible.
2. Setting value with `TextEditor` if text editor and frame are available.
3. Setting value without `TextEditor` otherwise.
4. Notifying value changed.

We can split #2 and #3 from it now because `AutoTextControlHandlingState`
manages nested actions.  Therefore, this patch creates
`SetValueWithTextEditor()` and `SetValueWithoutTextEditor()` which take
`AutoTextControlHandlingState`.

Depends on D51394

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

--HG--
extra : moz-landing-system : lando
2019-11-02 23:23:54 +00:00
Masayuki Nakano 3b61d80b0e Bug 1588745 - part 4: Make `TextControlState` reuse its instance by itself r=Ehsan
Currently, only `HTMLInputElement` reuses `TextControlState` instance since
`HTMLTextAreaElement` had the instance as a member rather than allocate it.

Now, all instances are allocated in the heap independently for guaranteeing
their lifetime.  So, the reuse mechanism should be managed by
`TextControlState` itself.

Depends on D51393

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

--HG--
extra : moz-landing-system : lando
2019-11-01 20:51:48 +00:00
Masayuki Nakano f3bf8ed506 Bug 1588745 - part 3: Make `TextControlState` not deleted actually while it handles something r=Ehsan
Currently, nobody guarantees that `TextControlState` won't be deleted while
it handles something with `MOZ_CAN_RUN_SCRIPT` methods.

This patch hides its destructor (and constructor) for making only
`TextControlState` itself can delete its instances.  Then, if instance owner
wants to delete it while handling action(s), the oldest `AutoHandlingState`
will delete the `TextControlState`.

Depends on D51392

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

--HG--
extra : moz-landing-system : lando
2019-11-01 20:49:12 +00:00
Masayuki Nakano e2c6cf597d Bug 1588745 - part 2: Move some `TextControlState` members to stack only class r=Ehsan
Some members of `TextControlState` are initialized and restored in same block
scopes.  Therefore, with creating new stack only class and storing latest one
with a new member variable, we can store all of them in the stack.

Depends on D51391

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

--HG--
extra : moz-landing-system : lando
2019-11-01 20:47:35 +00:00
Masayuki Nakano 91b4aa6851 Bug 1588745 - part 1: Rename `nsTextEditorState` to `mozilla::TextControlState` r=Ehsan
It should be in `mozilla` namespace and it manages not only `TextEditor`,
manages selection, selection controller and callback from editor. so that
I think it stores state of "text control widget". Therefore, I name it to
`TextControlState`.

And cleaning up the cpp file.

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

--HG--
rename : dom/html/nsTextEditorState.cpp => dom/html/TextControlState.cpp
rename : dom/html/nsTextEditorState.h => dom/html/TextControlState.h
extra : moz-landing-system : lando
2019-11-01 20:43:11 +00:00