Commit Graph

115 Commits

Author SHA1 Message Date
Boris Zbarsky
6fb00d932f Bug 1457155. Rename various focus manager variables to make it clearer that they're Elements. r=mccr8 2018-04-26 15:28:31 -04:00
shindli
55275cebc3 Backed out 2 changesets (bug 1457155, bug 1457156) for B failures in builds/worker/workspace/build/src/dom/html/HTMLObjectElement.cpp on a CLOSED TREE
Backed out changeset 8b2a6b54336c (bug 1457155)
Backed out changeset 4e267d999797 (bug 1457156)
2018-04-27 01:34:37 +03:00
Boris Zbarsky
6764622e9f Bug 1457155. Rename various focus manager variables to make it clearer that they're Elements. r=mccr8 2018-04-26 15:28:31 -04:00
Boris Zbarsky
45892dfa49 Bug 1456588 part 1. Change nsIFocusManager::SetFocus to take Element. r=enndeakin 2018-04-26 10:37:46 -04:00
Jonathan Watt
dcee05dad5 Bug 1452170 follow-up - Fix Windows unified build bustage by adding missing AutoRestore.h includes. r=me on CLOSED TREE 2018-04-09 10:21:42 +01:00
Ting-Yu Lin
253b8e343d Bug 1347049 - Remove the ability to hide AccessibleCaret when scrolling. r=mats
This feature is B2G only. Remove it to make AccessibleCaret simpler to
maintain.

MozReview-Commit-ID: 7JZw5XtaUeU
2018-04-04 15:45:52 +08:00
Boris Zbarsky
72b3558850 Bug 1446711 part 7. Switch the nsIDOMMouseEvent::MOZ_SOURCE_* constants over to MouseEventBinding. r=qdot
We can't include MouseEventBinding.h in MouseEvents.h because that produces
this include loop:

MouseEventBinding.h -> UIEventBinding.h ->
nsGlobalWindow.h -> nsGlobalWindowInner.h -> nsRefreshDriver.h ->
AnimationEventDispatcher.h -> AnimationComparator.h -> Animation.h ->
EffectCompositor.h -> PseudoElementHashEntry.h -> Element.h ->
PointerEventHandler.h -> MouseEvents.h -> MouseEventBinding.h

MozReview-Commit-ID: 6FNksGil7uD
2018-03-20 00:16:06 -04:00
Emilio Cobos Álvarez
9e47fd4973 Bug 1433671: Add MOZ_CAN_RUN_SCRIPT annotations to AccessibleCaret and other stuff. r=bz
MozReview-Commit-ID: Js0CF7WQM73
2018-03-14 23:32:22 +01:00
Boris Zbarsky
94b07b26ec Bug 1434819 part 7. Remove the SHOW_* constants from nsIDOMNodeFilter. r=qdot
MozReview-Commit-ID: 7E2KZkLfbSI
2018-02-01 14:26:12 -05:00
Emilio Cobos Álvarez
48a2921be9 Backout changeset 5ca278d8c1af (Bug 1433671) for not handling all callers in all platforms. r=backout
This reverts commit 795018bb21eb9fa906128d0a15cf773643878585.
2018-01-30 12:17:04 +01:00
Emilio Cobos Álvarez
32c74f867b Bug 1433671: Add MOZ_CAN_RUN_SCRIPT annotations to AccessibleCaret. r=bz
MozReview-Commit-ID: Js0CF7WQM73
2018-01-30 11:50:35 +01:00
Emilio Cobos Álvarez
cbdcc2c455 Bug 1433671: Make AccessibleCaretManager flushes a bit more sound. r=TYLin
The accessible caret manager is owned by the event hub, that is owned by the
shell.

All the callers of methods that call FlushLayout on the AccessibleCaretManager
should hold an external reference to the event hub.

Flushing pending notifications can run arbitrary script, that can call Destroy()
on the pres shell (and thus tear down the accessible caret event hub, and the
manager with him).

I don't know why before my change this wasn't crashing badly, but the code as it
was just doesn't look sound to me at all either (maybe I'm misunderstanding
something and I should just revert that patch and give up on having nice
invariants during our flushes..., but I don't think it's the case).

This also adds some sanity-checking that we don't die under our flush.

MozReview-Commit-ID: 4s0UT0fD3TI
2018-01-30 11:50:32 +01:00
Emilio Cobos Álvarez
4713311308 Bug 1431474: Make AccessibleCaretManager flush notifications through the document. r=bz
We're crashing because we're trying to flush layout of a shell whose document is
in the bfcache, so when we try to get the shell from the document in the style
set we get null back.

This shouldn't generally happen, and all flushes should go through the document
instead to avoid bugs like this and also other bugs related to subdocuments, and
all the stuff that nsIDocument::FlushPendingNotifications handles but the
presshell version doesn't. That's bug 1431852.

MozReview-Commit-ID: 1IJ4DBa3DCO
2018-01-24 10:32:53 +01:00
Ting-Yu Lin
20cd18ad52 Bug 1417796 - Pass UpdateCaretsHintSet by const references instead of values. r=mtseng
Fix warning: the parameter 'aHints' is copied for each invocation but only
used as a const reference; consider making it a const reference

MozReview-Commit-ID: 6CyT6gxVgES
2017-11-16 13:49:40 +08:00
Ting-Yu Lin
6c7ca784c0 Bug 1417796 - Refactor AccessibleCaretManager::GetFrameSelection() to eliminate a warning. r=mtseng
Fix warning: do not use 'else' after 'return'

MozReview-Commit-ID: 1jebzioHvph
2017-11-16 13:48:20 +08:00
Ting-Yu Lin
1043610135 Bug 1417796 - Make empty destructors implemented by 'default'. r=mtseng
Fix warning: use '= default' to define a trivial destructor

I added #include "nsDocShell.h" because I got an error "incomplete type
'nsDocShell' used in nested name specifier." After that, some files like
nsCanvasFrame.cpp fails to compile because they include
AccessibleCaretEventHub.h. Hence the moz.build changes.

MozReview-Commit-ID: BYZx7txvkSn
2017-11-16 13:46:54 +08:00
Ting-Yu Lin
9cf36c7edc Bug 1404854 Part 3 - Fix page cannot be scrolled automatically when dragging caret. r=mtseng
The issue is: when we hit some failure conditions in DragCaretInternal()
such as the frame is not selectable, or no frame is under the point, etc.,
we'll early return so that the auto scroll code is not being executed.

The logic in StartSelectionAutoScrollTimer() is similar to how
nsFrame::HandleDrag() handles the auto scrolling.

MozReview-Commit-ID: FtXZ8BWp3BX
2017-10-06 15:54:23 +08:00
Ting-Yu Lin
e79ca8b385 Bug 1404854 Part 2 - Move adding mOffsetYToCaretLogicalPosition into DragCaretInternal(). r=mtseng
MozReview-Commit-ID: 1hKB7V4JSZo
2017-10-06 17:39:56 +08:00
Ting-Yu Lin
813e173090 Bug 1404854 Part 1 - Move null pointers checking from DragCaretInternal() to DragCaret(). r=mtseng
We don't need to check GetFrameSelection() because valid GetSelection()
implies valid GetFrameSelection().

MozReview-Commit-ID: 9WH7HxN27yF
2017-10-06 15:45:32 +08:00
Masayuki Nakano
f4a5a8a21e Bug 1377989 - part2: Rename nsRange::GetEndParent() to nsRange::GetEndContainer() r=smaug
MozReview-Commit-ID: K4qPjtZ62yO
2017-07-11 21:11:37 +09:00
Masayuki Nakano
7015ac1e62 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
2017-07-11 20:53:04 +09:00
Ting-Yu Lin
cf1991166c Bug 1370762 - Null check GetSelection() before calling Stringify(). r=mtseng
MozReview-Commit-ID: 9sNaXwzbqUw
2017-06-08 12:49:05 +08:00
Ting-Yu Lin
389d35366d Bug 1361072 - Change caller of RestrictCaretDraggingOffsets() to use getter_AddRefs. r=dholbert
Per description in bug 1361072, this is the standard idiom to assign
outparam pointers of refcounted types.

MozReview-Commit-ID: 6kmDslMs94j
2017-05-02 14:24:54 +08:00
Emilio Cobos Álvarez
643f3f8618 Bug 1361051: rename mozilla::FrameType to mozilla::LayoutFrameType. r=xidorn
This avoids conflicts with mozilla::dom::FrameType.

MozReview-Commit-ID: 7aEMbHRaTFk
2017-05-01 19:32:52 +02:00
Emilio Cobos Álvarez
3731858edf Bug 1360241: Devirtualize nsIFrame::GetType. r=heycam
MozReview-Commit-ID: 5Nzhyta5Hle
2017-04-30 17:30:08 +02:00
Astley Chen
d16bc1048c Bug 1347047 Part 2 - Remove caret timeout control from AccessibleCaretManager. r=TYLin
The feature is controlled by pref layout.accessiblecaret.timeout_ms, and has been disabled in bug 1268410.
It's time to remove relevant code from the tree.

MozReview-Commit-ID: LLu8RiQcTpm
2017-03-17 08:50:30 +08:00
Ting-Yu Lin
e84cf763d7 Bug 1273045 Part 2 - Update carets when scrolling in subframes without APZ. r=mtseng
Override OnScrollPositionChanged() in ScrollState because we want to update
carets during scrolling in subframes without APZ.

Due to the observation in bug 1273045 comment 8, we do not distinguish
PositionChangedResult::NotChanged and PositionChangedResult::Changed.
Instead, we always update caret even if its position is not changed.

To avoid excessive CaretStateChangedEvents are dispatched in
OnScrollPositionChanged(), we add IsScrollStarted to distinguish whether
OnScrollStart() is called or not.

MozReview-Commit-ID: KNi9Mct4dSk
2017-03-14 17:50:03 +08:00
Ting-Yu Lin
7577af727a Bug 1273045 Part 1 - Convert UpdateCaretsHint to use EnumSet. r=mtseng
Part 2 is going to add a new hint which will use with RespectOldAppearance.
Hence this patch.

Remove #include "mozilla/WeakPtr.h" and "nsWeakReference.h" because they're
not used in the header.

MozReview-Commit-ID: KiNv0M0v8iO
2017-03-14 15:25:16 +08:00
Ting-Yu Lin
004724aeeb Bug 1341588 Part 3 - Extend phone number selection only if it is already a phone number. r=mtseng
MozReview-Commit-ID: D25xl0oAD4o
2017-03-07 17:21:26 +08:00
Ting-Yu Lin
50da63b176 Bug 1341588 Part 2 - Add StringifiedSelection() to simplify code. r=mtseng
MozReview-Commit-ID: 1tRG8WY13ok
2017-03-07 17:09:39 +08:00
Ting-Yu Lin
fa95fabdfc Bug 1341588 Part 1 - Add spaces to the static comments for aesthetic reason. r=mtseng
MozReview-Commit-ID: IMZQ1v2KsI0
2017-03-07 16:19:31 +08:00
Mats Palmgren
7c43dcf986 Bug 1340771 part 1 - Rename nsWeakFrame to AutoWeakFrame (automated change). r=tn
MozReview-Commit-ID: 8pl4nyeGEkr
2017-03-01 18:03:14 +01:00
Ting-Yu Lin
9ba6cacec5 Bug 1338445 - Restrict whitespace match in phone number regex for AccessibleCaret. r=mtseng
In phoneRegex, replace '\\s ' (matching a whitespace character) with ' '
since phone number won't contain something like new line or tab.

Also, consider it done if selected text is not changed after calling
Modify().

MozReview-Commit-ID: 2lB9w2gYCOD
2017-02-17 22:38:08 +08:00
Tom Tromey
a4b717ab39 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs
2016-12-15 20:16:31 -07:00
Ting-Yu Lin
c2b2520028 Bug 1339797 - Fix select-all events fired by touch incorrectly hide the carets. r=mtseng
sHideCaretsForMouseInput is default to true on all platforms. When clicking
"SELECT ALL" on Fennec toolbar in <input>, AccessibleCaretManager will
receive SELECTALL_REASON with MOZ_SOURCE_TOUCH.

We should hide the carets only if the select-all reason is fired by
keyboard, not by touch.

MozReview-Commit-ID: D7FYIH5ZGS0
2017-02-17 14:08:48 +08:00
Ting-Yu Lin
65ed91ec8d Bug 1336388 - Use overlapping tilt mechanism in always tilt mode. r=mtseng
MozReview-Commit-ID: LwWnAbHiTBH
2017-02-08 15:51:28 +08:00
Cameron McCormack
5f9911da79 Bug 1328832 - Part 2: Rename mozFlushType to mozilla::FlushType and make it an enum class. r=bzbarsky
MozReview-Commit-ID: D3fIngSHSsl
2017-01-05 15:31:56 +08:00
Phil Ringnalda
9a09bc8ce5 Backed out changeset 079ee7b41c3a (bug 1156160) for selection reftest failures
CLOSED TREE
2016-11-30 21:34:42 -08:00
Ting-Yu Lin
6bafa31645 Bug 1156160 - Update carets when document becomes visible. r=mtseng
When the user switches back to a tab which has the selection highlight on
the document, call UpdateCarets() to bring the carets back.

MozReview-Commit-ID: LxNoNRl4FHZ
2016-11-25 17:51:40 +08:00
L. David Baron
6eb5c8ff40 Bug 1320815 - DeCOMtaminate nsIFrame::IsSelectable by returning boolean instead of nsresult. r=xidorn
MozReview-Commit-ID: EBxBcEgIvp7
2016-11-28 15:31:29 -08:00
Ting-Yu Lin
a64e1284f8 Bug 1307252 - Hide the carets when the selection is made by select all. r=kanru,kats
The mochitest for clipboard still needs the mozbrowsercaretstatechanged events,
so we disable "layout.accessiblecaret.hide_carets_for_mouse_input".

MozReview-Commit-ID: CD03lmjwUa9
2016-10-05 15:46:36 +08:00
Kartikaya Gupta
f4b14dcf26 Bug 1293483 - Keep the carets hidden when the user is using a mouse to modify the selection. r=TYLin
MozReview-Commit-ID: FJwODLk6XMS
2016-10-03 08:57:44 -04:00
Kartikaya Gupta
22a5098249 Bug 1300905 - When long-pressing on a selection, don't dismiss the selection and start a new one. Show the context menu instead. r=TYLin,mats
MozReview-Commit-ID: J0e9DqIDwnC
2016-09-30 09:36:10 -04:00
Ting-Yu Lin
e7b43b14e8 Bug 1292904 Part 3 - Use only caret image for touch area if event is a mouse type. r=mtseng
That is, exclude the text overlay to fix the double clicking and triple
clicking on a word in editable text area.

MozReview-Commit-ID: 5bELcNSRo2A
2016-08-14 21:39:30 +08:00
Ting-Yu Lin
9d6322c747 Bug 1285273 - Bail out early if ptFrame died in SelectWordOrShortcut(). r=masayuki
Check ptFrame is still alive after calling
ChangeFocusToOrClearOldFocus() and IMEStateManager::NotifyIME().

MozReview-Commit-ID: DtjoxtRIDdK
2016-07-10 14:36:02 +08:00
Kartikaya Gupta
c7f9770ada Bug 1255555 - When a frame reconstruction triggers caret elements to be cloned, ensure the dummy touch listeners are re-registered on the clones. r=tylin
MozReview-Commit-ID: 8txWmd64LC9
2016-07-11 08:16:39 -04:00
Ting-Yu Lin
d861bebff3 Bug 1283828 - Ensure output arguments are set in GetFrameForFirstRangeStartOrLastRangeEnd if returned frame isn't nullptr. r=mats
MozReview-Commit-ID: 3sC3HLPrOtF
2016-07-04 17:39:15 +08:00
Masayuki Nakano
09b74b02de Bug 1278014 part.5 Rename SelectionType::SELECTION_NORMAL to SelectionType::eNormal r=smaug
MozReview-Commit-ID: AAdxTTKEvrk
2016-06-09 18:35:22 +09:00
Masayuki Nakano
4b3d1e8406 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
2016-06-11 11:06:37 +09:00
Ting-Yu Lin
7af948d643 Bug 1266782 - Use RefPtr to hold document and selection in ExtendPhoneNumberSelection. r=mats
MozReview-Commit-ID: 3zAgKt7r8TO
2016-04-28 13:59:39 +08:00