mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Support single-value <select>
elements (#35684)
https://github.com/user-attachments/assets/9aba75ff-4190-4a85-89ed-d3f3aa53d3b0 Among other things this adds a new `EmbedderMsg::ShowSelectElementMenu` to tell the embedder to display a select popup at the given location. This is a draft because some small style adjustments need to be made: * the select element should always have the width of the largest option * the border should be part of the shadow tree Apart from that, it's mostly ready for review. <details><summary>HTML for demo video</summary> ```html <html> <body> <select id="c" name="choice"> <option value="first">First Value</option> <option value="second">Second Value</option> <option value="third">Third Value</option> </select> </body> </html> ``` </details> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] Part of https://github.com/servo/servo/issues/3551 - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
6e9d01b908
commit
0e99539dab
32 changed files with 633 additions and 151 deletions
|
@ -75,10 +75,6 @@ use uuid::Uuid;
|
|||
use webgpu::swapchain::WebGPUContextId;
|
||||
use webrender_api::units::DeviceIntRect;
|
||||
|
||||
use super::bindings::codegen::Bindings::XPathEvaluatorBinding::XPathEvaluatorMethods;
|
||||
use super::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
||||
use super::clipboardevent::ClipboardEventType;
|
||||
use super::performancepainttiming::PerformancePaintTiming;
|
||||
use crate::animation_timeline::AnimationTimeline;
|
||||
use crate::animations::Animations;
|
||||
use crate::canvas_context::CanvasContext as _;
|
||||
|
@ -105,6 +101,7 @@ use crate::dom::bindings::codegen::Bindings::TouchBinding::TouchMethods;
|
|||
use crate::dom::bindings::codegen::Bindings::WindowBinding::{
|
||||
FrameRequestCallback, ScrollBehavior, WindowMethods,
|
||||
};
|
||||
use crate::dom::bindings::codegen::Bindings::XPathEvaluatorBinding::XPathEvaluatorMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::XPathNSResolverBinding::XPathNSResolver;
|
||||
use crate::dom::bindings::codegen::UnionTypes::{NodeOrString, StringOrElementCreationOptions};
|
||||
use crate::dom::bindings::error::{Error, ErrorInfo, ErrorResult, Fallible};
|
||||
|
@ -120,8 +117,9 @@ use crate::dom::bindings::weakref::WeakRef;
|
|||
use crate::dom::bindings::xmlname::{
|
||||
matches_name_production, namespace_from_domstring, validate_and_extract,
|
||||
};
|
||||
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
||||
use crate::dom::cdatasection::CDATASection;
|
||||
use crate::dom::clipboardevent::ClipboardEvent;
|
||||
use crate::dom::clipboardevent::{ClipboardEvent, ClipboardEventType};
|
||||
use crate::dom::comment::Comment;
|
||||
use crate::dom::compositionevent::CompositionEvent;
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
|
@ -171,6 +169,7 @@ use crate::dom::nodeiterator::NodeIterator;
|
|||
use crate::dom::nodelist::NodeList;
|
||||
use crate::dom::pagetransitionevent::PageTransitionEvent;
|
||||
use crate::dom::performanceentry::PerformanceEntry;
|
||||
use crate::dom::performancepainttiming::PerformancePaintTiming;
|
||||
use crate::dom::pointerevent::{PointerEvent, PointerId};
|
||||
use crate::dom::processinginstruction::ProcessingInstruction;
|
||||
use crate::dom::promise::Promise;
|
||||
|
@ -1274,7 +1273,7 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
fn send_to_embedder(&self, msg: EmbedderMsg) {
|
||||
pub(crate) fn send_to_embedder(&self, msg: EmbedderMsg) {
|
||||
let window = self.window();
|
||||
window.send_to_embedder(msg);
|
||||
}
|
||||
|
@ -1312,7 +1311,7 @@ impl Document {
|
|||
|
||||
let node = unsafe { node::from_untrusted_compositor_node_address(hit_test_result.node) };
|
||||
let Some(el) = node
|
||||
.inclusive_ancestors(ShadowIncluding::No)
|
||||
.inclusive_ancestors(ShadowIncluding::Yes)
|
||||
.filter_map(DomRoot::downcast::<Element>)
|
||||
.next()
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue