Get rid of member variables of `TextEditRules`
Categories
(Core :: DOM: Editor, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(6 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
As far as I've investigated, TextEditRules
needs only mTextEditor
, mData
and mIsHTMLEditRules
. We can remove or move the other member variables.
Assignee | ||
Comment 1•5 years ago
|
||
Despite of their names, TextEditRules::mCachedSelectionNode
and
TextEditRules::mCachedSelectionOffset
are used only for calling
EditorBase::HandleInlineSpellCheck()
so that they should be renamed to
explain the purpose.
Additionally, they are not necessary to be in the heap since they are
necessary until TextEditRules::AfterEdit()
is called. Therefore, we can
move them into EditorBase::HandleInlineSpellCheck()
.
Finally, TextEditRules::BeforeEdit()
and TextEditRules::AfterEdit()
are
called only by TextEditor::OnStartToHandleTopLevelEditSubAction()
and
TextEditor::OnEndHandlingTopLevelEditSubAction()
. Therefore, we can move
the setter to TextEditor::OnStartToHandleTopLevelEditSubAction()
.
Assignee | ||
Comment 2•5 years ago
|
||
TextEditRules::BeforeEdit()
, TextEditRules::AfterEdit()
,
HTMLEditRules::BeforeEdit()
and HTMLEditRules::AfterEdit()
manages
TextEditRules::mActionNesting
for preventing that they won't do same thing
per top-level edit sub-action. However, this has already been checked by
their caller, AutoTopLevelEditSubActionNotifier
. So, we can get rid of it.
Then, TextEditRules::mTopLevelEditSubAction
is also always same as
EditorBase::GetTopLevelEditSubAction()
. Therefore, we can get rid of it
too.
Assignee | ||
Comment 3•5 years ago
|
||
TextEditRules::mLockRulesSniffing
is set by AutoLockRulesSniffing
.
It's created during BeforeEdit()
and AfterEdit()
are called, and
HTMLEditRules::Init()
is initializing mDocChangeRange
.
The purpose of it is, preventing BeforeEdit()
and AfterEdit()
to do
something in that time. For the former cases, we don't need this member
anymore since they won't be nested. Therefore, we need to manage
HTMLEditRules::BeforeEdit()
and HTMLEditRules::AfterEdit()
won't do
anything only while HTMLEditRules::Init()
is called. Therefore,
there should be only HTMLEditRules::mInitialized
instead.
Assignee | ||
Comment 4•5 years ago
|
||
TextEditRules::BeforeEdit()
, TextEditRules::AfterEdit()
,
HTMLEditRules::BeforeEdit()
and HTMLEditRules::AfterEdit()
are always
called with same values as the result of
EditorBase::GetTopLevelEditSubAction()
and
EditorBase::GetDirectionOfTopLevelEditSubAction()
.
For making what they do clearer, we should make them access with those
EditorBase
members for now. This makes those methods ugly due to increasing
number of long lines. However, this issue should be solved when we move them
into TextEditor
and HTMLEditor
.
Assignee | ||
Comment 5•5 years ago
|
||
TextEditRules::mDeleteBidiImmediately
is cache of
bidi.edit.delete_immediately
pref value at creation time of TextEditRules
.
However, this is referred when user removes selection. So, there is no
reason to keep same behavior starting from editor creation. In other words,
it must be better to take same behavior in all editor instances.
Therefore, we should remove it and the pref value should be referred directly
when user tries to remove selection.
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
TextEditRules::mDidExplicitlySetInterline
is set to true only by
HTMLEditRules
, but TextEditRules::DidDeleteSelection()
refers it.
So, it's enough to make TextEditRules::DidDeleteSelection()
take the
value and we can move it into HTMLEditRules
.
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cbd6bace05dc
https://hg.mozilla.org/mozilla-central/rev/3f5493ec4852
https://hg.mozilla.org/mozilla-central/rev/f2bd71ff0ca3
https://hg.mozilla.org/mozilla-central/rev/f83db3bd9f6f
https://hg.mozilla.org/mozilla-central/rev/1f06af74eb39
https://hg.mozilla.org/mozilla-central/rev/a3c7baabe15e
Description
•