mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Optimize IPC for non-cancelable touch events (#35785)
* The cancelable feature is optimized. If the cancelable feature is a non-cancelable feature, no message is sent back to the Compositor. Add a warning log when prevent TouchsequenceInfo cannot be found. Signed-off-by: kongbai1996 <1782765876@qq.com> * fix Clippy Error Reported in the Pipeline. Signed-off-by: kongbai1996 <1782765876@qq.com> --------- Signed-off-by: kongbai1996 <1782765876@qq.com>
This commit is contained in:
parent
ff5683680f
commit
f594691af9
3 changed files with 9 additions and 2 deletions
|
@ -1396,7 +1396,8 @@ impl IOCompositor {
|
||||||
if !self
|
if !self
|
||||||
.touch_handler
|
.touch_handler
|
||||||
.is_handling_touch_move(self.touch_handler.current_sequence_id) &&
|
.is_handling_touch_move(self.touch_handler.current_sequence_id) &&
|
||||||
self.send_touch_event(event)
|
self.send_touch_event(event) &&
|
||||||
|
event.is_cancelable()
|
||||||
{
|
{
|
||||||
self.touch_handler
|
self.touch_handler
|
||||||
.set_handling_touch_move(self.touch_handler.current_sequence_id, true);
|
.set_handling_touch_move(self.touch_handler.current_sequence_id, true);
|
||||||
|
|
|
@ -229,12 +229,16 @@ impl TouchHandler {
|
||||||
pub(crate) fn prevent_click(&mut self, sequence_id: TouchSequenceId) {
|
pub(crate) fn prevent_click(&mut self, sequence_id: TouchSequenceId) {
|
||||||
if let Some(sequence) = self.touch_sequence_map.get_mut(&sequence_id) {
|
if let Some(sequence) = self.touch_sequence_map.get_mut(&sequence_id) {
|
||||||
sequence.prevent_click = true;
|
sequence.prevent_click = true;
|
||||||
|
} else {
|
||||||
|
warn!("TouchSequenceInfo corresponding to the sequence number has been deleted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn prevent_move(&mut self, sequence_id: TouchSequenceId) {
|
pub(crate) fn prevent_move(&mut self, sequence_id: TouchSequenceId) {
|
||||||
if let Some(sequence) = self.touch_sequence_map.get_mut(&sequence_id) {
|
if let Some(sequence) = self.touch_sequence_map.get_mut(&sequence_id) {
|
||||||
sequence.prevent_move = TouchMoveAllowed::Prevented;
|
sequence.prevent_move = TouchMoveAllowed::Prevented;
|
||||||
|
} else {
|
||||||
|
warn!("TouchSequenceInfo corresponding to the sequence number has been deleted.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1095,7 +1095,9 @@ impl ScriptThread {
|
||||||
InputEvent::Touch(touch_event) => {
|
InputEvent::Touch(touch_event) => {
|
||||||
let touch_result =
|
let touch_result =
|
||||||
document.handle_touch_event(touch_event, event.hit_test_result, can_gc);
|
document.handle_touch_event(touch_event, event.hit_test_result, can_gc);
|
||||||
if let TouchEventResult::Processed(handled) = touch_result {
|
if let (TouchEventResult::Processed(handled), true) =
|
||||||
|
(touch_result, touch_event.is_cancelable())
|
||||||
|
{
|
||||||
let sequence_id = touch_event.expect_sequence_id();
|
let sequence_id = touch_event.expect_sequence_id();
|
||||||
let result = if handled {
|
let result = if handled {
|
||||||
script_traits::TouchEventResult::DefaultAllowed(
|
script_traits::TouchEventResult::DefaultAllowed(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue