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

85 Коммитов

Автор SHA1 Сообщение Дата
Makoto Kato 51d94b9c3f Bug 1358025 - Part 4. Disable undo when input.value setter isn't user interaction. r=masayuki
See bug 1346723.  I would like to turn off undo when not user interaction.  Except to Gecko, other browsers don't create undo history by input.value setter.

MozReview-Commit-ID: 9P1eOKTXCXN

--HG--
extra : rebase_source : 44967a19300827af6187c4f906e09ed09808cd30
2017-05-18 16:32:29 +09:00
Makoto Kato 5b36447061 Bug 1358025 - Part 3. Use nsIEditor.setText when input.value setter isn't user interaction. r=masayuki
When not using eSetValue_BySetUserInput, we should use SetText transaction instead for fast path.  For backward compatibility, when input.value setter is by user interaction, I keep original way.  Because the original way doesn't replace all text when some string matches.

MozReview-Commit-ID: IDm7Y1NBmaK

--HG--
extra : rebase_source : 625085737f5c110dac11f9bc8a38c98a703ce2b1
2017-05-18 16:32:21 +09:00
Masayuki Nakano 6d8d004613 Bug 1339543 part 1 Wrap nsIWidget::ExecuteNativeKeyBinding() with a WidgetKeyboardEvent method and users of the method should use it r=smaug
Currently, edit commands for native key bindings are stored in widget.  This is
stateful and really complicated in content process because it needs to cache
them.

We can make this simpler if we make WidgetKeyboardEvent store edit commands for
the key combination.  Then, child process can handle it even if it's delayed
event or it's a nested event.

This patch adds arrays to WidgetKeyboardEvent to store edit commands which are
initialized with nsIWidget::ExecuteNativeKeyBinding() and adds
WidgetKeyboardEvent::ExecuteEditCommands() to execute stored edit commands as
same as nsIWidget::ExecutenativeKeyBinding().

MozReview-Commit-ID: BGRvBrLz5lp

--HG--
extra : rebase_source : b7ecd704d9c331ca1e0aedc66f230114015b853b
2017-05-19 16:50:30 +09:00
Makoto Kato ae158ad730 Bug 1364814 - Use RAII class to set and restore editor flags. r=masayuki
input.value setter removes editor flags and max-length to set value.  To clean up code, I would like to use RAII class to set and restore it.

Actually, when the frame is being destroyed by InsertText, it isn't restored.  But it might be safe since the flags is set again on nsTextEditorState::PrepareEditor by focus.


MozReview-Commit-ID: J0OYYluWD8z

--HG--
extra : rebase_source : b0489a381cdea76fe98f328cbd88cd18d2576a93
2017-05-15 13:22:25 +09:00
Makoto Kato 66f56b4e7d Bug 1360154 - Part 2. Add fast path to check whether valus is emtpy. r=masayuki
Actually, we use GetValue to check whether value is empty or not for placeholder.  But since GetValue uses TextEditor::OutputToString when on editor, it is expensive.  Since editor has DocumentIsEmpty method, we should use it for this case.

MozReview-Commit-ID: rQX8yjnWQz

--HG--
extra : rebase_source : 25ec89385d704f5c4d2d0a15021c2a59b0201983
2017-05-11 14:04:18 +09:00
Makoto Kato 2b45a511bb Bug 1352799 - Always set maxlength on initializing editor. r=masayuki
maxlength will be set by nsTextControlFrame::AttributeChanged via RestyleManager. If element is display:none, RestyleManager won't call Frame's AttributeChanged. So we should always initialize maxlength when setting focus.

Also, wrap attribute for textarea element will be updated by HTMLTextAreaElement even if display:none.  So this issue doesn't occur.  maxlength might have to be updated by HTMLInputElement.  But it is unnecessary to update editor's maxlength on display:none since this is used on focused editor.

MozReview-Commit-ID: JHODOBTv62v

--HG--
extra : rebase_source : eeabd25f6f7d2802b5a97ae8be225182c6df88de
2017-04-20 10:23:01 +09:00
Boris Zbarsky c11223cba0 Bug 1357206 part 5. When moving the cursor to the end of text on value set, reset the selection direction as well, per spec. r=ehsan 2017-05-01 13:33:09 -04:00
Boris Zbarsky 29d5ae0bfd Bug 1357206 part 4. Don't move the cursor even if eSetValue_MoveCursorToEndIfValueChanged is set, if the value did not change. r=ehsan 2017-05-01 13:28:54 -04:00
Boris Zbarsky ff31c3ca29 Bug 1357206 part 3. Rename eSetValue_MoveCursorToEnd to eSetValue_MoveCursorToEndIfValueChanged, because those are the semantics we want for it. r=ehsan
No actual behavior change here.
2017-05-01 13:26:21 -04:00
Boris Zbarsky 56263453b3 Bug 1357206 part 2. Common up the PlatformToDOMLineBreaks calls for the have-editor and do-not-have-editor cases in nsTextEditorState::SetValue. r=ehsan
At this point both calls happen unconditionally.  This also removes a search for
\r which the callee will perform anyway.
2017-05-01 13:26:18 -04:00
Boris Zbarsky 107496cc39 Bug 1357206 part 1. Move conversion of the new textarea/input value to DOM linebreaks to before we check whether the new value matches the old value. r=ehsan
Otherwise we end up calling into editor code and doing a bunch of work even though the value hasn't actually changed, when a value with \r in it is set repeatedly.
2017-05-01 13:26:11 -04:00
Ray Lin acabd05355 Bug 1340483 - Part 4. Update input visibility accordingly. r=heycam
MozReview-Commit-ID: 7eBhj7w4qhP

--HG--
extra : rebase_source : 3610353fbb4e8d4c1abed57536a0bab3a537b134
2017-03-30 17:38:59 +08:00
Ray Lin 903f54b822 Bug 1340483 - Part 2. Expose chrome-only previewValue attribute. r=baku,heycam
MozReview-Commit-ID: BCu0vXVm6wj

--HG--
extra : rebase_source : 22d67ab3824c0df53daf3e3299a45c17746f62a3
2017-03-21 00:08:01 +08:00
Ray Lin c444b0fb87 Bug 1340483 - Part 1. Create empty anonymous node for autofill preview. r=heycam
MozReview-Commit-ID: GTVgIPoogp9

--HG--
extra : rebase_source : 1dd63792ec76c167473c91bc8dc5ec87cbd93c08
2017-03-20 11:53:40 +08:00
Olli Pettay d5caa7c6c0 Bug 1352687, try to recycle HTMLInputElement's nsTextEditorState, r=baku
--HG--
extra : rebase_source : 05c8dc2bd0c29ce3064548e1cabac2d62803cabc
2017-04-03 20:40:48 +03:00
Olli Pettay d47c995985 Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
--HG--
extra : rebase_source : b7d76ce3321ea0d622da74a72b7278fd0fa63310
2017-03-31 22:49:00 -04:00
Olli Pettay 31b1f5cc92 Backout Bug 1351860, r=backout 2017-03-31 16:55:32 -04:00
Olli Pettay b84c192a09 Bug 1351860 - Move mType from HTMLInputElement to nsIFormControl and make GetType non-virtual inlined, r=jessica
--HG--
extra : rebase_source : 5f2cac2c4e944e2c9f2f1acf0d3064e153c40451
2017-03-31 13:13:36 -04:00
Olli Pettay 02a0f210fa Bug 1346654, follow the COM rules in nsTextInputSelectionImpl, r=ehsan
--HG--
extra : rebase_source : 15f1e22fe3e814c34332b4f9e2ff1f889e3a264d
2017-03-22 12:19:20 +02:00
Boris Zbarsky f80dd7a663 Bug 1345237. Propagate uint32_t deeper into the editor state and text control frame code. r=mystor
MozReview-Commit-ID: KeUo8My6eBJ
2017-03-09 14:44:45 -05:00
Boris Zbarsky 08dd7b769f Bug 1343275 part 1. Get selection faster in some nsTextEditorState methods. r=ehsan
MozReview-Commit-ID: 2v0r3jtua1O
2017-03-09 14:44:10 -05:00
Boris Zbarsky 0cf9adf6a5 Bug 1343037 part 18. Implement nsTextEditorState::SetRangeText. r=ehsan
MozReview-Commit-ID: FEo9yv5iu6U
2017-03-09 14:44:06 -05:00
Boris Zbarsky 060aadda89 Bug 1343037 part 16. Implement a version of nsTextEditorState::SetSelectionRange that takes a string for the direction. r=ehsan
MozReview-Commit-ID: E8zYAWolg94
2017-03-09 14:44:06 -05:00
Boris Zbarsky 0270554a22 Bug 1343037 part 15. Implement nsTextEditorState::GetSelectionDirection. r=ehsan
MozReview-Commit-ID: 1bLLYhjmlff
2017-03-09 14:44:06 -05:00
Boris Zbarsky b72fd0bc98 Bug 1343037 part 14. Implement nsTextEditorState::SetSelectionDirection. r=ehsan
This introduces two behavior changes:

1)  In cached mode, we used to treat unknown selection directions as "none".
    Now we treat it like "forward", consistently with the "have an editor" mode.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionDirection changes.

MozReview-Commit-ID: 4nBCAm3mAiz
2017-03-09 14:44:06 -05:00
Boris Zbarsky e0ef9813e4 Bug 1343037 part 13. Implement nsTextEditorState::SetSelectionEnd. r=ehsan
This introduces three behavior changes:

1)  Before this change, in cached mode, we did not enforce the "start <= end"
    invariant.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionEnd changes.
3)  Changes the IDL type of HTMLInputElement's selectionEnd attribute to
    "unsigned long" to match the spec and HTMLTextareaElement.

MozReview-Commit-ID: J3Gkhr8VnbS
2017-03-09 14:44:05 -05:00
Boris Zbarsky badbeff5ec Bug 1343037 part 12. Implement nsTextEditorState::SetSelectionStart. r=ehsan
This introduces three behavior changes:

1)  Before this change, in cached mode, we did not enforce the "start <= end"
    invariant.
2)  Before this change, in cached mode, we did not fire "select" events on
    selectionStart changes.
3)  Changes the IDL type of HTMLInputElement's selectionStart attribute to
    "unsigned long" to match the spec and HTMLTextareaElement.

MozReview-Commit-ID: JM9XXMMPUHM
2017-03-09 14:44:05 -05:00
Boris Zbarsky 92746e9a48 Bug 1343037 part 11. Implement a SetSelectionRange function on nsTextEditorState. r=ehsan
MozReview-Commit-ID: 5xUkcnkptwQ
2017-03-09 14:44:05 -05:00
Boris Zbarsky a44c859126 Bug 1343037 part 9. Simplify the setup around the editor state's GetSelectionDirection function. r=ehsan
Really, there are only two cases we need to worry about.  Either
IsSelectionCached(), and then our SelectionProperties has the data we want, or
not and then we have a non-null mSelCon which has the data we want.

MozReview-Commit-ID: AEW9D1zG6sM
2017-03-09 14:44:05 -05:00
Boris Zbarsky 5ae7da9d14 Bug 1343037 part 6. Simplify the setup around the editor state's GetSelectionRange function. r=ehsan
Really, there are only two cases we need to worry about.  Either
IsSelectionCached(), and then our SelectionProperties has the data we want, or
not and then we have a non-null mSelCon which has the data we want.

Since we are now using cached selection state a lot more (instead of
initializing the editor whenever someone asks for selection state), we need to
actually update it more correctly when .value is set.

And since we now update the cached selection state for the case when .value has
been set (to point to the end of the text), we need to change
HTMLInputElement::HasCachedSelection to return false for that case.  Otherwise
we will always do eager editor init on value set.  We handle that by not doing
eager init if the cached selection is collapsed.

The web platform test changes test the "update on .value set" behavior.  They
fail without this patch, pass with it.

MozReview-Commit-ID: DDU8U4MGb23
2017-03-09 14:44:04 -05:00
Boris Zbarsky 2bf2020b52 Bug 1343037 part 4. Fix type changes on an input to properly grab the selection offsets from the old editor before we ask the editor state for them. r=ehsan
MozReview-Commit-ID: IDdt0qedJpT
2017-03-09 14:44:04 -05:00
Boris Zbarsky fdab22f79c Bug 1343886. Handle input or textarea elements having a non-textcontrol frame better. r=ehsan
MozReview-Commit-ID: FRzdvTLMAID
2017-03-06 10:29:38 -05:00
Mats Palmgren d13aaf9ce0 Bug 1340771 part 1 - Rename nsWeakFrame to AutoWeakFrame (automated change). r=tn
MozReview-Commit-ID: 8pl4nyeGEkr
2017-03-01 18:03:14 +01:00
Boris Zbarsky d2afbdd254 Bug 1342197 part 4. Move GetSelectionRange from nsTextControlFrame to the editor state. r=ehsan
At this point, all this method does is ensure editor initialization and then ask
the editor state for various information.  Let's cut out the middleman.

MozReview-Commit-ID: p491umScJO
2017-02-28 12:41:37 -05:00
Masayuki Nakano 7436f01057 Bug 564411 Move all methods/attributes of nsIEditorIMESupport to nsIEditor r=smaug
Doing QI from nsIEditor to nsIEditorIMESupport doesn't make sense because editor should always support all methods and attributes of nsIEditorIMESupport (it does NOT mean that all nsIEditor implementation need to support IME).

This patch moves all of them to nsIEditor for avoiding redundant QIs.

MozReview-Commit-ID: DzIKuGHG4iy

--HG--
extra : rebase_source : cc5e9a6ae4572ebe461d9770ffa5c23d33dc8526
2016-12-20 21:47:31 +09:00
Botond Ballo 1a3f01bf7e Bug 1320200 - Propagate scroll-behavior on a text input to the anonymous scrollable <div> inside it. r=tnikkel
MozReview-Commit-ID: Cur3x41wAfU

--HG--
extra : rebase_source : 0db4979a2717d54da258dbd83c6be31fdb6c1537
2016-11-25 19:39:17 -05:00
Michael Layzell c47fca1cd7 Bug 1018486 - Part 1: Changes in dom/, r=baku
MozReview-Commit-ID: 4tCUM4KRe81
2016-09-07 10:50:35 -04:00
Bobby Holley c2cbbe5f56 Bug 1295370 - Stop lazily creating the root node in nsTextEditorState::GetRootFrame. r=ehsan
AFAICT this doesn't change behavior, since all the callers of GetRootNode should
occur after we've already called BindToFrame. However, it makes it easier for
future static analysis to see that we don't trigger node creation from
nsTextControlFrame::AppendAnonymousContentTo.
2016-08-17 12:46:53 -07:00
Decky Coss 08a416fd4e Bug 1283915 - Preserve input selection properties after type change. r=smaug
MozReview-Commit-ID: 7xJKc3vIpTY

--HG--
extra : rebase_source : 6fa36a607efb1e8eec1cc8efbb174d622aa0281f
2016-07-27 11:04:53 -04:00
Nicholas Nethercote e7f10a07fd Bug 1293603 (part 2) - Make Run() declarations consistent. r=erahm.
This patch makes most Run() declarations in subclasses of nsIRunnable have the
same form: |NS_IMETHOD Run() override|.

As a result of these changes, I had to add |override| to a couple of other
functions to satisfy clang's -Winconsistent-missing-override warning.

--HG--
extra : rebase_source : 815d0018b0b13329bb5698c410f500dddcc3ee12
2016-08-08 12:18:10 +10:00
Thomas Wisniewski 30ab766837 Bug 613019 - Track whether the last input/textarea change was done interactively, and enable the commented-out maxLength tracking code. r=mrbkap
--HG--
extra : rebase_source : 59c0986d6184f09f79fcda848de9d822949aa47b
2016-08-06 11:59:08 -04:00
Decky Coss b69450d2ea Bug 1287655 - place textarea/input cursor at end of text when initialized; r=smaug
MozReview-Commit-ID: 2srGXFmla07

--HG--
extra : transplant_source : %3Cn%D30%86%24%82%90%29%191%9C%8A%EB%0D%5D%E2%20%22%E5
2016-07-21 14:52:49 -04:00
Masayuki Nakano 94713accb3 Bug 1260651 part.49 Rename nsTextEditRules to mozilla::TextEditRules (and also their file names) r=mccr8
MozReview-Commit-ID: DzNeLcT1r1e

--HG--
rename : editor/libeditor/nsTextEditRules.cpp => editor/libeditor/TextEditRules.cpp
rename : editor/libeditor/nsTextEditRules.h => editor/libeditor/TextEditRules.h
rename : editor/libeditor/nsTextEditRulesBidi.cpp => editor/libeditor/TextEditRulesBidi.cpp
2016-07-09 11:34:41 +09:00
Masayuki Nakano d960ef26d5 Bug 1278014 part.5 Rename SelectionType::SELECTION_NORMAL to SelectionType::eNormal r=smaug
MozReview-Commit-ID: AAdxTTKEvrk

--HG--
extra : rebase_source : 82e10db6b8b17d4f571625e34bb3c8f1905ef58a
2016-06-09 18:35:22 +09:00
Masayuki Nakano 00591135a4 Bug 1278014 part.2 Define mozilla::SelectionType as an enum class and use it instead of RawSelectionType as far as possible r=smaug
This patch defines mozilla::SelectionType as an enum class.  This is safer than nsISelectionController::SELECTION_* since setting illegal value to its variable is checked at build time.  So, as far as possible, this should be used everywhere (but of course, this isn't available in scriptable interfaces).

And also this implements some useful methods for managing SelectionType and RawSelectionType which are implemented in layout/nsSelection.cpp because nsISelectionController is implemented by both PresShell and nsTextEditorState.  Therefore, implementing one of them may make hard to find them.  On the other hand, nsSelection.cpp is a better file name to look for them.

Note that this patch creates mozilla::Selection::RawType() for binding.  Native code should keep using Selection::Type() but the binding code needs to use RawType() due to impossible to convert from SelectionType to RawSelectionType without explicit cast.

MozReview-Commit-ID: 81vX7A0hHQN

--HG--
extra : rebase_source : d9f88e217c713c60d1c2578ce6421c73ccba8650
2016-06-11 11:06:37 +09:00
Masayuki Nakano 17f667a2e2 Bug 1278014 part.1 Rename SelectionType in nsISelectionController.idl to mozilla::RawSelectionType r=smaug
mozilla::SelectionType will be an enum class. Therefore, we need to rename SelectionType with a word "raw" since it's a type for raw nsISelectionController::SELECTION_*.

MozReview-Commit-ID: K8SO0bbpv0Y

--HG--
extra : rebase_source : 56e3ac852657ef4795d718d2da09b16903c2e66c
2016-06-07 22:42:06 +09:00
Ben Tian 1d3df2ccde Bug 1261499 - Make nsContentUtils::AddScriptRunner return void, r=khuey 2016-05-06 16:09:03 +08:00
Kyle Huey c73656947b Bug 1265927: Move nsRunnable to mozilla::Runnable, CancelableRunnable to mozilla::CancelableRunnable. r=froydnj 2016-04-25 17:23:21 -07:00
Masayuki Nakano 07b6f24132 Bug 1259657 Rename WidgetGUIEvent::widget to WidgetGUIEvent::mWidget r=smaug
MozReview-Commit-ID: 167PQWJDEHW

--HG--
extra : rebase_source : 6cd44095b9f33e03190972f043087786cbd772f2
2016-04-14 17:03:14 +09:00
Nathan Froyd 64fe772d2f Bug 1132499 - part 2 - convert nsTextEditorState::mValue to be an nsString; r=ehsan
I don't know the full history here; roc asked about this exact thing in
bug 534785 when reviewing the creation of nsTextEditorState.  The answer
then was "historical reasons" (the original code is hg@1)...maybe to try
and save some space?  Regardless, since the only thing we do here is
convert from/to incoming/outgoing nsStrings, which at least sometimes
appear to be causing OOMs, we might as well hold it as an nsString all
the time.  This change will ideally eliminate allocations, as we'll be
able to use nsString's buffer sharing underneath the hood.
2016-03-04 10:29:01 -05:00