servo/components
Emilio Cobos Álvarez 2e388e860d style: Align user-select behavior more with other UAs.
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
2018-12-02 14:17:20 -05:00
..
allocator Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
atoms Auto merge of #22224 - pyfisch:composition-webdriver, r=nox 2018-11-20 03:32:25 -05:00
background_hang_monitor Update MPL license to https (part 5) 2018-11-27 19:09:17 +01:00
bluetooth Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
bluetooth_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
canvas Update webrender 2018-11-27 17:33:13 -08:00
canvas_traits Make HTMLCanvasElement::fetch_all_data return a shared memory blob 2018-11-21 12:53:50 +01:00
compositing Update webrender 2018-11-27 17:33:13 -08:00
config Update env_logger to 0.6 2018-11-29 12:40:24 +01:00
constellation introduce a background-hang-monitor: 2018-11-26 14:15:33 +08:00
debugger Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
deny_public_fields Update syn and related dependencies 2018-11-30 17:48:41 +01:00
devtools Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
devtools_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
dom_struct Update syn and related dependencies 2018-11-30 17:48:41 +01:00
domobject_derive Update syn and related dependencies 2018-11-30 17:48:41 +01:00
embedder_traits Update webrender 2018-11-27 17:33:13 -08:00
fallible Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
geometry Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
gfx Auto merge of #22221 - Eijebong:random-depup, r=nox 2018-11-27 11:27:54 -05:00
gfx_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
hashglobe cargo fix --edition 2018-11-10 17:47:28 +01:00
jstraceable_derive Update syn and related dependencies 2018-11-30 17:48:41 +01:00
layout Update webrender 2018-11-27 17:33:13 -08:00
layout_thread introduce a background-hang-monitor: 2018-11-26 14:15:33 +08:00
layout_traits introduce a background-hang-monitor: 2018-11-26 14:15:33 +08:00
malloc_size_of Update mozjs and enable 'init_once' feature for Android 2018-11-19 09:11:54 +01:00
malloc_size_of_derive Update syn and related dependencies 2018-11-30 17:48:41 +01:00
metrics Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
msg introduce a background-hang-monitor: 2018-11-26 14:15:33 +08:00
net net: Wait for underlying response body of filtered responses. 2018-11-30 19:03:47 -05:00
net_traits Change Response's statusText default value from 'Ok' to an empty string 2018-11-27 19:26:40 +02:00
pixels Call rgba8_byte_swap_colors_inplace on the WebGL thread 2018-11-20 10:14:52 +01:00
profile Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
profile_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
rand Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
range Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
remutex Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
script Auto merge of #22336 - jdm:image-reload, r=Manishearth 2018-11-30 22:38:49 -05:00
script_layout_interface introduce a background-hang-monitor: 2018-11-26 14:15:33 +08:00
script_plugins Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
script_traits Update webrender 2018-11-27 17:33:13 -08:00
selectors Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
servo Update env_logger to 0.6 2018-11-29 12:40:24 +01:00
servo_arc cargo fix --edition 2018-11-10 17:47:28 +01:00
size_of_test Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
std_test_override Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
style style: Align user-select behavior more with other UAs. 2018-12-02 14:17:20 -05:00
style_derive Update syn and related dependencies 2018-11-30 17:48:41 +01:00
style_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
url Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
webdriver_server Update webrender 2018-11-27 17:33:13 -08:00
webvr Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
webvr_traits Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00