Rewild Your Web
18
fork

Configure Feed

Select the types of activity you want to include in your feed.

webview: Add links to the context menu event

Signed-off-by: webbeef <me@webbeef.org>

webbeef 9f41ba34 2e5d858f

+50 -9
+32 -8
patches/components/script/dom/html/htmlembeddedwebview.rs.patch
··· 1 1 --- original 2 2 +++ modified 3 - @@ -0,0 +1,964 @@ 3 + @@ -0,0 +1,988 @@ 4 4 +/* This Source Code Form is subject to the terms of the Mozilla Public 5 5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 6 6 + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ ··· 16 16 + BlobImpl, EmbeddedWebViewEventType, ScriptToConstellationMessage, TraversalDirection, 17 17 +}; 18 18 +use embedder_traits::{ 19 - + AlertResponse, AllowOrDeny, ConfirmResponse, ContextMenuAction, ContextMenuItem, 20 - + EmbeddedWebViewScreenshotError, EmbeddedWebViewScreenshotRequest, 21 - + EmbeddedWebViewScreenshotResult, EmbedderControlId, EmbedderControlRequest, 22 - + EmbedderControlResponse, InputMethodType, LoadStatus, PermissionFeature, PromptResponse, 23 - + RgbColor, ScreenshotImageType, SimpleDialogRequest, 19 + + AlertResponse, AllowOrDeny, ConfirmResponse, ContextMenuAction, 20 + + ContextMenuElementInformationFlags, ContextMenuItem, EmbeddedWebViewScreenshotError, 21 + + EmbeddedWebViewScreenshotRequest, EmbeddedWebViewScreenshotResult, EmbedderControlId, 22 + + EmbedderControlRequest, EmbedderControlResponse, InputMethodType, LoadStatus, 23 + + PermissionFeature, PromptResponse, RgbColor, ScreenshotImageType, SimpleDialogRequest, 24 24 +}; 25 25 +use js::jsval::UndefinedValue; 26 26 +use script_bindings::codegen::GenericBindings::CustomEventBinding::CustomEventMethods; 27 27 +use script_bindings::conversions::SafeToJSValConvertible; 28 28 +use stylo_atoms::Atom; 29 + +use url::Url; 29 30 + 30 31 +use crate::dom::bindings::codegen::Bindings::EmbeddedWebViewBinding::{ 31 32 + EmbedderColorParameters, EmbedderContextMenuItem, EmbedderContextMenuParameters, ··· 37 38 +use crate::dom::bindings::error::{Error, Fallible}; 38 39 +use crate::dom::bindings::inheritance::Castable; 39 40 +use crate::dom::bindings::num::Finite; 41 + +use crate::dom::bindings::root::DomRoot; 40 42 +use crate::dom::bindings::str::{DOMString, USVString}; 41 43 +use crate::dom::blob::Blob; 42 44 +use crate::dom::customevent::CustomEvent; ··· 46 48 +use crate::dom::html::htmliframeelement::HTMLIFrameElement; 47 49 +use crate::dom::node::NodeTraits; 48 50 +use crate::dom::promise::Promise; 51 + +use crate::dom::url::URL; 49 52 +use crate::routed_promise::{RoutedPromiseListener, callback_promise}; 50 53 +use crate::script_runtime::CanGc; 51 54 + ··· 56 59 + Alert(GenericSender<AlertResponse>), 57 60 + Confirm(GenericSender<ConfirmResponse>), 58 61 + Prompt(GenericSender<PromptResponse>), 62 + +} 63 + + 64 + +fn convert_url( 65 + + url: &Option<Url>, 66 + + global_scope: &GlobalScope, 67 + + can_gc: CanGc, 68 + +) -> Option<DomRoot<URL>> { 69 + + url.clone() 70 + + .map(|u| URL::new(global_scope, None, u.into(), can_gc)) 59 71 +} 60 72 + 61 73 +/// Embedded webview methods for HTMLIFrameElement. ··· 285 297 + ContextMenuItem::Separator => None, 286 298 + }) 287 299 + .collect(); 288 - + context_menu_parameters = 289 - + Some(EmbedderContextMenuParameters { items: Some(items) }); 300 + + let flags = menu_request.element_info.flags; 301 + + let info = &menu_request.element_info; 302 + + let global = self.owner_global(); 303 + + context_menu_parameters = Some(EmbedderContextMenuParameters { 304 + + items: Some(items), 305 + + linkUrl: convert_url(&info.link_url, &global, can_gc), 306 + + imageUrl: convert_url(&info.image_url, &global, can_gc), 307 + + forImage: flags.contains(ContextMenuElementInformationFlags::Image), 308 + + forLink: flags.contains(ContextMenuElementInformationFlags::Link), 309 + + forEditableText: flags 310 + + .contains(ContextMenuElementInformationFlags::EditableText), 311 + + forSelection: flags 312 + + .contains(ContextMenuElementInformationFlags::Selection), 313 + + }); 290 314 + }, 291 315 + EmbedderControlRequest::PermissionPrompt(permission_request) => { 292 316 + // Convert PermissionFeature to string representations
+11
patches/components/script/dom/url.rs.patch
··· 1 + --- original 2 + +++ modified 3 + @@ -50,7 +50,7 @@ 4 + } 5 + } 6 + 7 + - fn new( 8 + + pub(crate) fn new( 9 + global: &GlobalScope, 10 + proto: Option<HandleObject>, 11 + url: ServoUrl,
+7 -1
patches/components/script_bindings/webidls/EmbeddedWebView.webidl.patch
··· 1 1 --- original 2 2 +++ modified 3 - @@ -0,0 +1,150 @@ 3 + @@ -0,0 +1,156 @@ 4 4 +/* This Source Code Form is subject to the terms of the Mozilla Public 5 5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 6 6 + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ ··· 106 106 +// Parameters for context menu control. 107 107 +dictionary EmbedderContextMenuParameters { 108 108 + sequence<EmbedderContextMenuItem> items; 109 + + URL linkUrl; 110 + + URL imageUrl; 111 + + boolean forLink = false; 112 + + boolean forImage = false; 113 + + boolean forEditableText = false; 114 + + boolean forSelection = false; 109 115 +}; 110 116 + 111 117 +// Parameters for permission prompt control.