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

65 Коммитов

Автор SHA1 Сообщение Дата
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
Nathan Froyd f0c8d767c9 Bug 1132499 - part 1 - convert nsTextEditorState::mValue to use Maybe instead of heap allocation; r=ehsan
This change is just a minor tidying; we need to distinguish between
"have a value" and "don't have a value" in nsTextEditorState::GetValue,
but we can do better than heap-allocating the string.
2016-03-04 09:56:13 -05:00
Botond Ballo 45d03919dc Bug 1238137 - Telemetry pings for main thread scrolling to bring the caret into view after moving it in response to keyboard input. r=ehsan
--HG--
extra : commitid : 6E0SPxaKbMl
extra : rebase_source : ca82cafc8b462318ffc5030319546731d9e7a540
extra : histedit_source : 63c1e103a3aaf2ce340b1b4f2276763c16ac2237
2016-02-03 20:36:24 -05:00
Botond Ballo 51957870b3 Bug 1238137 - Telemetry pings for main thread keyboard-driven scroll input methods. r=ehsan
Pings are sent in the implementations of the nsISelectionController methods
ScrollLine, ScrollPage, ScrollCharacter, and CompleteScroll. It is assumed
that these methods are triggered by keyboard input.

A small number of false positives can occur if these methods are called
in response to something other than keyboard input; this is considered
acceptable.

--HG--
extra : commitid : JDXW8ptuXkF
extra : rebase_source : c45fe2b16484ad370edb852d8eafbc76ca7d0bac
extra : amend_source : b4af21228768221211a42c11a2ff306a6f2bb402
extra : histedit_source : 7cdc4b4df3579682fad194ddfc04c7a5d02c0d3e
2016-02-03 19:51:03 -05:00
Aidin Gharibnavaz 6863090c8a Bug 1235830 - Renaming GetInternalNSEvent to WidgetEvent, in nsIDOMEvent r=smaug
MozReview-Commit-ID: Hm8Owq17KXn

--HG--
extra : transplant_source : 2%82%D5%89%19%94%7C%E7%CA1%99%B5%24%1F5%E1%C0%1F%DE%07
2016-02-12 19:10:07 +03:30
Kyle Huey 91efc5a86c Bug 1241764: Replace nsPIDOMWindow with nsPIDOMWindowInner/Outer. r=mrbkap,smaug 2016-01-30 09:05:36 -08:00
Ting-Yu Lin 1889f6bc41 Bug 1227927 Part 2 - Remove nsIFrame::GetFirstPrincipalChild(). r=mats
--HG--
extra : commitid : 5qtaK1nS8RC
extra : rebase_source : dcc98f423b2446269beb6fa6a9d092ae8213f38e
2016-01-29 22:42:14 +08:00
Masayuki Nakano b6593edc11 Bug 1240336 Setting same value to either <input> or <textarea> shouldn't cause committing existing composition r=ehsan 2016-01-21 16:52:27 +09:00
Mark Capella caaac41610 Bug 1215959 - (GeckoCaret2) Remove experimental bits added to Touch/Selection carets, r=tylin 2015-12-01 15:25:06 -05:00
Mark Capella 83e7fad573 Bug 1218072 - crash in nsTextEditorState::FinishedRestoringSelection, r=smaug 2015-11-28 11:44:54 -05:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Michael Layzell fc03111ce2 Bug 1196479 - Fire selectstart and selectionchange events on the input node when the selection in that editor changes. r=ehsan 2015-09-12 17:56:46 -04:00
Masayuki Nakano 2586c79eb1 Bug 895274 part.66 Rename NS_FORM_SELECTED to eFormSelect r=smaug 2015-09-02 15:08:00 +09:00
Masayuki Nakano d311a11cc1 Bug 895274 part.9 Rename NS_KEY_PRESS to eKeyPress r=smaug 2015-08-29 08:58:27 +09:00
Masayuki Nakano 66f2c27305 Bug 895274 part.1 Rename WidgetEvent::message to WidgetEvent::mMessage r=smaug 2015-08-22 10:34:51 +09:00
Masayuki Nakano ecdd7a7f0f Bug 549674 part.1 Commit composition string at setting value of <input> or <textarea> r=smaug 2015-06-18 23:56:20 +09:00
Jorg K 1f63317347 Bug 1169996 - Don't lose eEditorMailMask; r=ehsan 2015-06-01 17:42:49 +02:00
Ehsan Akhgari 4ed74e49ed Bug 1166932 - Part 2: Make sure that nsTextInputListener doesn't try to perform edit actions if it has been disconnected from the editor object; r=roc 2015-05-23 09:59:50 -04:00
Mark Capella b470913851 Bug 988143 - Enable Gecko Touch in Fennec, SelectionController mods, r=ehsan 2015-05-14 22:06:12 -04:00
Andrew McCreight 9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Ehsan Akhgari e7830328c1 Bug 1154336 - Convert nsTextEditorState::mRestoringSelection into a strong reference; r=baku 2015-04-14 15:13:35 -04:00