mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Treat video elements as replaced content and render the current frame. (#31412)
* Treat video elements as replaced content and render the current frame. * Update test results.
This commit is contained in:
parent
38d2ad9592
commit
41a41b3d8f
6 changed files with 32 additions and 4 deletions
|
@ -93,6 +93,7 @@ pub(crate) trait NodeExt<'dom>: 'dom + LayoutNode<'dom> {
|
|||
fn as_image(self) -> Option<(Option<Arc<NetImage>>, PhysicalSize<f64>)>;
|
||||
fn as_canvas(self) -> Option<(CanvasInfo, PhysicalSize<f64>)>;
|
||||
fn as_iframe(self) -> Option<(PipelineId, BrowsingContextId)>;
|
||||
fn as_video(self) -> Option<(webrender_api::ImageKey, PhysicalSize<f64>)>;
|
||||
fn style(self, context: &LayoutContext) -> ServoArc<ComputedValues>;
|
||||
|
||||
fn get_style_and_layout_data(self) -> Option<StyleAndLayoutData<'dom>>;
|
||||
|
@ -125,6 +126,13 @@ where
|
|||
Some((resource, PhysicalSize::new(width, height)))
|
||||
}
|
||||
|
||||
fn as_video(self) -> Option<(webrender_api::ImageKey, PhysicalSize<f64>)> {
|
||||
let node = self.to_threadsafe();
|
||||
let frame_data = node.media_data()?.current_frame?;
|
||||
let (width, height) = (frame_data.1 as f64, frame_data.2 as f64);
|
||||
Some((frame_data.0, PhysicalSize::new(width, height)))
|
||||
}
|
||||
|
||||
fn as_canvas(self) -> Option<(CanvasInfo, PhysicalSize<f64>)> {
|
||||
let node = self.to_threadsafe();
|
||||
let canvas_data = node.canvas_data()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue