Bug 1639087 - Add dragcaret event by accessible caret. r=TYLin,smaug

To support magnifying glass on GeckoView, I would like to add `dragcaret`
event and, clientX and clientX in CaretStateChangedEvent chrome event.

Actually, accessible caret fires `presscaret` and `releasecaret` when
accessbile caret is pressed or released. But when dragging this caret, no
chrome event is fired. Since magnifying glass listens to moving this caret,
I would like `dargcaret` for GeckoView.

Also, Users' dragging point is necessary to set better position of magnifying
glass windows. So I also want client point of dragging point on `presscaret`
and `dragcaret` event.

This event and properties are on layout.accessiblecaret.magnifier.enabled=true,
So this can be only for GeckoView.

Differential Revision: https://phabricator.services.mozilla.com/D137965
This commit is contained in:
Makoto Kato 2022-04-08 05:11:48 +00:00
Родитель 03d33c13bf
Коммит 28844e8f80
8 изменённых файлов: 228 добавлений и 75 удалений

Просмотреть файл

@ -11,7 +11,8 @@ enum CaretChangedReason {
"taponcaret",
"presscaret",
"releasecaret",
"scroll"
"scroll",
"dragcaret"
};
dictionary CaretStateChangedEventInit : EventInit {
@ -23,6 +24,8 @@ dictionary CaretStateChangedEventInit : EventInit {
boolean selectionVisible = false;
boolean selectionEditable = false;
DOMString selectedTextContent = "";
long clientX = 0;
long clientY = 0;
};
[ChromeOnly,
@ -40,4 +43,8 @@ interface CaretStateChangedEvent : Event {
readonly attribute boolean selectionVisible;
readonly attribute boolean selectionEditable;
readonly attribute DOMString selectedTextContent;
[Pref="layout.accessiblecaret.magnifier.enabled"]
readonly attribute long clientX;
[Pref="layout.accessiblecaret.magnifier.enabled"]
readonly attribute long clientY;
};

Просмотреть файл

@ -497,7 +497,7 @@ nsresult AccessibleCaretManager::PressCaret(const nsPoint& aPoint,
mOffsetYToCaretLogicalPosition =
mActiveCaret->LogicalPosition().y - aPoint.y;
SetSelectionDragState(true);
DispatchCaretStateChangedEvent(CaretChangedReason::Presscaret);
DispatchCaretStateChangedEvent(CaretChangedReason::Presscaret, &aPoint);
rv = NS_OK;
}
@ -518,6 +518,10 @@ nsresult AccessibleCaretManager::DragCaret(const nsPoint& aPoint) {
// We want to scroll the page even if we failed to drag the caret.
StartSelectionAutoScrollTimer(aPoint);
UpdateCarets();
if (StaticPrefs::layout_accessiblecaret_magnifier_enabled()) {
DispatchCaretStateChangedEvent(CaretChangedReason::Dragcaret, &aPoint);
}
return NS_OK;
}
@ -537,7 +541,7 @@ nsresult AccessibleCaretManager::TapCaret(const nsPoint& aPoint) {
nsresult rv = NS_ERROR_FAILURE;
if (GetCaretMode() == CaretMode::Cursor) {
DispatchCaretStateChangedEvent(CaretChangedReason::Taponcaret);
DispatchCaretStateChangedEvent(CaretChangedReason::Taponcaret, &aPoint);
rv = NS_OK;
}
@ -1427,7 +1431,7 @@ void AccessibleCaretManager::StopSelectionAutoScrollTimer() const {
}
void AccessibleCaretManager::DispatchCaretStateChangedEvent(
CaretChangedReason aReason) {
CaretChangedReason aReason, const nsPoint* aPoint) {
if (MaybeFlushLayout() == Terminated::Yes) {
return;
}
@ -1488,6 +1492,12 @@ void AccessibleCaretManager::DispatchCaretStateChangedEvent(
init.mCaretVisuallyVisible = mCarets.HasVisuallyVisibleCaret();
init.mSelectedTextContent = StringifiedSelection();
if (aPoint) {
CSSIntPoint pt = CSSPixel::FromAppUnitsRounded(*aPoint);
init.mClientX = pt.x;
init.mClientY = pt.y;
}
RefPtr<CaretStateChangedEvent> event = CaretStateChangedEvent::Constructor(
doc, u"mozcaretstatechanged"_ns, init);

Просмотреть файл

@ -304,8 +304,11 @@ class AccessibleCaretManager {
// This function will flush layout, so caller must ensure the PresShell is
// still valid after calling this method.
// @param aPoint The event point when the user is pressing or dragging a
// caret, which is relative to the root frame.
MOZ_CAN_RUN_SCRIPT
virtual void DispatchCaretStateChangedEvent(dom::CaretChangedReason aReason);
virtual void DispatchCaretStateChangedEvent(dom::CaretChangedReason aReason,
const nsPoint* aPoint = nullptr);
// ---------------------------------------------------------------------------
// Member variables

Просмотреть файл

@ -105,8 +105,8 @@ class AccessibleCaretManagerTester : public ::testing::Test {
Terminated MaybeFlushLayout() override { return Terminated::No; }
MOCK_CONST_METHOD0(GetCaretMode, CaretMode());
MOCK_METHOD1(DispatchCaretStateChangedEvent,
void(CaretChangedReason aReason));
MOCK_METHOD2(DispatchCaretStateChangedEvent,
void(CaretChangedReason aReason, const nsPoint* aPoint));
MOCK_CONST_METHOD1(HasNonEmptyTextContent, bool(nsINode* aNode));
}; // class MockAccessibleCaretManager
@ -148,7 +148,7 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
.WillRepeatedly(Return(CaretMode::Selection));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(3);
mManager.UpdateCarets();
@ -176,33 +176,33 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("update"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Visibilitychange))
CaretChangedReason::Visibilitychange, nullptr))
.Times(1);
EXPECT_CALL(check, Call("mouse down"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("reflow"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("blur"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("mouse up"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("reflow2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
}
@ -256,33 +256,33 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("update"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Visibilitychange))
CaretChangedReason::Visibilitychange, nullptr))
.Times(1);
EXPECT_CALL(check, Call("mouse down"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("reflow"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("blur"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("mouse up"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("reflow2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
}
@ -330,18 +330,18 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("update"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Visibilitychange))
CaretChangedReason::Visibilitychange, nullptr))
.Times(1);
EXPECT_CALL(check, Call("keyboard"));
// No CaretStateChanged events should be dispatched since the caret has
// being hidden in cursor mode.
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
}
// Simulate typing the end of the input.
@ -378,15 +378,15 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("updatecarets"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart1"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("reflow1"));
// After scroll ended, first caret is visible and second caret is out of
@ -395,20 +395,20 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend1"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("reflow2"));
// After the scroll ended, both carets are visible.
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend2"));
}
@ -466,18 +466,18 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("updatecarets"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart1"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("scrollPositionChanged1"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("reflow1"));
// After scroll ended, first caret is visible and second caret is out of
@ -486,23 +486,23 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend1"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_)).Times(0);
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(_, nullptr)).Times(0);
EXPECT_CALL(check, Call("scrollPositionChanged2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("reflow2"));
// After the scroll ended, both carets are visible.
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend2"));
}
@ -564,12 +564,12 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("updatecarets"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll))
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr))
.Times(1);
EXPECT_CALL(check, Call("scrollstart1"));
@ -577,12 +577,12 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
EXPECT_CALL(mManager.FirstCaret(), SetPosition(_, _))
.WillRepeatedly(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("scrollend1"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll))
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr))
.Times(1);
EXPECT_CALL(check, Call("scrollstart2"));
@ -590,7 +590,7 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
EXPECT_CALL(mManager.FirstCaret(), SetPosition(_, _))
.WillRepeatedly(Return(PositionChangedResult::Position));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("scrollend2"));
}
@ -628,12 +628,12 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition))
CaretChangedReason::Updateposition, nullptr))
.Times(1);
EXPECT_CALL(check, Call("updatecarets"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Visibilitychange))
CaretChangedReason::Visibilitychange, nullptr))
.Times(1);
EXPECT_CALL(check, Call("hidecarets"));
@ -689,33 +689,33 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("updatecarets"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart1"));
EXPECT_CALL(mManager.FirstCaret(), SetPosition(_, _))
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend1"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend2"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("scrollstart3"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("scrollend3"));
}
@ -770,37 +770,37 @@ MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION {
InSequence dummy;
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("singletap updatecarets"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("longtap updatecarets"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("longtap scrollstart1"));
EXPECT_CALL(mManager.FirstCaret(), SetPosition(_, _))
.WillOnce(Return(PositionChangedResult::Invisible));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("longtap scrollend1"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("longtap scrollstart2"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("longtap scrollend2"));
EXPECT_CALL(mManager,
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Scroll, nullptr));
EXPECT_CALL(check, Call("longtap scrollstart3"));
EXPECT_CALL(mManager, DispatchCaretStateChangedEvent(
CaretChangedReason::Updateposition));
CaretChangedReason::Updateposition, nullptr));
EXPECT_CALL(check, Call("longtap scrollend3"));
}

Просмотреть файл

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<p id="display">
<div id="editable" contenteditable style="width: 400px; font-size: 4em;">foobarbaz</div>
</p>
<script>
const SimpleTest = parent.SimpleTest;
const is = parent.is;
const info = parent.info;
const isnot = parent.isnot;
const ok = parent.ok;
window.addEventListener("load", runTest);
async function runTest() {
let target = document.getElementById("editable");
target.focus();
let targetRect = target.getBoundingClientRect();
let selection = window.getSelection();
// Select word then show accessible caret
synthesizeTouchAtCenter(target, { type: "touchstart" });
synthesizeMouseAtCenter(target, { type: "mouselongtap" });
synthesizeTouchAtCenter(target, { type: "touchend" });
ok(!selection.getRangeAt(0).collapsed, "Select word");
let rangeRect = selection.getRangeAt(0).getBoundingClientRect();
let presscaret = 0;
let dragcaret = 0;
let releasecaret = 0;
const dragStart = {
x: Math.round(rangeRect.left),
y: Math.round(rangeRect.bottom + 12)
};
const dragEnd = {
x: Math.round(rangeRect.left + 60),
y: Math.round(rangeRect.bottom + 12)
};
let handler;
let promise = new Promise(resolve => {
handler = function(e) {
info("mozcaretstatechanged is fired with " + e.reason);
switch (e.reason) {
case "presscaret":
is(dragStart.x, e.clientX, "dragcaret event has clientX data.");
is(dragStart.y, e.clientY, "dragcaret event has clientY data.");
presscaret++;
break;
case "dragcaret":
is(dragEnd.x, e.clientX, "dragcaret event has clientX data.");
is(dragEnd.y, e.clientY, "dragcaret event has clientY data.");
dragcaret++;
break;
case "releasecaret":
releasecaret++;
resolve();
break;
}
};
});
SpecialPowers.addChromeEventListener("mozcaretstatechanged", handler, true);
// Drag accessible caret
synthesizeTouchAtPoint(dragStart.x, dragStart.y, { type: "touchstart" });
synthesizeTouchAtPoint(dragEnd.x, dragEnd.y, { type: "touchmove" });
synthesizeTouchAtPoint(dragEnd.x, dragEnd.y, { type: "touchend" });
await promise;
SpecialPowers.removeChromeEventListener("mozcaretstatechanged", handler, true);
is(presscaret, 1, "presscaret is fired correctly");
is(dragcaret, 1, "presscaret is fired correctly");
is(releasecaret, 1, "releasecaret is fired correctly");
let newRangeRect = selection.getRangeAt(0).getBoundingClientRect();
isnot(rangeRect.left, newRangeRect.left,
"Selected range is changed by dragging accessible caret");
SimpleTest.finish();
}
</script>
</body>
</html>

Просмотреть файл

@ -8,6 +8,8 @@ support-files =
selection-utils.js
!/gfx/layers/apz/test/mochitest/apz_test_utils.js
[test_accessiblecaret_magnifier.html]
support-files = accessiblecaret_magnifier.html
[test_after_paint_pref.html]
[test_border_radius_hit_testing.html]
support-files = border_radius_hit_testing_iframe.html

Просмотреть файл

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1639087
-->
<head>
<title>Test for magnifier event</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1639087">Mozilla Bug 1639087</a>
<p id="display">
<div id="container" style="width: 600px; height: 500px;"></div>
</p>
<script>
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({
"set": [
["layout.accessiblecaret.enabled", true],
["layout.accessiblecaret.magnifier.enabled", true]
]
}, () => {
let iframe = document.createElement("iframe");
iframe.src = "accessiblecaret_magnifier.html";
iframe.style.width = "100%";
iframe.style.height = "100%";
document.getElementById('container').appendChild(iframe);
});
</script>
</body>
</html>

Просмотреть файл

@ -7221,6 +7221,13 @@
value: false
mirror: always
# To support magnify glass, whether we dispatch additional chrome event such as
# dragcaret.
- name: layout.accessiblecaret.magnifier.enabled
type: bool
value: @IS_ANDROID@
mirror: always
# One of several prefs affecting the maximum area to pre-render when animating
# a large element on the compositor.
# This pref enables transform (and transform like properties) animations on a