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

7931 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 3bd4299525 Bug 1393348 - part2: nsISelectionController::SELECTION_* should be sequential integer values r=smaug
nsISelectionController::SELECTION_* are declared as bit-mask.  However, no
methods of nsISelectionController treat them as bit-mask and these
values need a switch statement in nsFrameSelection to convert SelectionType to
array index of nsFrameSelection::mDOMSelections because it's too big to create
an array to do it.  Additionally, this conversion appears profile of
attachment 8848015.

So, now, we should declare these values as sequential integer values.

However, only nsTextFrame uses these values as bit-mask.  Therefore, this patch
adds new type, SelectionTypeMask and creates new inline method,
ToSelectionTypeMask(SelectionType), to retrieve mask value for a SelectionType.

MozReview-Commit-ID: 5Za8mA6iu4

--HG--
extra : rebase_source : 86617c1f5fa23166458f4353cb834f9e7c5b131b
2017-08-24 19:14:04 +09:00
Nicholas Nethercote c7df832636 Bug 1393642 - Remove nsIAtom/nsIAtomService usage from script in editor/. r=masayuki.
nsIHTMLEditor has several scriptable methods (addDefaultProperty(),
removeDefaultProperty(), etc.) that have nsIAtom parameters. We're in the
process of deCOMtaminating nsIAtom (bug 1392883) so these methods need to be
changed.

This patch does the following.

- It changes those methods to take an AString instead of an nsIAtom.

- For each existing method, it adds to HTMLEditor a new C++ method of the same
  name that takes an nsIAtom parameter.

- It updates TextEditorTest.cpp to use strings instead of atoms, in order to
  keep using the XPIDL methods.

- It updates test_bug1140105.html to pass strings instead of atoms to
  getInlineProperty(). This removes the use of nsIAtomService.

--HG--
extra : rebase_source : e005c3b5a08207b3d5d5fb55c47c8bc475b33453
2017-08-25 15:40:45 +10:00
Sebastian Hengst 6fd5b9e1ca merge mozilla-central to autoland. r=merge a=merge 2017-08-25 13:19:59 +02:00
Sebastian Hengst 31302b9cec merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 5armhVE9Jui
2017-08-25 13:12:04 +02:00
Ehsan Akhgari b174b2306a Bug 1392867 follow-up: Document that the aChild argument won't get AddRef'ed
DONTBUILD
2017-08-24 18:39:24 -04:00
Makoto Kato 5bd44e5cfd Bug 1393355 - Move SetTextRangeStyle from nsISelectionPrivate to Selection. r=masayuki
There is no reason that SetTextRangeStyle is defined at nsISelectionPrivate.  Also, SetTextRangeStyle isn't scriptable, and is called from CompositionTransaction::SetIMESelection only.  So we should move this to Selection.

MozReview-Commit-ID: FCOA6wVhvYZ

--HG--
extra : rebase_source : 64eb9e5fb973195b2c87ab4eb296685c8a4d0319
2017-08-24 16:56:12 +09:00
Masayuki Nakano e3529fd155 Bug 1375502 - part2: Add nsIContentIterator::Init(nsINode*, uint32_t, nsINode*, uint32_t) r=mats
nsIContentIterator::Init() takes nsRange but it's too expensive for some users.
So, there should be another Init() which can be specified a range in DOM tree
with 2 pairs of nsINode* and uint32_t.

MozReview-Commit-ID: 6JXic0KOM2d

--HG--
extra : rebase_source : 28ff355a2aa0dcb5d65495806ef8c67f1da642ea
2017-06-26 17:26:27 +09: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
Eric Rahm a33f11e0f5 Bug 1391803 - Use nsStringFwd.h for forward declaring string classes. r=froydnj
We should not be declaring forward declarations for nsString classes directly,
instead we should use nsStringFwd.h. This will make changing the underlying
types easier.

--HG--
extra : rebase_source : b2c7554e8632f078167ff2f609392e63a136c299
2017-08-16 16:48:52 -07:00
Sebastian Hengst 99e5cb9c14 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: GSKVB94r7Kk
2017-08-23 16:29:51 +02:00
Makoto Kato a1548f0668 Bug 1348073 - Part 4. Unnecessary VK_RIGHT to move caret on non-visual frame that is whitespace only node. r=masayuki
Since we enable lazy frame construction for editable region, whitespace only node might not have frame even if editable.  This test has whitespace only node into contenteditable, we need adjust caret operation for this test.

MozReview-Commit-ID: GQfKiYdYOdi

--HG--
extra : rebase_source : 0685d724f6af050d79c1cf007c7ee48c05da14ac
2017-08-21 15:33:03 +09:00
Ehsan Akhgari 31e4d33b89 Bug 1392870 - Avoid using nsINode::GetChildAt() in HTMLEditRules::DeleteNonTableElements(); r=masayuki 2017-08-23 01:01:04 -04:00
Ehsan Akhgari e7f2972a7f Bug 1392867 - Part 2: Avoid calling GetChildAt() in HTMLEditRules::TryToJoinBlocks(); r=masayuki 2017-08-23 01:00:07 -04:00
Ehsan Akhgari 07f926500c Bug 1392867 - Part 1: Add an overload of EditorUtils::IsDescendantOf() which returns an nsIContent* out argument for the child node found instead of its index in the parent; r=masayuki 2017-08-23 01:00:07 -04:00
Nicholas Nethercote 092af8e0a1 Bug 1390428 (part 5) - Remove more nsXPIDLCString uses. r=erahm.
These are all simple cases, with similarities to previous patches in this
series.

--HG--
extra : rebase_source : 6ef36382df9fef217d5cb737e218d65ac062f90a
2017-08-16 14:07:18 +10:00
Olli Pettay aeabc0c261 Bug 1392564 - Use nursery purple buffer for nsRange and RangeItem, r=mccr8
--HG--
extra : rebase_source : 650d101bb0cec4ed21b35945ae1185aca577b120
2017-08-22 17:47:00 +03:00
Makoto Kato 3ee9303468 Bug 1381541 - queryCommandState should consider that parent node of selection is null. r=masayuki
When parent node of selected node is null, crash might occur in GetCSSBackgroundColorState.  So when parent is null, we should return default value.  In this situation, Edge and Blink don't throw error, Gecko shouldn't return error too.

MozReview-Commit-ID: 5C6jSAFkCso

--HG--
extra : rebase_source : 0185f9fb5fde92eee5611e6bb95e8676c10b135c
2017-08-18 14:48:39 +09: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
Wes Kocher c043502159 Merge m-c to autoland, a=merge
MozReview-Commit-ID: 7sFZmPUXSx6
2017-08-18 17:21:29 -07:00
Masayuki Nakano 30fb5747b0 Bug 1391165 - part4: nsIEditor::EndOfDocument() should be implemented with an internal method which takes pointer to Selection r=smaug
EditorBase::GetSelection() sometimes appears in profile.  So, it shouldn't be
called in nsIEditor::EndOfDocument() if the callers of
nsIEditor::EndOfDocument() has a pointer to Selection.

This patch adds EditorBase::CollapseSelectionToEnd() for the internal method
and make all callers of nsIEditor::EndOfDocument() use it.

MozReview-Commit-ID: 8H4ThxzdKDf

--HG--
extra : rebase_source : 7436d7f286351fa9c91175b40e686f7ca1f3c69f
2017-08-17 17:08:22 +09:00
Masayuki Nakano a329587e5e Bug 1391165 - part3: TextEditRules::CollapseSelectionToTrailingBRIfNeeded() should use EditorBase::GetChildOffset() only when it's necessary r=smaug
In most cases, TextEditRules::CollapseSelectionToTrailingBRIfNeeded() doesn't
use the index anymore.  Therefore, it should stop using
EditorBase::GetNodeLocation() and use EditorBase::GetChildOffset() only when
the offset is necessary.

MozReview-Commit-ID: 9vGcLnTUnsu

--HG--
extra : rebase_source : af0cdad3a1905bf2e5654a109aa4037ec70b422b
2017-08-17 16:48:49 +09:00
Masayuki Nakano 0290f8a69f Bug 1391165 - part2: TextEditRules::CollapseSelectionToTrailingBRIfNeeded() should use nsINode::GetNextSibling() for retrieving next child of a node r=smaug
nsINode::GetChildAt() is too expensive if it's used for next sibling of a node.

This patch makes it use nsINode::GetNextSibling() instead.

MozReview-Commit-ID: CAC7gFNo77w

--HG--
extra : rebase_source : 185457b910e2e09c58a6f02525ae61aff149511c
2017-08-17 16:35:30 +09:00
Masayuki Nakano 87f491432c Bug 1391165 - part1: EditorBase::GetChildOffset() and EditorBase::GetNodeLocation() shouldn't use nsINode::IndexOf() as far as possible r=smaug
nsINode::IndexOf() is expensive especially when it's in a hot path, it's too
expensive.  So, EditorBase::GetChildOffset() and EditorBase::GetNodeLocation()
should check child's siblings first.  If some of them are nullptr, it means
that it's first child or last child of the parent.

Note that EditorBase::GetChildOffset() may return wrong index if it's called
while aChild is being removed from aParent or aParent isn't actual parent of
aChild.  However, there are MOZ_ASSERTs to ensure value isn't -1.  Therefore,
it's safe to assume that aParent is always the parent of aChild and it won't
be called from ContentRemoved() of mutation observers.

MozReview-Commit-ID: 8JdYWuZbHe5

--HG--
extra : rebase_source : 6ded91a3aa8b00ab4d2d544c2c392d88cb769cef
2017-08-17 16:24:16 +09:00
Ehsan Akhgari 950a791753 Bug 1391315 - Avoid using nsINode::GetChildAt() in TextEditRules::DocumentIsEmpty(); r=masayuki
This method will become a lot slower when bug 651120 lands.
2017-08-18 01:49:08 -04:00
Yoshi Huang b930b3d1ee Bug 1390770 - rewrite test_bug289384.html for new data: URI inheritance model. r=masayuki 2017-08-18 10:35:58 +08:00
Ehsan Akhgari 43a6f66350 Backout bug 1386480 for causing bug 1391410 2017-08-17 17:16:27 -04:00
Carsten "Tomcat" Book 99aa3f8e70 Merge mozilla-central to mozilla-inbound 2017-08-17 13:13:10 +02:00
Makoto Kato 4ad29844a4 Bug 1380824 - Call RepaintSelection out of script blocker. r=masayuki
MozReview-Commit-ID: LFyZLW0da7f
2017-08-17 15:28:04 +09:00
Nicholas Nethercote 025461bde7 Bug 1390428 (part 1) - Remove many nsXPIDLCString local variables. r=erahm.
These are all easy cases where an nsXPIDLCString local variable is set via
getter_Copies() and then is only used in ways that nsCStrings can also be used
(i.e. no null checks or implicit conversions to |char*|).

In every case the patch trivially replaces the nsXPIDLCString with an
nsCString. (Also, there are a couple of unused nsXPIDLCString variables that
the patch simply removes.)
2017-08-16 13:58:35 +10:00
Xidorn Quan 179961b3c9 Bug 1383845 - Enable tests disabled for bug 1383845. r=TYLin
MozReview-Commit-ID: Glao9d9PiUF

--HG--
extra : rebase_source : cfc70fcb350a7ee8e325ba1bda0bcdead62d786e
2017-08-17 10:51:59 +10:00
Masayuki Nakano d2dd8c5d8f Bug 1390831 - Make test_bug635636.html e10s-aware r=Ehsan
test_bug655636.html refers gBrowser, however, it's available only in chrome
process and it's referred only for listening to "pageshow" event instead of
"load" event of the data URI.  So, we must be able to use "unload" event of the
previous URL instead.

Although, this testcase (even without this change) won't cause crash even if
backing out the patch for bug 635636 anymore.

MozReview-Commit-ID: B8qOwVZqZQm

--HG--
extra : rebase_source : d383181886152684a8bf9c2caf7248d5f7582c0a
2017-08-16 21:03:18 +09:00
Masatoshi Kimura be91c9a266 Bug 886907 - Remove old synchronous contentPrefService from the tree. r=adw
MozReview-Commit-ID: BZsB3FR3jHC

--HG--
rename : toolkit/components/contentprefs/ContentPrefService2.jsm => toolkit/components/contentprefs/ContentPrefService2.js
rename : toolkit/components/contentprefs/nsContentPrefService.manifest => toolkit/components/contentprefs/ContentPrefService2.manifest
extra : rebase_source : ab45b7668e97734004502ea776effedcb9b74974
2017-08-11 23:29:55 +09:00
Masayuki Nakano e1a21d5a3e Bug 1387317 - part5: AutoPlaceHolderBatch should take EditorBase instead of nsIEditor r=m_kato
AutoPlaceHolderBatch can take EditorBase class and its inherited class, AutoEditBatch, can be removed if we implement other constructor which doesn't take transaction name.

Additionally, nsIEditor::(Begin|End)PlaceHolderTransaction() are referred only by AutoPlaceHolderBatch.  Therefore, they can be non-public methods and removed from nsIEditor interface.

Note that this patch also repalces "PlaceHolder" with "Placeholder" since it's a word.

MozReview-Commit-ID: 5dw3kcX3bOx

--HG--
extra : rebase_source : e926cc1c2ebea70eb08e43778a8b52912b559b7b
2017-08-14 14:56:39 +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 8437aa287b Bug 1387317 - part3: HTMLEditor should use RefPtr<HTMLEditor> rather than nsCOMPtr<nsIHTMLEditor> for kungFuDeathGrip r=m_kato
MozReview-Commit-ID: 1F6wwjvdD8H

--HG--
extra : rebase_source : 23c2fefa67e11b584868d349bd043148c4b91770
2017-08-08 12:06:10 +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
Masayuki Nakano 20fc8ab477 Bug 1387317 - part1: Make AutoSelectionSetterAfterTableEdit use HTMLEditor instead of nsITableEditor r=m_kato
nsITableEditor is now a builtin class.  So, it's implemented only by HTMLEditor.  Therefore, AutoSelectionSetterAfterTableEdit can use HTMLEditor.

Then, nsITableEditor.setSelectionAfterTableEdit() can be removed from nsITableEditor and moved to HTMLEditor as non-virtual method since nobody uses it from JS.

MozReview-Commit-ID: KnN6Fw4TYyn

--HG--
extra : rebase_source : 48412a5f81f30d9ada47550fdb4d1ee0d88de6f4
2017-08-08 10:57:19 +09:00
Carsten "Tomcat" Book bcbc42d4e3 Merge mozilla-central to mozilla-inbound 2017-08-15 13:09:01 +02:00
Yoshi Huang 60b7d9f697 Bug 1390398: fix failures on windows for new data: URI inheritance model. r=smaug 2017-08-15 18:09:28 +08:00
Carsten "Tomcat" Book 6b36e00b7c merge mozilla-inbound to mozilla-central a=merge 2017-08-15 11:42:11 +02:00
Makoto Kato 357fdca523 Bug 1390053 - Enable editor/libeditor/tests/test_bug830600.html on mochitest-e10s. r=masayuki
This test is turned off by bug 1269209 on e10s.  But there is no exactly reason why this test on e10s is turned off.

Although I run this test on e10s now, it seems to pass this.  So we should turn on this test even if e10s.

MozReview-Commit-ID: JHQP2ZYvsHL

--HG--
extra : rebase_source : 2bc45f0d2b5cc99bad93267f40191866264af414
2017-08-14 18:29:40 +09:00
Masayuki Nakano 9ee491b79f Bug 1388001 - part3: Remove nsIEditor argument of nsIHTMLDocument::TearingDownEditor() since it's unused r=smaug
nsIHTMLDocument::TearingDownEditor() takes nsIEditor as an argument.  However, it's not used in it.  So, we can remove it.

MozReview-Commit-ID: KUmIsnVGB6H

--HG--
extra : rebase_source : ddd344b9df18e0b33d54d2f99e6335449f55df81
2017-08-07 14:25:52 +09:00
Masayuki Nakano d66337db9a Bug 1388001 - part2: nsEditingSession should treat editor as HTMLEditor r=m_kato
nsEditingSession should treat editor as HTMLEditor in its internal handling.

MozReview-Commit-ID: 51SfY4oeq3p

--HG--
extra : rebase_source : 90535267e62de17755fff9f21b6a0f74244d849a
2017-08-04 22:53:28 +09:00
Masayuki Nakano fc87c572fa Bug 1388001 - part1: Create nsIEditingSession::GetHTMLEditorForWindow() r=smaug
Some users of HTMLEditor retrieve pointer to editors with nsIEditingSession::GetEditorForWindow() but it returns nsIEditor.  So, there should be a method which returns HTMLEditor*.

MozReview-Commit-ID: Bzc1LIlTSDF

--HG--
extra : rebase_source : f6fb3e5852809487883e3e6fedda9580206b2cb5
2017-08-12 11:44:16 +09:00
Sebastian Hengst d98ea1f774 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: FzIkMLHbOh2
2017-08-14 01:30:32 +02:00
Aryeh Gregor 99a150fe57 Bug 1359397 - Don't allow Selection in nodes not in the document; r=masayuki
This matches the spec and Chrome, and seems to bring us closer to Edge
and WebKit as well.  It also matches our own behavior for addRange(),
which was changed in bug 1341137.

For collapse and selectAllChildren, we match the tests and browsers, but
the spec is incorrect at the time of this writing:
https://github.com/w3c/selection-api/pull/86

The removeAllRanges test hadn't been updated for the spec change.

MozReview-Commit-ID: DTK8283k5IP

--HG--
extra : rebase_source : 54701e7136c33ebce651d5f74c3dc1d8b944f9a3
2017-08-10 15:02:08 +03:00
Kyle Machulis 649634a721 Bug 1387184 - Remove nsIDOMHTMLEmbedElement; r=bz
Removes nsIDOMHTMLEmbedElement and all references. HTML elements are
now handled by WebIDL. With the deprecation of extensions, XPCOM
interfaces to HTML elements are no longer needed.

MozReview-Commit-ID: DI4XVvdgPDI

--HG--
extra : rebase_source : 74bd92619e3d1db04c3dd40ec3022474fe1d647c
2017-08-09 12:05:08 -07:00
Wes Kocher 936a9461f6 Merge inbound to m-c a=merge
MozReview-Commit-ID: KRQeIGmhAPA
2017-08-10 18:14:34 -07:00
Sebastian Hengst 51d351f567 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-08-10 17:41:11 +02:00
Ehsan Akhgari 3ab3b25fad Bug 1388917 - Fix moving of SelectionState in PlaceholderTransaction's constructor; r=masayuki 2017-08-10 08:35:19 -04:00