Bug 1416962 - Remove the support for disabling "drag and select" on touchable devices.
The pref "browser.ignoreNativeFrameTextSelection" was used only by B2G, and
currently not enabled elsewhere, so this code is dead now. Also, this
functionality is obsoleted by AccessibleCaret.
MozReview-Commit-ID: 2kHYXLueFH5
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4083,27 +4083,25 @@ nsFrame::HandlePress(nsPresContext* aPre
// StyleUserSelect::Toggle, need to change this logic
bool useFrameSelection = (selectStyle == StyleUserSelect::Text);
// If the mouse is dragged outside the nearest enclosing scrollable area
// while making a selection, the area will be scrolled. To do this, capture
// the mouse on the nearest scrollable frame. If there isn't a scrollable
// frame, or something else is already capturing the mouse, there's no
// reason to capture.
- bool hasCapturedContent = false;
if (!nsIPresShell::GetCapturingContent()) {
nsIScrollableFrame* scrollFrame =
nsLayoutUtils::GetNearestScrollableFrame(this,
nsLayoutUtils::SCROLLABLE_SAME_DOC |
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN);
if (scrollFrame) {
nsIFrame* capturingFrame = do_QueryFrame(scrollFrame);
nsIPresShell::SetCapturingContent(capturingFrame->GetContent(),
CAPTURE_IGNOREALLOWED);
- hasCapturedContent = true;
}
}
// XXX This is screwy; it really should use the selection frame, not the
// event frame
const nsFrameSelection* frameselection = nullptr;
if (useFrameSelection)
frameselection = GetConstFrameSelection();
@@ -4131,34 +4129,16 @@ nsFrame::HandlePress(nsPresContext* aPre
}
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mouseEvent, this);
ContentOffsets offsets = GetContentOffsetsFromPoint(pt, SKIP_HIDDEN);
if (!offsets.content)
return NS_ERROR_FAILURE;
- // On touchables devices, touch the screen is usually a pan action,
- // so let's reposition the caret if needed but do not select text
- // if the touch did not happen over an editable element. Otherwise,
- // let the user move the caret by tapping and dragging.
- if (!offsets.content->IsEditable() &&
- Preferences::GetBool("browser.ignoreNativeFrameTextSelection", false)) {
- // On touchables devices, mouse events are generated if the gesture is a tap.
- // Such events are never going to generate a drag action, so let's release
- // captured content if any.
- if (hasCapturedContent) {
- nsIPresShell::SetCapturingContent(nullptr, 0);
- }
-
- return fc->HandleClick(offsets.content, offsets.StartOffset(),
- offsets.EndOffset(), false, false,
- offsets.associate);
- }
-
// Let Ctrl/Cmd+mouse down do table selection instead of drag initiation
nsCOMPtr<nsIContent>parentContent;
int32_t contentOffset;
int32_t target;
nsresult rv;
rv = GetDataForTableSelection(frameselection, shell, mouseEvent,
getter_AddRefs(parentContent), &contentOffset,
&target);