mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
implement Touchevent prevent default behavior (#35031)
* implement Touchevent prevent default behavior * The status change logic of the `TouchHandler` is changed. > The `WaitingForScript` state is canceled. TouchAction can be identified based on the current touch type and numbers if touch points. * Sends current event to script thread along with recognized `TouchAction`. > After dispatch event, script thread sends a `TouchEventProcess(EventResult)` message to main thread. If the event is set to `DefaultAllowed`, the corresponding `TouchAction` information is added. * After receiving `DefaultAllowed(TouchAction)` message, main thread executes corresponding action. > `DefaultPrevented(TouchEventType)` is received. Use `prevent_click` to mark that the default `Click` is blocked, and `prevent_move` to mark that the default `Scroll` and `Zoom` are blocked. In this way, all TouchActions implement preventDefault. Signed-off-by: Bi Fuguo <1782765876@qq.com> * fix some suggestions * support preventDefault fling * move `TouchAction` to share touch directory * check preventDefault everytime when touch * fix zoom ineffective Signed-off-by: Bi Fuguo <1782765876@qq.com> * fix some suggestions rename on_event_processed to on_touch_event_processed clear unused features Signed-off-by: Bi Fuguo <1782765876@qq.com> * Optimizes pan performance by continuously sliding without waiting for the eventhandler. Signed-off-by: kongbai1996 <1782765876@qq.com> * resolve conflict Signed-off-by: kongbai1996 <1782765876@qq.com> --------- Signed-off-by: Bi Fuguo <1782765876@qq.com> Signed-off-by: kongbai1996 <1782765876@qq.com>
This commit is contained in:
parent
6dce329acc
commit
3fe42a0b5a
12 changed files with 273 additions and 255 deletions
|
@ -13,7 +13,9 @@ use base::id::{
|
|||
use base::Epoch;
|
||||
use canvas_traits::canvas::{CanvasId, CanvasMsg};
|
||||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use embedder_traits::{EmbedderMsg, MediaSessionEvent, TraversalDirection};
|
||||
use embedder_traits::{
|
||||
EmbedderMsg, MediaSessionEvent, TouchAction, TouchEventType, TraversalDirection,
|
||||
};
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use euclid::Size2D;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
|
@ -64,9 +66,9 @@ impl fmt::Debug for LayoutMsg {
|
|||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub enum EventResult {
|
||||
/// Allowed by web content
|
||||
DefaultAllowed,
|
||||
DefaultAllowed(TouchAction),
|
||||
/// Prevented by web content
|
||||
DefaultPrevented,
|
||||
DefaultPrevented(TouchEventType),
|
||||
}
|
||||
|
||||
/// A log entry reported to the constellation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue