gecko-dev/layout/base/tests/test_bug1550869_video.html
Ting-Yu Lin 73b1eb5bc6 Bug 1550869 - Stop undraggable images from being selected by a single-clicking. r=emilio
This is a rework for the issue in bug 1516963.

The condition `aFrame->IsFrameOfType(nsIFrame::eReplaced)` was added to
avoid breaking
editor/libeditor/tests/test_abs_positioner_positioning_elements.html
because it contains blockified (position:absolute) images in
contenteditable, and we don't want these images to use frame edge. But
for non-editable undraggable images, which have display:inline, we want
them to use frame edge to avoid being selected by a single-clicking.
Note that non-editable draggable images use a different code patch to
handle their operations.

I think it easier to understand by checking the frame types directly. As
for images, we want non-editable images to use frame edge, but not those
editable ones because editor has its own logic to handle all the
dragging operations, etc. Using frame edge for editable images makes
them undraggable, and fails
test_abs_positioner_positioning_elements.html.

Add more tests for empty inline-grid, inline-flex, inline-table, video,
to ensure the behavior is not changed. We don't want them to be selected
by a single-clicking, either.

Note I only test video's selection is collapsed when single-clicking
because I failed to turn off picture-in-picture on <video> in
test_reftests_with_caret.html.

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

--HG--
extra : moz-landing-system : lando
2019-06-18 05:30:35 +00:00

32 lines
941 B
HTML

<!DOCTYPE HTML>
<html>
<title>Bug 1516963: Test AccessibleCaret doesn't show when clicking on an empty video container.</title>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#container {
border: 1px solid blue;
width: 100px;
height: 100px;
background-color: yellow;
}
</style>
<script>
SimpleTest.waitForExplicitFinish();
document.addEventListener("selectionchange", () => {
ok(window.getSelection().isCollapsed, "The selection should be collapsed!");
});
function click() {
let container = document.getElementById("container");
synthesizeMouseAtCenter(container, {});
setTimeout(() => { SimpleTest.finish(); });
}
</script>
<body onload="SimpleTest.waitForFocus(click);">
<video id="container"></video>
</body>
</html>