Commit Graph

4533 Commits

Author SHA1 Message Date
Masayuki Nakano
4376a0cf61 Bug 1325281 Get rid of nsIEditorIMESupport r=m_kato
MozReview-Commit-ID: KGJnho4uy1s

--HG--
extra : rebase_source : 1755ad59ed625076fbadb05db9bb5d4a1fea07cb
2017-05-09 15:21:22 +09:00
Carsten "Tomcat" Book
76ca853e3e Merge mozilla-central to mozilla-inbound 2017-05-09 14:40:11 +02:00
Yoshi Huang
df0da41d1c Bug 1361641 - Part 2: convert mochitest plain tests in editor/ to use srcdoc. r=smaug 2017-05-09 10:25:23 +08:00
Makoto Kato
6a08daf67d Bug 1352799 - Part 2. Add test for changing maxlength dynamically. r=masayuki
MozReview-Commit-ID: 4DiE33eyBar

--HG--
extra : rebase_source : 38f57dbf55c8ed769ba5aab1e36ce91fb35cbad4
2017-04-20 10:23:38 +09:00
Wes Kocher
6d6d039d43 Backed out 4 changesets (bug 1358297) for hazard build failures a=backout
Backed out changeset 95211a496191 (bug 1358297)
Backed out changeset 3c1b426a5cce (bug 1358297)
Backed out changeset 9201d345a1d5 (bug 1358297)
Backed out changeset c926817dea60 (bug 1358297)

MozReview-Commit-ID: 874DF43K7Dp
2017-05-05 12:45:46 -07:00
Milan Sreckovic
196fb1a3bc Bug 1358297: Part 3. Create special case for stripping CR and LF on TSubstring, and use it in all the places that it is called. Use ASCIIMask to make it fast. r=froydnj
MozReview-Commit-ID: 3p97cCGfy6i

--HG--
extra : rebase_source : a91d9a5e6e61495cfe78b06959b200e48ca16535
2017-05-05 13:37:13 -04:00
Masayuki Nakano
d04632f559 Bug 1342552 - IMEStateManager should cache nsIWidget for sPresContext and use it. r=smaug
IMEStateManager should cache nsIWidget for sPresContext at caching sPresContext.  Then, even if sPresContext has gone, IMEStateManager can clean up with the nsIWidget cache.

Unfortunately, editor has some bugs about calling IMEStateManager::UpdateIMEState().  That is, calling it *before* IMEStateManager::OnFocusChange().  In such case, this patch makes UpdateIMEState() ignore the call.

MozReview-Commit-ID: 1cydI03WyB8
2017-04-20 13:43:50 +09:00
Makoto Kato
60ccf10a30 Bug 1360137 - Part 2. Reduce QueryInterface by NativeInit. r=masayuki
nsIDocumentEncoder has nativeInit for nsIDocumnet, we should use it to reduce QueryInterface.

MozReview-Commit-ID: Ffn19yf9jra

--HG--
extra : rebase_source : 37c8b27cc0eddd4f0501ec1e61ea27d74ee1e6f3
2017-04-27 17:41:26 +09:00
Makoto Kato
ea65a415ff Bug 1360137 - Part 1. Use LowerCaseEqualsLiteral instead of ToLowerCase. r=masayuki
From profiling TextEditor::OutputToString, most of WillOutputText is ToLowerCase.  So, we should use LowerCaseEqualsLiteral instead.  It can reduce string copy.

MozReview-Commit-ID: LwqZtxIJTbW

--HG--
extra : rebase_source : 94da785d8288dfd93666a3dcb2d374874c79db89
2017-04-27 17:40:19 +09:00
Emilio Cobos Álvarez
d2f3dc13ec Bug 1357142: Kill PresShell::RecreateFramesFor. r=bz
It's not only inefficient, but also prone to buggyness. Since styles may not be
up-to-date when it happens.

Post a reconstruct instead, which ensures a style flush happens before running
frame construction.

MozReview-Commit-ID: DrakHsJv5fY
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>

--HG--
extra : rebase_source : 11900af908654336cc2391ab9480542c5474e38f
2017-04-17 18:01:37 +02:00
Makoto Kato
bba54a63e6 Bug 1359008 - Don't use nsIDOM* in TextEditRules's member. r=masayuki
To clean up TextEditRules, I would like to replace nsIDOMNode with nsINode and nsIContent in TextEditRules.

GetTopEnclosingPre is unused define, so I also remove it.

MozReview-Commit-ID: 6LraexH5t4m

--HG--
extra : rebase_source : 1037dcfd949d544282dc30360bd43773f21fd929
2017-04-24 19:40:12 +09:00
Makoto Kato
1b58ce0000 Bug 1335880 - Adjust mouse position for dragstart. r=masayuki
On Ubuntu 16.04 TLS, test_dragdrop.html due to control margin.  So we should adjust the point of dragstart.

MozReview-Commit-ID: EPW2UnaIWRt

--HG--
extra : rebase_source : a97c66dc36328563497130aa7a3829bc8a9eb204
2017-05-08 14:06:29 +09:00
Aryeh Gregor
3a32e91a42 Bug 1355792 - Consider invisible nodes to be editable; r=masayuki
We can't depend on information from layout to be correct unless we've
flushed pending notifications, which we can't do at every editability
check.  So let's forget about layout.  Nobody knows why editability ever
depended on visibility in the first place.

This allows us to revert the additions from bug 795418 as well.

The original test-case submitted on the bug report was very big and
complicated, so I have a minimal test-case instead.  This might not
exactly correspond to the originally reported bug, but this fix works for
both the original and minimal test case.

MozReview-Commit-ID: LOKjlgiAEOT

--HG--
extra : rebase_source : 5aaeae87fdc0dd78cb6f1060399c09d2945f8e08
2017-04-19 16:53:24 +03:00
Aryeh Gregor
fdf415af45 Bug 1357998 - Make editing tests independent of default defaultParagraphSeparator; r=masayuki
Now that this is a pref that is different in different versions, tests
have to work no matter what the pref's value is.  For tests that
actually tested line-breaking-related behavior, I made them test all
three separator values.  For tests that tested something else and only
incidentally depend on the default paragraph separator, I set
defaultParagraphSeparator to "div".

MozReview-Commit-ID: 8m7eoFRXpEy

--HG--
extra : rebase_source : dc664e87f7ce4f621aa48639cef6e754793e8ab4
2017-04-20 21:10:23 +03:00
Aryeh Gregor
bf0619d365 Bug 1354060 - Put defaultParagraphSeparator default change behind pref; r=masayuki
This is regression-prone, so dev.platform discussion concluded we want
it behind a pref.  We might turn the pref off for beta and/or release
for now as well.

MozReview-Commit-ID: 2H2et3RElZx

--HG--
extra : rebase_source : baf7e679ca1ee16016666d7697990c4f64ecf83e
2017-04-06 15:02:42 +03:00
Aryeh Gregor
47530382e3 Bug 1353695 - Sometimes Enter is ignored in editor; r=masayuki
When defaultParagraphSeparator is not "br", and we hit Enter on a line
that is not contained in any block element, we first create a new <div>
(or <p>) wrapper to hold the line's contents.  If creating this wrapper
fails for some reason, we go ahead and insert a <br> instead.

In some cases, we would get confused and think we didn't create the
block element when really we did.  We would insert a <br>, and
afterwards something would get rid of the empty block element.  In a
corner case where the line only consisted of a <br> to start with, this
would result in nothing happening, because the original <br> was removed
when creating the block element, and only one <br> was inserted to
replace it.

The correct fix is to just not get confused!

MozReview-Commit-ID: 1U8KHC71bfw

--HG--
extra : rebase_source : 50640615a3a652c3a74c1aef5412eb82daf8c5fb
2017-04-05 20:40:13 +03:00
Makoto Kato
0410282e88 Bug 1352882 - Part 3. Cache nsIDocumentEncoder into TextEditor. r=masayuki
All editor code gets nsIDocumentEncoder from TextEditor::GetAndInitDocEncoder(), so we can have a cache into TextEditor, then return cached object.

MozReview-Commit-ID: IEoOvz7BG7T

--HG--
extra : rebase_source : 1b30325c99fbc43dc77453325e97e88b439285e2
2017-04-17 17:29:46 +09:00
Makoto Kato
b24e38d3fc Bug 1356496 - Don't use nsIDOM* in ConfirmSelectionInBody. r=masayuki
ConfirmSelectionInBody uses a lot of QI and TextEditUtils::IsBody call to check body element.  So we shouldn't use nsIDOM* to avoid QI and EditorBase::GetTag().

Also, if did not found body element, it calls collapse to set caret.  If collapse is successful, we might not have to check end selection...  How do you think?

MozReview-Commit-ID: F7FhPrlEpCc

--HG--
extra : rebase_source : 85b5c99be0085dd579a9b650207c876cd17a2410
2017-04-14 14:54:03 +09:00
Florian Queze
37ff4fc7cc Bug 1356569 - Remove addObserver's last parameter when it is false, r=jaws. 2017-04-14 21:51:38 +02:00
Sebastian Hengst
a07223d699 Backed out changeset 322fde2d53bf (bug 1356569) so bug 1355161 can be backed out. r=backout 2017-04-14 23:39:22 +02:00
Florian Queze
95d4d20c17 Bug 1356569 - Remove addObserver's last parameter when it is false, r=jaws. 2017-04-14 21:51:38 +02:00
Dan Banner
cdf987089d Bug 1107904 - Remove packed.js and references to it as it is unused. r=standard8
MozReview-Commit-ID: K5TLF92pHq4

--HG--
extra : rebase_source : 295bf325a07fa8ec4c55a8babf5418588308dca6
2017-04-12 11:10:00 +01:00
Makoto Kato
6ed44d9df6 Bug 1330912 - Part 4. Update some tests to wait updating dictionary. r=masayuki
Since Part 2 improves foucs performance, these tests will be failed because spellchecker works later.  So using UpdateCurrentDictionary, dictionary is updated before test.


MozReview-Commit-ID: 69aC1rQd4LY

--HG--
extra : rebase_source : 50e0449b727352ff2f8e2a08605cc3f9d933d6d9
2017-04-10 14:44:49 +09:00
Makoto Kato
c61434ef9b Bug 1330912 - Part 3. Don't update dictionary during onfocus when spellcheck is unnecessary. r=masayuki
Such as <input type=password>, focused element doesn't use spellchecker, we should not call UpdateCurrentDictionary.  Also, when the attribute is changed, we should call UpdateCurrentDictionary if uninitialized.

MozReview-Commit-ID: LSfDTAszviE

--HG--
extra : rebase_source : a3fe944099c625b7f525d33eae06a7b8e8992729
2017-04-11 16:51:04 +09:00
Brian Birtles
33041d1214 Bug 1315874 - Drop 'ForElement' from GetStyleContextForElementXXX methods; r=heycam
In the next patch we want to add a method called
GetUnanimatedStyleContextForElementNoFlush but that's much too long. Instead it
seems better to just drop 'ForElement' from all these methods since it should be
fairly obvious we are getting the style context for an element given that the
first argument is an element.

MozReview-Commit-ID: JQKaEuCKV2F

--HG--
extra : rebase_source : 3ba51f3b00d1ec7bc91102629d9c0abb88992fef
2017-04-05 14:39:23 +09:00
Wes Kocher
bceaacd2b8 Merge inbound to central, a=merge 2017-04-04 11:25:13 -07:00
Aryeh Gregor
a334ab0dad Bug 1297414 - Change default paragraph separator to <div>; r=masayuki
This matches Blink/WebKit, and is more similar to Edge than before, but
may cause compat problems for Gecko-only code or code paths.  Sites can
revert to old behavior with:
document.execCommand("defaultparagraphseparator", false, "br").

This regresses test_bug430392.html on one test ("adding returns") and I
don't know why.  The test involves embedded non-editable content and we
already have a lot of todos in that file, so I think it's tolerable.

MozReview-Commit-ID: Dml0bXxgu87
2017-04-04 13:49:38 +03:00
Aryeh Gregor
3611697a7f Bug 1297414 - Support <div> separator in ReturnIn(Header|ListItem); r=masayuki
MozReview-Commit-ID: EkvFpyTmXDc
2017-04-04 13:49:38 +03:00
Aryeh Gregor
7c603e0235 Bug 1297414 - Support <div>/<p> separators in WillInsertBreak; r=masayuki
*aHandled was previously always set to true in WillMakeBasicBlock, which
was probably a bug but is not addressed in this commit.

MozReview-Commit-ID: 41JSmptVc0l
2017-04-04 13:49:38 +03:00
Aryeh Gregor
a7ed0e7cf4 Bug 1297414 - formatBlock should move non-editable nodes; r=masayuki
Before this change, if you did formatBlock on "a<span
contenteditable=false>b</span>c", it would become "acb", because the "a"
and "c" would be moved to the front of the node, and the "b" would be
left alone at the end because the editing code doesn't want to move it.
Now we will move the "b" as well, even though it's not editable, so that
the node remains "abc".  The rule is that a non-editable element cannot
have its attributes or children changed, but it can have its parent
changed, so there's nothing wrong with moving it here.

On the way, I fixed an exception in insert*List if there was an
uneditable inline node around.  I don't intend to fix all the todo's in
the test, but now it should have better coverage, at least.

MozReview-Commit-ID: 3okcGq4an3f
2017-04-04 13:47:28 +03:00
Aryeh Gregor
e3c9b3f2de Bug 1297414 - Treat <div> like <p> for break insertion; r=masayuki
I don't personally agree with this behavior (although I did spec it some
years ago), but it's the behavior of all other UAs, so we should do it
anyway.

MozReview-Commit-ID: IiIg41kMJIU
2017-04-04 13:47:28 +03:00
Aryeh Gregor
c442eea5f2 Bug 1297414 - Support execCommand("defaultParagraphSeparator"); r=masayuki
Later commits will add the actual functionality.

MozReview-Commit-ID: 6Ac9V6MjZpa
2017-04-04 13:47:28 +03:00
Aryeh Gregor
5575caf994 Bug 1297414 - Send eTypedBR in plaintext mode too; r=masayuki
This is what test_htmleditor_keyevent_handling.html expects.  It
historically made no difference in the case tested there, because we
inserted a <br> either way, but now it will make a difference.  I don't
know what an HTML editor in plaintext mode even means, so I don't know
if this change is actually the intended behavior.

MozReview-Commit-ID: 64w6bb9Q1pD
2017-04-04 13:44:53 +03:00
Aryeh Gregor
8f79d37004 Bug 1352144 - document.execCommand("inserttext", false, "") should work r=masayuki
Behavior per spec and Chrome is to just delete the selection.  We
already do this for insertHTML.

MozReview-Commit-ID: AWZhH6lIwuO

--HG--
extra : rebase_source : 353c3b628eb6a609de121e25bb7a11e579d29400
2017-03-30 21:04:09 +03:00
Makoto Kato
cd753d1158 Bug 1351074 - Part 2. Use testing-common for AsyncSpellCheckTestHelper.jsm. r=masayuki
TESTING_JS_MODULES uses testing-common, not gre.  So we should replace gre with testing-common for mochitest.

MozReview-Commit-ID: BqsS2D3IGR6

--HG--
extra : rebase_source : a8553684f8f106c1dfb6e2d9b51df7ebeb15275d
2017-03-29 15:34:49 +09:00
Aryeh Gregor
c9cfbcf638 Bug 1130651 - Don't throw IndexSizeError from insertText command r=masayuki
MozReview-Commit-ID: 7AXGvenAfWv

--HG--
extra : rebase_source : ff4f263468ea424a2e818d768727b1672da8b5f2
2017-03-30 18:36:17 +03:00
Phil Ringnalda
7ac3bd5b7e Backed out 3 changesets (bug 1351074) for reftest harness and browser_all_files_referenced.js bustage
CLOSED TREE

Backed out changeset 941e0f9ff9a7 (bug 1351074)
Backed out changeset 4fdf3b87a70b (bug 1351074)
Backed out changeset 586428f69838 (bug 1351074)
2017-04-02 19:46:49 -07:00
Makoto Kato
cd8761e0f4 Bug 1351074 - Part 2. Use testing-common for AsyncSpellCheckTestHelper.jsm. r=masayuki
TESTING_JS_MODULES uses testing-common, not gre.  So we should replace gre with testing-common for mochitest.

MozReview-Commit-ID: BqsS2D3IGR6

--HG--
extra : rebase_source : 2143fcdf33c428c82c6b2e00b542649b958aeccc
2017-03-29 15:34:49 +09:00
Aryeh Gregor
20a011132c Bug 1314388 - Fix bustage on CLOSED TREE
MozReview-Commit-ID: GDVevocsKaG
2017-04-02 14:11:48 +03:00
Aryeh Gregor
4a039c1336 Bug 1314388 - Remove SVGZoomEvent; r=longsonr,smaug
Some code in SVGSVGElement.cpp might be unnecessary now, but Robert said
to leave it for a followup.

MozReview-Commit-ID: 8PpRGeGrREJ
2017-04-02 13:51:33 +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
Aryeh Gregor
f889daf2b4 Bug 1175418 - Don't create unnecessary text nodes in editor; r=masayuki
MozReview-Commit-ID: LnioO8XoGQT

--HG--
extra : rebase_source : e85b99dc69912934f44c4e9dd9b17d23fe02bb09
2017-03-29 18:28:21 +03:00
Olli Pettay
25efa50e90 Bug 1350683 - Ensure the transaction processing. r=masayuki
--HG--
extra : rebase_source : 6053f4c943f1452a2728c209fbd8ebb225737cd3
2017-03-29 13:23:31 -04:00
Makoto Kato
cc04eb51dc Bug 1349426 - Remove nsIHTMLObjectResizeListener. r=masayuki
m-c, c-c, addons and bluegriffon don't use this interface, so we can remove it.

MozReview-Commit-ID: I8sVLpDR2gx

--HG--
extra : rebase_source : f88633271bf61ccc55098593fedff0dd7a561f21
2017-03-27 15:16:40 +09:00
Makoto Kato
7b1f32af65 Bug 1350772 - Part 2. Add test. r=masayuki
MozReview-Commit-ID: 9jQyvpXFl1E

--HG--
extra : rebase_source : f1a2f9dcc74291c382bc106757b032d42da185be
2017-03-27 14:41:21 +09:00
Makoto Kato
c013bde6aa Bug 1350772 - Part 1. Check whether node can be splited. r=masayuki
At first, HTMLEditor::GetActiveEditingHost might return null in this situation, we should check whether nullptr is returned.   At second, SplitNodeDeep returns error since curent is design mode and selection node has no parent.  So we should check error.

MozReview-Commit-ID: 2YlWXPNtf80

--HG--
extra : rebase_source : 5e9752353cdf8db906e94391e9660f61336a9614
2017-03-28 14:56:03 +09:00
Boris Zbarsky
15cb86a93f Bug 1349940. DeleteRangeTransaction should not keep its range alive longer than it needs to. r=masayuki, a=kwierso
MozReview-Commit-ID: 283P59EDFPW
2017-03-24 16:07:11 -04:00
Carsten "Tomcat" Book
7419b36815 merge mozilla-inbound to mozilla-central a=merge 2017-03-24 14:24:21 +01:00