mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
script/layout: Implement Element.currentCSSZoom attribute (#40304)
Implements the `currentCSSZoom` readonly attribute on the Element interface as [spec](https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom). - Adds a new layout query (`CurrentCSSZoomQuery`) that traverses from the target element up through its ancestors - Accumulates the product of all `zoom` CSS property values to compute the effective zoom - Returns 1.0 for elements that are not being rendered (display: none or no layout data) Testing: Updated WPT (removed 4 FAIL expectations from `idlharness.html.ini`). Behavior tests in Element-currentCSSZoom.html remain as expected FAIL because the underlying CSS `zoom` property implementation in Servo does not yet apply zoom values to layout (the zoom property is parsed but computed values remain 1.0). Fixes: #40256 Signed-off-by: WaterWhisperer <waterwhisperer24@qq.com>
This commit is contained in:
@@ -2690,6 +2690,13 @@ impl Window {
|
||||
.query_client_rect(node.to_trusted_node_address())
|
||||
}
|
||||
|
||||
pub(crate) fn current_css_zoom_query(&self, node: &Node) -> f32 {
|
||||
self.layout_reflow(QueryMsg::CurrentCSSZoomQuery);
|
||||
self.layout
|
||||
.borrow()
|
||||
.query_current_css_zoom(node.to_trusted_node_address())
|
||||
}
|
||||
|
||||
/// Find the scroll area of the given node, if it is not None. If the node
|
||||
/// is None, find the scroll area of the viewport.
|
||||
pub(crate) fn scrolling_area_query(&self, node: Option<&Node>) -> UntypedRect<i32> {
|
||||
|
||||
Reference in New Issue
Block a user