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

41 Коммитов

Автор SHA1 Сообщение Дата
Ting-Yu Lin 7326c2887e Bug 1417376 Part 2 - Pass nsPoint parameters by const references instead of references. r=mats
MozReview-Commit-ID: 6TveqwkOvc0

--HG--
extra : rebase_source : d4674181a6198279bedbfc2efe4e0b1715c91d51
2017-11-15 18:26:10 +08:00
Ting-Yu Lin 34d8925cd4 Bug 1417376 Part 1 - Change nsPoint parameter to pass by value for DoAutoScroll(). r=mats
This private method DoAutoScroll() modifies aPoint inside of it, and none of
other callers (StartAutoScrollTimer() and nsAutoScrollTimer::Notify()) read
aPoint afterwards, so we make aPoint pass by value rather than pass by
non-const-reference. This is necessary for later parts.

MozReview-Commit-ID: 9PtxFXIka7X

--HG--
extra : rebase_source : 3bd47f071b3cecdc439ebc3b56c6a4f7ef56eff8
2017-11-16 10:32:22 +08:00
Ting-Yu Lin dfca359d6e Bug 1416699 - Add a space between #include and comment. r=jeremychen
Skip files under intl/icu/ because they're imported from third party.

DONTBUILD because this is a whitespace-only change.

MozReview-Commit-ID: GSd6oeFSTO7

--HG--
extra : rebase_source : 38c20bf6099c18b2fcb4c324d470b279addf8891
2017-11-13 17:54:18 +08:00
Masayuki Nakano 898bbb3137 Bug 1415062 - part 1: Selection should have Collapse(const RawRangeBoundary&) and Collapse(const RawRangeBoundary&, ErrorResult&) for avoiding computing offset of child node in container r=smaug
Selection should have Collapse() methods which take RawRangeBoundary instead of
a set of container and offset in it.  Then, if caller know only child node but
doesn't know offset in the container, neither callers, Selections nor nsRange
needs to compute offset.  This makes them avoid calling expensive method,
nsINode::IndexOf().

MozReview-Commit-ID: 79IRajLe1FE

--HG--
extra : rebase_source : a8ce52ff1654974461d5ecfed98b73d9cca34133
2017-11-07 15:29:15 +09:00
Andrew McCreight 298aa82710 Bug 1412125, part 2 - Fix dom/ mode lines. r=qdot
This was automatically generated by the script modeline.py.

MozReview-Commit-ID: BgulzkGteAL

--HG--
extra : rebase_source : a4b9d16a4c06c4e85d7d85f485221b1e4ebdfede
2017-10-26 15:08:41 -07:00
Kris Maglione 60d080b412 Bug 1404198: Part 2i - Switch to NS_NewTimer* in dom. r=njn
MozReview-Commit-ID: 8Oei6TuXNbu

--HG--
extra : rebase_source : 31c583c699790cbcf302064146d313ee8126ef0c
2017-10-15 23:15:40 -07:00
Ehsan Akhgari a3b87e2b92 Bug 1405039 - Avoid using nsINode::GetChildAt() in HTMLEditor::GetSelectedElement(); r=masayuki 2017-10-02 14:22:57 -04:00
Makoto Kato b7d709c044 Bug 1397791 - Move StartBatchChanges and EndBatchChanges from nsISelectionPrivate to Selection. r=smaug
There is no reason to keep StartBatchChanges and EndBatchChanges in nsISelectionPrivate since this is noscript method.  And if moving it to Selection, we can remove virtual keyword.

MozReview-Commit-ID: Go6njiW3r2x

--HG--
extra : rebase_source : cb5bfce8312de7d49496e5f841e9786ff16102f6
2017-09-08 12:10:44 +09:00
Masayuki Nakano 4ce89d8f61 Bug 1369072 - part3: nsXBLPrototypeHandler::DispatchXBLCommand() should use controller of visible window r=smaug
With previous change, KeyboardEvent is dispatched even when invisible window
has focus.  However, nsRootWindow::GetControllerForCommand() returns controller
for focused window even when the window is invisible because it uses
nsFocusManager::GetFocusedDescendant() to retrieve focused window.

Perhaps, we can assume that users won't expect to do something with invisible
window when they type some keys.  Then, nsRootWindow::GetControllerForCommand()
should return controller for visible ancestor window if focused window is
invisible.

This patch makes nsFocusManager::GetFocusedDescendant() can return only visible
descendants.  However, it already has a bool argument.  Therefore, it should
have a flag instead of adding new flag.  Most changes of this patch is replacing
its callers.

Then, nsRootWindow::GetControllerForCommand() and nsRootWindow::GetControllers()
should have a bool flag if it should return controller(s) for visible window.
This patch adds a bool flag for it.  Fortunately, the interface isn't scriptable.

Finally, this patch makes nsXBLPrototypeHandler::DispatchXBLCommand() and
EventStateManager::DoContentCommandEvent() retrieve controller for visible
window since they are always handles user input.

MozReview-Commit-ID: GygttTHuKRm

--HG--
extra : rebase_source : 1341273c4606298cb9b890b9312d9f5c8a75d144
2017-09-07 22:54:49 +09:00
Ehsan Akhgari 2231e4a948 Bug 1397577 - Avoid using GetChildAt() in HTMLEditor::GetSelectedOrParentTableElement(); r=smaug 2017-09-07 10:29:02 -04:00
Masayuki Nakano 1c17ef6f96 Bug 1393816 - part2: Selection::SetBaseAndExtent() should use mCachedRange if it's available r=smaug
Similar to Selection::Collapse(), if mCachedRange is available,
Selection::SetBaseAndExtent() should use it rather than creating new nsRange
instance.

Then, it can reduce the allocation cost and may reduce some other cost, e.g.,
adding it to mutation observer.

MozReview-Commit-ID: InQQusw2KMc

--HG--
extra : rebase_source : 967f0d4ad2b7bc706e417af547bbbb21e5f54306
2017-08-26 00:12:38 +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
Makoto Kato 3422cf2abc Bug 1393171 - More safety check for focus node. r=smaug
MozReview-Commit-ID: 9Byl7RXQivN
2017-08-25 23:54:46 +09: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
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 fa46fdd1ad Bug 1348073 - Part 1. MoveCaret should move caret when focus node is whitespace only even if it is no frame. r=jfkthame
When enabling lazy frame construction, whitespace only node might not have frame.  So editor/libeditor/tests/test_bug1315065.html is failure because nsFrameSelection::MoveCaret returns error since focus node is whitespace only node that has no frame.

So if focus node is whitespace only, we should promote to parent to get primary frame then try again.

MozReview-Commit-ID: K83T2LP3Pc5

--HG--
extra : rebase_source : 707584424e83574dd3151e12a915473f676ce5a0
2017-08-23 19:09:07 +09:00
Ehsan Akhgari 67ac6e84f7 Bug 1385530 - Avoid addrefing the presshell in Selection::ScrollIntoView() for the asynchronous scrolling case; r=mats 2017-08-22 19:33:13 -04:00
Ehsan Akhgari dea2e72d91 Bug 1390382 - Part 1: Inline Selection::IsCollapsed(); r=smaug 2017-08-15 18:57:14 -04:00
Ehsan Akhgari 604f6343ab Bug 1390626 - Part 2: Avoid using QueryInterface() to convert nsIDocument to nsIDOMDocument; r=smaug 2017-08-15 17:10:34 -04:00
Ehsan Akhgari 0b3dbd3a20 Bug 1390626 - Part 1: Bail out early if there are no selection listeners to notify; r=smaug 2017-08-15 17:10:34 -04:00
Milan Sreckovic 8ad3e52a49 Bug 1387514: Upgrade BaseRect (derived classes) width and height direct member variable use to instead use Width()/SetWidth() and Height()/SetHeight() in dom/*. r=overholt
MozReview-Commit-ID: B9YWmM3C1oX

--HG--
extra : rebase_source : d7c27de968295ee13ece8bda23798cb215d60a4b
2017-08-14 08:30:10 -04:00
Masayuki Nakano b11e66f8da Bug 1388004 - part1: Make nsContentUtils::GetHTMLEditor() return HTMLEditor* rather than nsIEditor* r=smaug
nsContentUtils::GetHTMLEditor() currently returns nsIEditor* since editor of doc shell may be any type of editors such as TextEditor or editor object which is implemented by JS.  However, nsIEditor is now a builtin class.  So, it can return HTMLEditor.

MozReview-Commit-ID: 3YoFOplZa7W

--HG--
extra : rebase_source : 46f42d23babd64bf0a5003e66e8fe3b9e0bd7166
2017-08-07 16:33:59 +09: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
Makoto Kato 4418d7d986 Bug 1381710 - Selection.addRange will be failure with dynamic table insertion. r=tnikkel
When range is selected table element, Selection.addRange uses nsFrameSelection.  If frame isn't constructed yet, addRange throws NS_ERROR_FAILURE even if table element isn't editable element.

When getting nsITableCellLayout, we should flush frame to construct cell frame.

MozReview-Commit-ID: 9qWwW46RYNL

--HG--
extra : rebase_source : 708e78af457a28bc273b83015f78950a5bee232e
2017-07-18 16:54:31 +09:00
Wes Kocher db7d003ae0 Merge m-c to autoland a=merge CLOSED TREE
MozReview-Commit-ID: Ko3lhAvzMJN
2017-08-03 18:22:09 -07:00
Ehsan Akhgari 7fe0be04ed Bug 1386411 - Part 3: Inline some helper functions in Selection.cpp; r=bzbarsky 2017-08-03 17:05:19 -04:00
Aryeh Gregor ca4b09e233 Bug 1359157 - Support Selection.type from spec; r=smaug
All other browsers already support it, more or less interoperably.

MozReview-Commit-ID: 4VoOeqBoKI0

--HG--
extra : rebase_source : fdd5198cc5fe8c2175242ddcc170947e7ca592b9
2017-08-03 17:13:24 +03:00
Bevis Tseng 95b18d794e Bug 1382172 - Name nsITimerCallback instances in native implementation. r=billm
--HG--
extra : rebase_source : 84de1abfcc30a6964144c2e6718a508c71027b65
2017-07-27 02:18:20 +08:00
Daniel Holbert 6c89198a2f Bug 1349683: Give RevocableEventPtr a "move" assignment operator, and use it to reduce refcount churn. r=froydnj
MozReview-Commit-ID: 9JQXZJqebm2

--HG--
extra : rebase_source : dea9940c9041567b7995b851624a210f08d04f30
2017-07-19 00:03:59 -07:00
Masayuki Nakano 2f92264fb7 Bug 1377978 - Make nsRange use uint32_t to offset r=smaug
DOM Standard defines that offset of Range is unsigned long.  However, nsRange uses int32_t to them.

This patch makes nsRange use uint32_t instead.  However, this patch does NOT allow to set over INT32_MAX as offset values since a lot of users of nsRange cannot treat the values as over INT32_MAX because a lot of internal APIs take int32_t as offsets.

For easier to search such points, this patch adds static_cast<int32_t> to uint32_t variables when they are used for int32_t arguments.

And note that nsContentUtils::ComparePoints() behaves odd.  It accepts negative offset and compares such value with valid offset simply.  This patch still uses int32_t offset variables in nsRange::CompareNodeToRange() even though it may be negative value if nsINode::IndexOf() returns -1 because the caller of it depends on this behavior.

MozReview-Commit-ID: 8RbOgA86JuT

--HG--
extra : rebase_source : 46d526c6d50dfa2f104439b19b8691477b17a4af
2017-07-19 22:49:52 +09:00
Masayuki Nakano b1f8f6d611 Bug 1377989 - part10: Rename local variables, |parent| which is set to container of nsRange to |container| r=smaug
MozReview-Commit-ID: 9w3O7MJEDBS

--HG--
extra : rebase_source : 92194bd18c9e79210c7cb4e9835a528d51e8ba7a
2017-07-11 23:52:39 +09:00
Masayuki Nakano e756fe8300 Bug 1377989 - part7: Rename aParent, aParentNode and aNode related to nsRange to aContainer r=smaug
MozReview-Commit-ID: K7Lu0U0pdC8

--HG--
extra : rebase_source : 324de9d2927231414395799c0f002889321b7d1e
2017-07-11 23:33:04 +09:00
Masayuki Nakano 4ee17d1b8c Bug 1377989 - part2: Rename nsRange::GetEndParent() to nsRange::GetEndContainer() r=smaug
MozReview-Commit-ID: K4qPjtZ62yO

--HG--
extra : rebase_source : 8653db98b9bd70c77a6aac8d906f401f0222c58a
2017-07-11 21:11:37 +09:00
Masayuki Nakano 2f2ce53be5 Bug 1377989 - part1: Rename nsRange::GetStartParent() to nsRange::GetStartContainer() r=smaug
Web standards use "Container" instead of "Parent".  So, nsRange shouldn't use "Parent" for its members and methods.

MozReview-Commit-ID: Ho6N0diuWtE

--HG--
extra : rebase_source : ee4eb7068a68b118c7fe98e9e9e7fa9c9e7f13e2
2017-07-11 20:53:04 +09: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
Masayuki Nakano f83bc98f97 Bug 1377752 - part2: Selection::NotifySelectionListeners() should make nsFocusManager not scroll new focused element into the view if it's not focused document r=smaug
When changing selection into a contenteditable element in non-focused document, new focused editor shouldn't be scrolled into the view for compatibility with the other browsers.

MozReview-Commit-ID: FabqizyJrPW

--HG--
extra : rebase_source : 5bd2a017ec4c4f4fc0a6f7644fba2769b3ffca2c
2017-07-05 21:35:18 +09:00
Olli Pettay da0ec0a364 Bug 1375491, make child process to cache ime properties only at animation tick time, r=masayuki
--HG--
extra : rebase_source : 6f13f4d91fc4873d135824431adb4b0b2843b738
2017-06-29 14:46:11 +03:00
Olli Pettay 70cd98776b Bug 1375484 - ScrollSelectionIntoViewEvent should be called during refresh driver tick, r=ehsan 2017-06-25 00:38:42 +03:00
Mats Palmgren 8924a195df Bug 1373999 part 3 - Create dom/base/SelectionChangeListener.cpp and move mozilla::dom::SelectionChangeListener code from dom/base/Selection.cpp to it. r=smaug
MozReview-Commit-ID: E8kiDtyWVdQ

--HG--
rename : dom/base/Selection.cpp => dom/base/SelectionChangeListener.cpp
2017-06-19 00:07:36 +02:00
Mats Palmgren 18cc369911 Bug 1373999 part 2 - Create layout/generic/nsFrameSelection.cpp and move nsFrameSelection code from dom/base/Selection.cpp to it. r=smaug
MozReview-Commit-ID: 2uTrJ9SO63s

--HG--
rename : dom/base/Selection.cpp => layout/generic/nsFrameSelection.cpp
2017-06-19 00:07:36 +02:00
Mats Palmgren d582beef4f Bug 1373999 part 1 - Move layout/generic/nsSelection.cpp verbatim to dom/base/Selection.cpp, and layout/generic/Selection*.h to dom/base/. Also export a few table header files that it needs. r=smaug
MozReview-Commit-ID: 9YUmEOIHUdc

--HG--
rename : layout/generic/nsSelection.cpp => dom/base/Selection.cpp
rename : layout/generic/Selection.h => dom/base/Selection.h
rename : layout/generic/SelectionChangeListener.h => dom/base/SelectionChangeListener.h
2017-06-19 00:07:36 +02:00