mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Current-pixel-density tests passing
This commit is contained in:
parent
9a83ab6297
commit
25027e476c
9 changed files with 74 additions and 43 deletions
|
@ -1030,6 +1030,7 @@ pub trait LayoutNodeHelpers {
|
|||
fn text_content(&self) -> String;
|
||||
fn selection(&self) -> Option<Range<usize>>;
|
||||
fn image_url(&self) -> Option<ServoUrl>;
|
||||
fn image_density(&self) -> Option<f64>;
|
||||
fn canvas_data(&self) -> Option<HTMLCanvasData>;
|
||||
fn svg_data(&self) -> Option<SVGSVGData>;
|
||||
fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>;
|
||||
|
@ -1173,6 +1174,15 @@ impl LayoutNodeHelpers for LayoutDom<Node> {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn image_density(&self) -> Option<f64> {
|
||||
unsafe {
|
||||
self.downcast::<HTMLImageElement>()
|
||||
.expect("not an image!")
|
||||
.image_density()
|
||||
}
|
||||
}
|
||||
|
||||
fn canvas_data(&self) -> Option<HTMLCanvasData> {
|
||||
self.downcast::<HTMLCanvasElement>()
|
||||
.map(|canvas| canvas.data())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue