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

119 Коммитов

Автор SHA1 Сообщение Дата
Kyle Machulis be815f3caf Bug 1412437 - Remove nsIDOMHTMLTextAreaElement; r=bz
MozReview-Commit-ID: JAON7Rd7IAo
2017-11-01 14:28:22 -07:00
Jonathan Watt 60fa0649f2 Bug 1406819 - Remove various bits of dead code from dom/. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D109
2017-10-11 10:09:13 +01:00
Emilio Cobos Álvarez b4949a9204 Bug 1401706: Move ownership of editor anon content to nsTextControlFrame. r=Ehsan
MozReview-Commit-ID: 4QpbarX5dvf
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

--HG--
extra : rebase_source : f2bd73c696bc3e7937a8e6c365c9ef31a6888524
2017-09-22 02:18:30 +02:00
Masayuki Nakano 428b006ab1 Bug 1395146 - part3: nsTextEditorState should cache empty value with mCachedValue r=smaug
nsTextEditorState::GetValue() uses mCachedValue only when the value isn't empty
string.  However, with SetIsVoid() and IsVoid() of nsAString, nsTextEditorState
can cache empty value only with mCachedValue.

MozReview-Commit-ID: AmQDquEn9M8

--HG--
extra : rebase_source : 3acfe765cbe37664ef3e28e640753da240bf38a4
2017-08-30 20:54:45 +09:00
Masayuki Nakano 0356f81706 Bug 1395146 - part2: Make nsTextEditorState cache the value of TextEditor with mCachedValue even when the editor is single line text control r=smaug
Currently, nsTextEditorState caches the value of TextEditor only when it's for
a multi-line text control, i.e., <textarea>.  However, using it for single-line
text control improves the score of attachment 8848015.  Although this might
increase the cost of creating and registering mutation observer, but it may not
make damage to performance of loading pages since editor for each element won't
be initialized until each element gets focus.

MozReview-Commit-ID: DnjEJ5AUh3M

--HG--
extra : rebase_source : 8f45cb57ac03dff9a696acaaa5d0fd35faed0c09
2017-08-30 19:43:00 +09:00
Masayuki Nakano b3c33d13ad Bug 1395146 - part1: Get rid of nsITextControlElement::IsPlainTextControl() and nsTextEditorState::IsPlainTextEditor() r=smaug
nsTextEditorState::GetValue() refers nsITextControlElement::IsPlainTextControl()
via nsTextEditorState::IsPlainTextEditor().  However, it always returns true and
virtual call with QI.  So, we should get rid of these unnecessary methods.

MozReview-Commit-ID: 3gHdGrzlys4

--HG--
extra : rebase_source : a1be33a18e93e64b8cc87e4f12d5e494b14520bf
2017-08-30 18:57:55 +09:00
Masayuki Nakano 5c2c570f9b Bug 1393816 - part1: Cache a range until new range is created in Selection r=smaug
When setting value of <input type="text">, nsTextEditorState removes all
ranges of normal selection first.  Then, TextEditor sets the value.  Finally,
TextEditor collapses the selection at the end of the text.

In bug 1386471, we got that there are some problems to remove the call of
Selection::RemoveAllRanges() in nsTextEditorState.  Therefore, we need another
approach to improve Selection::Collapse().

The approach of this patch is, when removing all ranges from normal selection,
Selection can cache an nsRange instance if there is an instance which is not
referenced from other than the Selection (i.e., it'll be removed when
Selection::Clear() is called).  Then, Selection::Collapse() can reuse it.  With
this fix, Selection::Collapse() can reduce allocation cost and may reduce some
other cost like adding it to mutation observer.

However, keeping nsRange instance may cause increasing mutation observer's cost
since nsRange will be adjusted its start node/offset and end node/offset with
mutation observer to guarantee that the range is always valid.  So, we can
cache such range only when the caller (or its callee) will set selection range
later.  Therefore, this patch adds Selection::RemoveAllRangesTemporarily()
and make only nsTextEditorState::SetValue() and
ContentEventHandler::OnSelectionEvent() use it.

MozReview-Commit-ID: FjWrbz4S1ld

--HG--
extra : rebase_source : 83677640525e0b1a84bdd7fce63ff4704b9cc22b
2017-08-25 19:21:39 +09:00
Masayuki Nakano da1455e4b2 Bug 1393348 - part1: nsTextEditorState should use nsTextInputSelectionImpl::GetSelection(SelectionType) instead of nsTextInputSelectionImpl::GetSelection(RawSelectionType, nsISelection**) r=m_kato
nsTextEditorState stores selection controller as
RefPtr<nsTextInputSelectionImpl> mSelCon.  However, some methods still use
nsTextInputSelectionImpl::GetSelection(RawSelectionType, nsISelection**) which
is a virtual method overriding nsISelectionController.

So, instead, we should make it use
nsTextInputSelectionImpl::GetSelection(SelectionType).

MozReview-Commit-ID: Cvxa85LegsO

--HG--
extra : rebase_source : f8618fb9b4b2a1d3a02b4ce49906c8b995766e3f
2017-08-24 16:19:28 +09:00
Bobby Holley 8fb4fb3d6c Bug 1393791 - Stop unbinding native-anonymous content off a script runner. r=emilio
The failure mode in the attached crashtest is an inconsistency in the flattened
tree. Specifically, we null out mVideoControls in an nsVideoFrame, but defer
the UnbindFromTree call on that NAC element, which measn that its mParent still
points to the nsVideoFrame's mContent. Because all this stuff runs off of script
runners, and the anonymous content destroyer is not guaranteed to run before
other potential script runners, we end up running arbitrary script while the
tree mismatch exists. This script calls back into ProcessPendingRestyles, which
causes trouble.

We could build a separate deferral mechanism, but it's not clear that we actually
need to defer the unbind anymore. The deferred unbind was added in bug 489008,
which predated a lot of simplifications in layout/dom interaction.

MozReview-Commit-ID: 1JYAhiXKVJC
2017-08-27 15:29:36 -07:00
Olli Pettay 045eeefaaa Bug 1390402, add a faster variant of TextEditor::GetDocumentIsEmpty(), r=masayuki
--HG--
extra : rebase_source : 3238aec96be5b0393c395ce8cce9a0489d2e671d
2017-08-24 13:53:34 +03:00
Masayuki Nakano a7240d8532 Bug 1391538 - nsTextFragment for text nodes in <input> or <textarea> shouldn't store text as single byte characters even if all characters are less than U+0100 r=smaug
nsTextFrame stores text as single byte character array if all characters are
less than U+0100.  Although, this saves footprint, but retrieving and modifying
text needs converting cost.  Therefore, if it's created for a text node in
<input> or <textarea>, it should store text as char16_t array.

MozReview-Commit-ID: 9Z82rketT7g

--HG--
extra : rebase_source : 59f59ac1488c21a57d95d253cc794a011d672c95
2017-08-18 16:05:16 +09:00
Masayuki Nakano 1bbc0d5920 Bug 1387317 - part4: Make editor flag setters use new AddFlags() or RemoveFlags() if useful r=m_kato
MozReview-Commit-ID: EMDeGfK37Lx

--HG--
extra : rebase_source : 8a2b4e809c608649fbb41edd32d2165db7e77516
2017-08-08 12:36:29 +09:00
Masayuki Nakano 7c54bc878b Bug 1387317 - part2: EditorEventListener should stop using interface methods as far as possible r=m_kato
MozReview-Commit-ID: EPQeBez2tJh

--HG--
extra : rebase_source : b18b3399f703d3cdcb6f26cec3fcb8f707fb9519
2017-08-08 11:25:36 +09:00
Ehsan Akhgari 061d437c9e Bug 1386960 - Call nsTextInputListener's callback manually after using the non-transaction based editor code path for setting values of input controls; r=bzbarsky 2017-08-08 18:27:42 -04:00
Sebastian Hengst 765cc1b925 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: JhesEg4Bxjy
2017-08-04 19:28:27 +02:00
Ehsan Akhgari 22c17c93c9 Bug 1386472 - Only register the AccessibleCaretEventHub when the accessible caret is enabled; r=bzbarsky 2017-08-03 23:06:15 -04:00
Ehsan Akhgari cf4e6a817c Bug 1386411 - Part 7: Inline EditorBase::GetSelection(); r=masayuki 2017-08-03 17:06:31 -04:00
Ehsan Akhgari dd8fbce0c9 Bug 1386411 - Part 6: Add a more efficient nsISelectionController::GetSelection() API for retrieving native Selection objects; r=bzbarsky
This API avoids needless refcounting and QueryInterface overhead.
2017-08-03 17:05:24 -04:00
Wes Kocher e3d087fdd2 Backed out changeset 05400533498b (bug 1386471) for failures in browser_contentSearchUI.js a=backou
MozReview-Commit-ID: ElP9bo2hu8X
2017-08-02 18:09:22 -07:00
Ehsan Akhgari 99253c02a4 Bug 1386471 - Don't remove all ranges before calling SetText(); r=masayuki 2017-08-02 19:58:06 -04:00
Xidorn Quan dd399af4be Bug 1386905 - Move away mRuleNode in nsTextEditorState::UnbindFromFrame before storing the value into text buffer. r=Ehsan
Otherwise SetValue may think it's still safe to notify, while it isn't.

MozReview-Commit-ID: 6a3or1WXWAq

--HG--
extra : rebase_source : 9ffde09a1c1adf0bc7b47c9b10d2730f9d9de37e
2017-08-04 14:18:41 +10:00
Ehsan Akhgari 22aa56b6cd Bug 1386222 - Ensure that we always respect the undo/redo transaction history when modifying the <xul:textbox>.value dynamically through script; r=bzbarsky 2017-08-01 13:59:45 -04:00
Sylvestre Ledru 4e9cf83ee8 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG

--HG--
extra : rebase_source : 7235b3802f25bab29a8c6ba40a181a722f3df0ce
2017-07-06 14:00:35 +02:00
Bill McCloskey f115503a0b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Ehsan Akhgari d4de856fb8 Bug 1376317 - Move the pref var cache for dom.placeholder.show_on_focus to nsContentUtils; r=smaug 2017-06-26 16:17:49 -04:00
Masayuki Nakano 5af13a8f29 Bug 1374207 - part5: nsTextControlFrame should use TextEditor instead of nsIEditor r=smaug
MozReview-Commit-ID: Eh6Cp546bXT

--HG--
extra : rebase_source : 1bb83361b72af61434a91eb08aba09e79a1dd976
2017-06-19 23:47:02 +09:00
Masayuki Nakano 7ad4ad3aab Bug 1374207 - part1: nsTextEditorState should use mozilla::TextEditor instead of editor interfaces r=smaug
Using concrete class rather than interface classes (nsI*Editor) will allow to reduce QI and some virtual calls.  Therefore, Editor classes should be used as concrete class as far as possible.

Unfortunately, if classes referring editor are initialized via scriptable interface, we cannot do this because nsI*Editor is still not marked as builtinclass.  Therefore, their editor may be implemented by JS.  E.g., inline nsIInlineSpellChecker.init() and nsIDocShell.editor.  Such remaining cases should be fixed after nsI*Editor classes are marked as builtinclass.

Note that this patch also creates nsIdentifierMapEntry.h which is separated from nsDocument.h because ShadowRoot.h needs the class but exposing nsDocument.h to the global and includes it causes bustage on Linux and Android.  Therefore, for fixing the include hell, this patch touches them and ContentChild.cpp.

MozReview-Commit-ID: i6fLWw6Qeo

--HG--
rename : dom/base/nsDocument.h => dom/base/nsIdentifierMapEntry.h
extra : rebase_source : c57bdfc1c13775acdcfd4732d8157d04d6b6613f
2017-06-20 22:57:08 +09:00
Makoto Kato 19d01399e6 Bug 1360162 - Don't call UpdateOverlayTextVisibility twice by input.value setter when input element has focus. r=masayuki
When editor has focus, input.value setter will call UpdateOverlayTextVisibility via nsTextInputListener::EditAction -> nsTextControlFrame::SetValueChanged at first.  But SetValue will call UpdateOverlayTextVisibility again via ValueWasChanged.

So it is unnecessary to call UpdateOverlayTextVisibility on nsTextEditorState::SetValue when we have the editor.

MozReview-Commit-ID: Hw3Bh64Euo6

--HG--
extra : rebase_source : f33132e668fff48230f79990802a3d7e23e85207
2017-06-21 13:10:58 +09:00
Olli Pettay 8e6b3075e6 Bug 1374117 - nsTextEditorState::UpdateOverlayTextVisibility should use BoolVarCache, r=ehsan 2017-06-19 22:32:21 +03:00
Makoto Kato 23c3e741f1 Bug 1368888 - Don't get previous value twice in input.value setter. r=smaug
We get previous input.value twice in HTMLInputElement::SetValue and nsTextEditorState::SetValue when setting input.value.  Since nsTextEditorState::GetValue uses DocumentEncoder, it is expensive.  So we should use old value as parameter of nsTextEditorState::SetValue if possible.

MozReview-Commit-ID: A1UPfETTVCn

--HG--
extra : rebase_source : f751289b42b4d9d5c389042f688c53bde47d1620
2017-06-14 18:21:01 +09:00
Carsten "Tomcat" Book d5a13ba05e merge mozilla-inbound to mozilla-central a=merge 2017-06-09 12:58:49 +02:00
Makoto Kato e1017e8b12 Bug 1370806 - Part 2. Remove selection before calling nsIPlaintextEditor.setText. r=masayuki
nsIPlaintestEditor.setText still use BeginPlaceHolderTransaction and EndPlaceHolderTransaction.  But since input.value setter doesn't create undo transaction, it is unnecessary to save/restore selection via AutoPlaceHolderBatch.  So before calling setText, we should reset selection to reduce saving and restoring selection.

Save/Restore selection is ~7% of input.value setter.

MozReview-Commit-ID: 6yBKCtRmkQt

--HG--
extra : rebase_source : 4df5d0629f083b75615b96b17bc108613fe80c24
2017-06-07 15:31:06 +09:00
Makoto Kato 5644a572f6 Bug 1370806 - Part 1. Use RAII class for StartBatchChanges and EndBatchChanges. r=masayuki
Although we use StartBatchChanges and EndBatchChanges in nsTextEditorState::SetValue, we have a path that EndBatchChanges isn't called.  So we should use RAII class to call EndBatchChanges correctly.

MozReview-Commit-ID: 6bjtTT9wItA

--HG--
extra : rebase_source : dc9bdcb1a5ac4bca026e378c79355041d7f2384a
2017-06-07 14:11:31 +09:00
Ray Lin 083a2b81d1 Bug 1300996 - Part 2: Show preview text on and highlight the fields that would be filled. r=MattN, lchang
MozReview-Commit-ID: DMgVhz2lvZ1

--HG--
extra : rebase_source : 7394e1e0407829fcc4604d764e8cfd8afc326ef3
2017-04-24 10:55:29 +08:00
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