зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1676970 - Always consider text controls has independent selection r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D97720
This commit is contained in:
Родитель
4a410a48ae
Коммит
40f2b82d3e
|
@ -0,0 +1,20 @@
|
|||
<script>
|
||||
function go() {
|
||||
a.appendChild(c)
|
||||
a.getRootNode().addEventListener("DOMSubtreeModified", eh, { once: true })
|
||||
b.setAttribute("oninvalid", "eh()")
|
||||
}
|
||||
function eh() {
|
||||
b.setAttribute("role", "dialog")
|
||||
window.scrollBy(0.802, 0.384)
|
||||
var x = document.getSelection()
|
||||
x.extend(a)
|
||||
x.modify("move", "forward", "lineboundary")
|
||||
a.style.setProperty("column-span", "all")
|
||||
}
|
||||
</script>
|
||||
<body onload=go()>
|
||||
<select>
|
||||
<option id="a" contenteditable="true">x</span>
|
||||
<input id="b">
|
||||
<textarea id="c">
|
|
@ -787,6 +787,7 @@ asserts(0-7) load 1654925.html
|
|||
load 1663222.html
|
||||
load 1666592.html
|
||||
load 1670336.html
|
||||
load 1676970.html
|
||||
HTTP load 1677518-1.html
|
||||
load 1680406.html
|
||||
load 1681788.html
|
||||
|
|
|
@ -5263,20 +5263,32 @@ static bool SelfIsSelectable(nsIFrame* aFrame, uint32_t aFlags) {
|
|||
}
|
||||
|
||||
static bool SelectionDescendToKids(nsIFrame* aFrame) {
|
||||
StyleUserSelect style = aFrame->StyleUIReset()->mUserSelect;
|
||||
nsIFrame* parent = aFrame->GetParent();
|
||||
// If we are only near (not directly over) then don't traverse
|
||||
// frames with independent selection (e.g. text and list controls)
|
||||
// unless we're already inside such a frame (see bug 268497). Note that this
|
||||
// prevents any of the users of this method from entering form controls.
|
||||
// frames with independent selection (e.g. text and list controls, see bug
|
||||
// 268497). Note that this prevents any of the users of this method from
|
||||
// entering form controls.
|
||||
// XXX We might want some way to allow using the up-arrow to go into a form
|
||||
// control, but the focus didn't work right anyway; it'd probably be enough
|
||||
// if the left and right arrows could enter textboxes (which I don't believe
|
||||
// they can at the moment)
|
||||
return !aFrame->IsGeneratedContentFrame() && style != StyleUserSelect::All &&
|
||||
style != StyleUserSelect::None &&
|
||||
(parent->HasAnyStateBits(NS_FRAME_INDEPENDENT_SELECTION) ||
|
||||
!aFrame->HasAnyStateBits(NS_FRAME_INDEPENDENT_SELECTION));
|
||||
if (aFrame->IsTextInputFrame() || aFrame->IsListControlFrame()) {
|
||||
MOZ_ASSERT(aFrame->HasAnyStateBits(NS_FRAME_INDEPENDENT_SELECTION));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Failure in this assertion means a new type of frame forms the root of an
|
||||
// NS_FRAME_INDEPENDENT_SELECTION subtree. In such case, the condition above
|
||||
// should be changed to handle it.
|
||||
MOZ_ASSERT_IF(
|
||||
aFrame->HasAnyStateBits(NS_FRAME_INDEPENDENT_SELECTION),
|
||||
aFrame->GetParent()->HasAnyStateBits(NS_FRAME_INDEPENDENT_SELECTION));
|
||||
|
||||
if (aFrame->IsGeneratedContentFrame()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto style = aFrame->StyleUIReset()->mUserSelect;
|
||||
return style != StyleUserSelect::All && style != StyleUserSelect::None;
|
||||
}
|
||||
|
||||
static FrameTarget GetSelectionClosestFrameForChild(nsIFrame* aChild,
|
||||
|
|
Загрузка…
Ссылка в новой задаче