gecko-dev/accessible
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
..
android Bug 1509111 - Populate viewIdResourceName correctly. r=yzen 2018-11-21 21:07:20 +00:00
aom Bug 1479033 - Introduce Android accessibility directory. r=Jamie 2018-09-18 10:43:18 -07:00
atk Bug 1504906 - Add another -Werror exception for G_DEFINE_TYPE_EXTENDED. r=gps 2018-11-08 19:49:38 +09:00
base Bug 1380451 - create HTML table caption accessible unconditionally, r=Jamie 2018-11-25 23:39:52 +00:00
generic Bug 1506547 - Align user-select behavior more with other UAs. r=mats 2018-11-26 09:21:37 +00:00
html Bug 1499947 - Part 1 - Remove XULProgressMeterAccessible and its base template class. r=Jamie 2018-11-20 14:10:38 +00:00
interfaces Bug 1499947 - Part 1 - Remove XULProgressMeterAccessible and its base template class. r=Jamie 2018-11-20 14:10:38 +00:00
ipc Bug 1508870 - Make a distinction between an empty returned string versus a null pointer, r=Jamie 2018-11-22 06:09:31 +00:00
jsat Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop 2018-10-19 12:55:39 +00:00
mac Bug 1479036 - Android classes role additions. r=surkov 2018-08-09 14:43:00 +03:00
other Bug 1479033 - Introduce Android accessibility directory. r=Jamie 2018-09-18 10:43:18 -07:00
tests Bug 1380451 - create HTML table caption accessible unconditionally, r=Jamie 2018-11-25 23:39:52 +00:00
windows Bug 1052866 part 2: Handle QI to IAccessibleText for tables. r=MarcoZ 2018-10-29 06:36:51 +00:00
xpcom Bug 1052866 - Expose IAccessibleText on tables, rows, etc., r=tbsaunde. Bustage fix by MarcoZ. 2018-10-26 11:07:27 +02:00
xul Bug 1509222 - XUL toolbarbutton with checked="true' but not type="checkbox" doesn't get the pressed state, r=Jamie 2018-11-22 22:39:51 +00:00
.eslintrc.js Bug 1436389 - Update complexity rules to adapt for the algorithm in the new ESLint. r=mossop 2018-02-07 16:16:09 +00:00
moz.build Bug 1479033 - Introduce Android accessibility directory. r=Jamie 2018-09-18 10:43:18 -07:00