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

174 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano cd53d5600e Bug 1816581 - part 6: Move the static methods used for moving caret or considering caret geometry into new utility class r=emilio
The methods are in `nsCaret`, `nsFrameSelection` and `dom::Selection`.  That
makes harder to read, and they are called each other, so, they are reused for
different purpose.  Therefore, it must be better to move them into a new class.
Then, the name differences may become more unclear.  If you think so, feel free
to request renaming some methods of them.

Differential Revision: https://phabricator.services.mozilla.com/D197288
2023-12-27 04:42:12 +00:00
Masayuki Nakano ac6767faae Bug 1816581 - part 2: Make `nsCaret::GetCaretFrameForNodeOffset` static r=emilio
Oddly, it updates `nsFrameSelection` instance and some root callers may depend
on that. Therefore, this patch keep updating `nsFrameSelection` in the callers.

Differential Revision: https://phabricator.services.mozilla.com/D197284
2023-12-27 04:42:10 +00:00
Masayuki Nakano fe9fef936b Bug 1816581 - part 1: Make `CaretAssociationHint` an enum class r=emilio
For forward-decl-able.

Differential Revision: https://phabricator.services.mozilla.com/D197283
2023-12-27 04:42:09 +00:00
Masayuki Nakano 87da8e59cd Bug 1612076 - Make `AdjustCaretFrameForLineEnd` stop scanning text node if first node is editable but reached non-editable one r=emilio
When pressing `ArrowLeft` key at:
```
<p>abc</p><p><span contenteditable=false>def</span>{}<br></p>
```
, caret is moved into the non-editable text because
`nsCaret::GetCaretFrameForNodeOffset` looks for a preceding text node from
the `BRFrame`. This is required if the preceding text node ends with a
collapsible white-space but followed by a `<br>` because the text frame
should not contain the white-space rect and `BRFrame` frame should be next
to it, i.e., the white-space looks like a overflown content.

So, for rendering a caret, the method needs to return non-editable text frame
even in the case, but for considering new caret position in the DOM tree, it
should not return non-editable text frame.

Therefore, this patch adds a param to `nsCaret::GetCaretFrameForNodeOffset()`
which forcibly return editable content frame or not and makes
`Selection::GetPrimaryOrCaretFrameForNodeOffset` call it with the new option
because its callers are the handler of caret navigation.

Differential Revision: https://phabricator.services.mozilla.com/D196259
2023-12-19 01:58:07 +00:00
Cristian Tuns 95afdf2e8f Backed out changeset a69c40accbf0 (bug 1860328) for causing mochitest failures in nsDisplayList.cpp CLOSED TREE 2023-12-06 13:05:13 -05:00
Sean Feng c52c227f53 Bug 1860328 - Fix a bug where caret misses when dragging and dropping r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D192377
2023-12-06 16:29:18 +00:00
Florian Quèze 59b4cf8598 Bug 1828008 - Avoid creating timers with a delay of UINT32_MAX in nsCaret::ResetBlinking, r=emilio.
Differential Revision: https://phabricator.services.mozilla.com/D175421
2023-04-14 13:25:13 +00:00
Greg Tatum ec908112f4 Bug 1738057 - Split out BidiEmbeddingLevel into its own file; r=platform-i18n-reviewers,dminor
This should speed up re-compile times, as mozilla/intl/Bidi.h will only
be included in a few places.

Differential Revision: https://phabricator.services.mozilla.com/D129662
2021-11-16 15:11:58 +00:00
Greg Tatum ee2694c97d Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-20 14:01:21 +00:00
Butkovits Atila 01c5e2aed8 Backed out 3 changesets (bug 1719546) for causing SM bustages at Bidi.h. CLOSED TREE
Backed out changeset c4d6ffc7e445 (bug 1719546)
Backed out changeset a1f7ed6c4251 (bug 1719546)
Backed out changeset e69fc596f2c3 (bug 1719546)
2021-10-19 21:09:47 +03:00
Greg Tatum f250d90114 Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-19 16:55:36 +00:00
Emilio Cobos Álvarez 3a75610a0f Bug 1663475 - Paint caret geometry from the containing block. r=mats
This matches other browsers and shouldn't be too terrible, though I'm
not quite a fan of it.

Differential Revision: https://phabricator.services.mozilla.com/D89483
2021-07-23 12:50:31 +00:00
Miko Mynttinen 76c9644105 Bug 1720804 - Part 1: Move majority of the display list code inside mozilla namespace r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D120041
2021-07-19 11:28:20 +00:00
Alexandru Michis fbd939b860 Backed out 2 changesets (bug 1720804) for causing bustages.
CLOSED TREE

Backed out changeset 5278e88c6d34 (bug 1720804)
Backed out changeset 1acb4ed79b6b (bug 1720804)
2021-07-16 18:10:11 +03:00
Miko Mynttinen ffc501ddc9 Bug 1720804 - Part 1: Move majority of the display list code inside mozilla namespace r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D120041
2021-07-16 14:36:34 +00:00
Mirko Brodesser d7bf5cbe1f Bug 1685303: part 20) `const`-correct internals of `AccessibleCaretManager::DispatchCaretStateChangedEvent. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D102302
2021-01-20 10:11:20 +00:00
Narcis Beleuzu db9dfe3249 Backed out changeset 5dd5f0d3a09b (bug 1663475) for mochitest failure on test_reftests_with_caret.html CLOSED TREE 2020-10-06 06:22:01 +03:00
Emilio Cobos Álvarez 9d6f081a11 Bug 1663475 - Paint caret geometry from the containing block. r=mats
This matches other browsers and shouldn't be too terrible, though I'm
not quite a fan of it.

Differential Revision: https://phabricator.services.mozilla.com/D89483
2020-10-06 00:06:30 +00:00
Kagami Sascha Rosylight 02e4819dbc Bug 1645003 - Return pointer from GetPrimaryOrCaretFrameForNodeOffset and its deps r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D80063
2020-06-18 10:26:47 +00:00
Masayuki Nakano f5737567dd Bug 1544343 - part 3: Make layout use mozilla::PresShell instead of nsIPresShell as far as possible r=emilio
This patch changes remaining things under `layout/`.  However, there are some
places which still need to use `nsIPresShell`.  That will be fixed in a
follow up bug.

Differential Revision: https://phabricator.services.mozilla.com/D27477

--HG--
extra : moz-landing-system : lando
2019-04-16 07:25:10 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Emilio Cobos Álvarez 9ed36d7ba6 Bug 1506547 - Align user-select behavior more with other UAs. r=mats
There's a few subtle behavior changes here, which I'll try to break down in the
commit message.

The biggest one is the EditableDescendantCount stuff going away. This
was added in bug 1181130, to prevent clicking on the non-editable div from
selecting the editable div inside. This is problematic for multiple reasons:

 * First, I don't think non-editable regions of an editable element should
   be user-select: all.

 * Second, it just doesn't work in Shadow DOM (the editable descendant count is
   not kept up-to-date when not in the uncomposed doc), so nested
   contenteditables behave differently inside vs. outside a Shadow Tree.

 * Third, I think it's user hostile to just entirely disable selection if you
   have a contenteditable descendant as a child of a user-select: all thing.

   WebKit behaves like this patch in the following test-case (though not Blink):

     https://crisal.io/tmp/user-select-all-contenteditable-descendant.html

   Edge doesn't seem to support user-select: all at all (no pun intended).

   But we don't allow to select anything at all which looks wrong.

 * Fourth, it's not tested at all (which explains how we broke it in Shadow DOM
   and not even notice...).

In any case I've verified that this doesn't regress the editor from that bug. If
this regresses anything we can fix it as outlined in the first bullet point
above, which should also make us more compatible with other UAs in that
test-case.

The other change is `all` not overriding everything else. So, something like:

  <div style="-webkit-user-select: all">All <div style="-webkit-user-select: none">None</div></div>

Totally ignores the -webkit-user-select: none declaration in Firefox before this
change. This doesn't match any other UA nor the spec, and this patch aligns us
with WebKit / Blink.

This in turn makes us not need -moz-text anymore, whose only purpose was to
avoid this.

This also fixes a variety of bugs uncovered by the previous changes, like the
SetIgnoreUserModify(false) call in editor being completely useless, since
presShell->SetCaretEnabled ended in nsCaret::SetVisible, which overrode it.

This in turn uncovered even more bugs, from bugs in the caret painting code,
like not checking -moz-user-modify on the right frame if you're the last frame
of a line, to even funnier bits where before this patch you show the caret but
can't write at all...

In any case, the new setup I came up with is that when you're editing (the
selection is focused on an editable node) moving the caret forces it to end up
in an editable node, thus jumping over non-editable ones.

This has the nice effect of not completely disabling selection of
-moz-user-select: all elements that have editable descendants (which was a very
ad-hoc hack for bug 1181130, and somewhat broken per the above), and also
not needing the -moz-user-select: all for non-editable bits in contenteditable.css
at all.

This also fixes issues with br-skipping like not being able to insert content in
the following test-case:

  <div contenteditable="true"><span contenteditable="false">xyz </span><br>editable</div>

If you start moving to the left from the second line, for example.

I think this yields way better behavior in all the relevant test-cases from bug
1181130 / bug 1109968 / bug 1132768, shouldn't cause any regression, and the
complexity is significantly reduced in some places.

There's still some other broken bits that this patch doesn't fix, but I'll file
follow-ups for those.

Differential Revision: https://phabricator.services.mozilla.com/D12687

--HG--
extra : moz-landing-system : lando
2018-11-26 09:21:37 +00:00
Brindusan Cristian 31f0c21cca Backed out changeset 1575904619b5 (bug 1506547) for mochitest failures on test_reftests_with_caret.html. 2018-11-26 03:03:14 +02:00
Emilio Cobos Álvarez b74c31e4d9 Bug 1506547 - Align user-select behavior more with other UAs. r=mats
There's a few subtle behavior changes here, which I'll try to break down in the
commit message.

The biggest one is the EditableDescendantCount stuff going away. This
was added in bug 1181130, to prevent clicking on the non-editable div from
selecting the editable div inside. This is problematic for multiple reasons:

 * First, I don't think non-editable regions of an editable element should
   be user-select: all.

 * Second, it just doesn't work in Shadow DOM (the editable descendant count is
   not kept up-to-date when not in the uncomposed doc), so nested
   contenteditables behave differently inside vs. outside a Shadow Tree.

 * Third, I think it's user hostile to just entirely disable selection if you
   have a contenteditable descendant as a child of a user-select: all thing.

   WebKit behaves like this patch in the following test-case (though not Blink):

     https://crisal.io/tmp/user-select-all-contenteditable-descendant.html

   Edge doesn't seem to support user-select: all at all (no pun intended).

   But we don't allow to select anything at all which looks wrong.

 * Fourth, it's not tested at all (which explains how we broke it in Shadow DOM
   and not even notice...).

In any case I've verified that this doesn't regress the editor from that bug. If
this regresses anything we can fix it as outlined in the first bullet point
above, which should also make us more compatible with other UAs in that
test-case.

The other change is `all` not overriding everything else. So, something like:

  <div style="-webkit-user-select: all">All <div style="-webkit-user-select: none">None</div></div>

Totally ignores the -webkit-user-select: none declaration in Firefox before this
change. This doesn't match any other UA nor the spec, and this patch aligns us
with WebKit / Blink.

This in turn makes us not need -moz-text anymore, whose only purpose was to
avoid this.

This also fixes a variety of bugs uncovered by the previous changes, like the
SetIgnoreUserModify(false) call in editor being completely useless, since
presShell->SetCaretEnabled ended in nsCaret::SetVisible, which overrode it.

This in turn uncovered even more bugs, from bugs in the caret painting code,
like not checking -moz-user-modify on the right frame if you're the last frame
of a line, to even funnier bits where before this patch you show the caret but
can't write at all...

In any case, the new setup I came up with is that when you're editing (the
selection is focused on an editable node) moving the caret forces it to end up
in an editable node, thus jumping over non-editable ones.

This has the nice effect of not completely disabling selection of
-moz-user-select: all elements that have editable descendants (which was a very
ad-hoc hack for bug 1181130, and somewhat broken per the above), and also
not needing the -moz-user-select: all for non-editable bits in contenteditable.css
at all.

This also fixes issues with br-skipping like not being able to insert content in
the following test-case:

  <div contenteditable="true"><span contenteditable="false">xyz </span><br>editable</div>

If you start moving to the left from the second line, for example.

I think this yields way better behavior in all the relevant test-cases from bug
1181130 / bug 1109968 / bug 1132768, shouldn't cause any regression, and the
complexity is significantly reduced in some places.

There's still some other broken bits that this patch doesn't fix, but I'll file
follow-ups for those.

Differential Revision: https://phabricator.services.mozilla.com/D12687

--HG--
extra : moz-landing-system : lando
2018-11-25 20:01:07 +00:00
Boris Zbarsky 9748db120d Bug 1455676 part 8. Remove nsIDOMNode usage from layout/. r=qdot 2018-05-29 22:58:48 -04:00
Boris Zbarsky 1fb03996f4 Bug 1387143 part 29. Remove nsISelection. r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky a44e6132ff Bug 1387143 part 28. Remove nsISelection::AsSelection(). r=mats 2018-05-08 13:52:42 -04:00
Boris Zbarsky f7d68d6078 Bug 1387143 part 21. Remove nsISelection getters for anchor and focus points. r=mats
Instead of copying spec-duplicating comments from nsISelection.idl to
Selection.webidl, this just points the latter to the right spec.
2018-05-08 13:52:38 -04:00
Boris Zbarsky 0efb178bc2 Bug 1387143 part 11. Support non-XPCOM weakreference on Selection. r=mats
This way we don't have to deal with QI to get a Selection out of a weakref.

mfbt weakrefs don't have a SizeOfOnlyThis.  In any case, the memory used by the
weakref itself is pretty minor...
2018-05-08 13:52:37 -04:00
Boris Zbarsky 145e566cd8 Bug 1444686 part 10. Remove nsIDOMDragEvent::GetDataTransfer. r=mystor
MozReview-Commit-ID: LwKqWBGXVcN
2018-03-13 16:24:00 -04:00
Daniel Holbert 680815cd6e Bug 1412346 part 5: (automated patch) Switch a bunch of C++ files in layout to use our standard mode lines. r=jfkthame
This patch was generated automatically by the "modeline.py" script, available
here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py

For every file that is modified in this patch, the changes are as follows:
 (1) The patch changes the file to use the exact C++ mode lines from the
     Mozilla coding style guide, available here:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line

 (2) The patch deletes any blank lines between the mode line & the MPL
     boilerplate comment.

 (3) If the file previously had the mode lines and MPL boilerplate in a
     single contiguous C++ comment, then the patch splits them into
     separate C++ comments, to match the boilerplate in the coding style.

MozReview-Commit-ID: EuRsDue63tK

--HG--
extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
2017-10-27 10:33:53 -07:00
Ehsan Akhgari c3b6078856 Bug 1390382 - Part 4: Avoid recomputing the selection in nsCaret::SchedulePaint() when the caller has the information available; r=dholbert 2017-08-15 18:57:16 -04:00
Ehsan Akhgari 82df247868 Bug 1390382 - Part 3: Inline nsCaret::IsVisible(); r=dholbert 2017-08-15 18:57:15 -04:00
Ehsan Akhgari 77a5d8cdb7 Bug 1390382 - Part 2: Avoid recomputing the selection in Selection::IsVisible() when the caller has the information available; r=dholbert 2017-08-15 18:57:15 -04:00
Ehsan Akhgari 02b2136122 Bug 1372761 - Avoid needlessly grabbing the timer thread lock when selections change in order to reset the caret timer; r=mats 2017-06-14 17:53:48 -04:00
Mason Chang ef3d9a921c Bug 1337130 - Create a DisplayItemLayer type. r=mattwoodrow 2017-02-14 13:49:27 -08:00
Nicholas Nethercote fd7ca876ef Bug 1232852 (part 4) - Remove some unused parameters in and around layout/base/. r=heycam.
--HG--
extra : rebase_source : 68642322a9fc78bb7eace1501b75003241a44507
2016-01-05 16:08:17 -08: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
Simon Montagu 3457b582d2 Bug 1216096: restore previous RTL caret behaviour by backout of bug 1164963, bug 1177505, and bug 1180417. r=jfkthame 2015-11-10 04:42:23 -08:00
Ting-Yu Lin 4c1ccfafa3 Bug 1200194 - Expose nsCaret::GetFrameAndOffset for reuse. r=roc
This function can be reused by AccessibleCaret.

--HG--
extra : commitid : KCG4QMsPhdY
extra : rebase_source : ec6bb5f771f14d5b39c598c51bccced48909945d
2015-09-09 16:47:20 +08:00
Masayuki Nakano 3645c1dbaf Bug 555642 part.1 nsCaret should have a way to override the caret visible state for hiding caret temporarily and nsEditor should hide caret if composition string doesn't have caret information r=roc 2015-08-17 20:58:38 +09:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Ted Clancy b1d966b6e0 Bug 1164693 - Part 1: Directional caret should point in caret direction in bidi paragraphs. r=smontagu 2015-06-05 21:44:54 -04:00
Mark Capella 27ef7c7715 Bug 988143 - Enable Gecko Touch in Fennec, Android specific nsCaret mods, r=ehsan 2015-05-14 22:06:13 -04:00
Mark Finkle ea1ba80c9b Bug 1159263 - Add support to nsCaret to stop blinking after a set of cycles r=roc r=snorp 2015-04-29 10:23:19 -04:00
Ehsan Akhgari 883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Morris Tseng 8733cb18e1 Bug 1094056 - Use nsCaret::GetGeometryForFrame to determine position of selection carets. r=roc 2014-11-11 22:54:00 +01:00
Jonathan Watt bfe784d925 Bug 1090611 - Make nsCaret::PaintCaret take a Moz2D DrawTarget instead of nsRenderingContext. r=Bas 2014-10-29 17:07:11 +00:00
Trevor Saunders fd5e9d1fcc bug 1047696 - mark a number of classes MOZ_FINAL to get compilers to devirtualize more r=froydnj 2014-08-05 13:33:55 -04:00
Robert O'Callahan 96711a9de4 Bug 1048752. Part 37: GetGeometryForFrame should return a rect instead of an nsresult. r=tn
--HG--
extra : rebase_source : f49846cc50de2a3a616a991d81b38bf6c1d9a2c5
2014-08-06 17:19:32 +12:00