Skip to content

Truly independent web browser

LibWeb: Implement the zoom property

Andreas Klingf8d5fa9778c8
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 197f23f3b5c..aeed4dc7b1d 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -199,6 +199,7 @@ set(SOURCES
CSS/StyleInvalidation.cpp
CSS/StyleProperty.cpp
CSS/StylePropertyMapReadOnly.cpp
+ CSS/Zoom.cpp
CSS/StylePropertyMap.cpp
CSS/StyleScope.cpp
CSS/StyleSheet.cpp
diff --git a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
index ce5b63b0968..58e6f73379e 100644
--- a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
+++ b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
@@ -34,6 +34,7 @@
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/LocalNavigable.h>
@@ -812,8 +813,12 @@ Optional<RefPtr<StyleValue const>> CSSStyleProperties::resolved_value_read_from_
if (!prepared.has_value())
return RefPtr<StyleValue const> {};
- if (auto style = abstract_element.computed_style())
- return RefPtr<StyleValue const> { style->computed_style_value(property_id) };
+ if (auto style = abstract_element.computed_style()) {
+ auto value = style->computed_style_value(property_id);
+ if (value)
+ value = unscaled_by_zoom(property_id, value.release_nonnull(), style->effective_zoom());
+ return value;
+ }
// Only a synthetic pseudo-element with no matching rules lacks a style record after the preparation above; its
// transient style needs the full declaration path.
@@ -947,12 +952,13 @@ Optional<StyleProperty> CSSStyleProperties::get_direct_property(PropertyNameAndI
}
};
+ auto const zoom = computed_values->effective_zoom();
if (property_is_shorthand(property_id)) {
auto longhand_ids = longhands_for_shorthand(property_id);
StyleValueVector longhand_values;
longhand_values.ensure_capacity(longhand_ids.size());
for (auto longhand_id : longhand_ids)
- longhand_values.append(computed_value_for_property(longhand_id));
+ longhand_values.append(unscaled_by_zoom(longhand_id, computed_value_for_property(longhand_id), zoom));
return StyleProperty {
.property_id = property_id,
.value = ShorthandStyleValue::create(property_id, move(longhand_ids), move(longhand_values)),
@@ -961,7 +967,7 @@ Optional<StyleProperty> CSSStyleProperties::get_direct_property(PropertyNameAndI
return StyleProperty {
.property_id = property_id,
- .value = computed_value_for_property(property_id),
+ .value = unscaled_by_zoom(property_id, computed_value_for_property(property_id), zoom),
};
}
@@ -970,7 +976,7 @@ Optional<StyleProperty> CSSStyleProperties::get_direct_property(PropertyNameAndI
return {};
return StyleProperty {
.property_id = property_id,
- .value = *value,
+ .value = unscaled_by_zoom(property_id, value.release_nonnull(), layout_node->style_group<ComputedValues::InheritedBoxValues>().effective_zoom_value()),
};
}
@@ -1046,6 +1052,10 @@ Optional<Utf16String> CSSStyleProperties::serialized_computed_value_from_stored_
if (!style)
return {};
+ // NB: A value of an element with a zoom must be unscaled, which the value path does.
+ if (style->effective_zoom() != 1)
+ return {};
+
// letter-spacing: a used value of zero resolves to `normal`; leave that to the value path.
// https://drafts.csswg.org/css-text-4/#letter-spacing-property
if (property_id == PropertyID::LetterSpacing && layout_node && layout_node->letter_spacing() == 0)
diff --git a/Libraries/LibWeb/CSS/ComputedValues.h b/Libraries/LibWeb/CSS/ComputedValues.h
index d005d3dc812..c88f5f4a82b 100644
--- a/Libraries/LibWeb/CSS/ComputedValues.h
+++ b/Libraries/LibWeb/CSS/ComputedValues.h
@@ -502,6 +502,8 @@ public:
ComputedValuesFFI::ComputedSize const& height() const { return m_noninherited.sizing->height; }
Direction direction() const { return static_cast<Direction>(m_inherited.box->direction); }
WritingMode writing_mode() const { return static_cast<WritingMode>(m_inherited.box->writing_mode); }
+ // https://drafts.csswg.org/css-viewport/#effective-zoom
+ double effective_zoom() const { return m_inherited.box->effective_zoom_value(); }
ContainerType container_type() const
{
@@ -735,6 +737,8 @@ public:
Direction direction_value() const { return static_cast<Direction>(direction); }
WritingMode writing_mode_value() const { return static_cast<WritingMode>(writing_mode); }
ContentVisibility content_visibility_value() const { return static_cast<ContentVisibility>(content_visibility); }
+ // https://drafts.csswg.org/css-viewport/#effective-zoom
+ float effective_zoom_value() const { return bit_cast<float>(effective_zoom_bits); }
bool operator==(InheritedBoxValues const& other) const
{
@@ -743,7 +747,8 @@ public:
&& writing_mode == other.writing_mode
&& content_visibility == other.content_visibility
&& image_rendering == other.image_rendering
- && text_orientation == other.text_orientation;
+ && text_orientation == other.text_orientation
+ && effective_zoom_bits == other.effective_zoom_bits;
}
};
diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json
index c4c2d3209a8..a733effdc6f 100644
--- a/Libraries/LibWeb/CSS/Properties.json
+++ b/Libraries/LibWeb/CSS/Properties.json
@@ -5987,5 +5987,18 @@
"valid-identifiers": [
"auto"
]
+ },
+ "zoom": {
+ "animation-type": "by-computed-value",
+ "inherited": false,
+ "initial": "1",
+ "requires-computation": "cascaded-value",
+ "valid-types": [
+ "number [0,∞]",
+ "percentage [0,∞]"
+ ],
+ "valid-identifiers": [
+ "normal"
+ ]
}
}
diff --git a/Libraries/LibWeb/CSS/StyleComputeFFI.h b/Libraries/LibWeb/CSS/StyleComputeFFI.h
index def551c5b73..ee10da51eec 100644
--- a/Libraries/LibWeb/CSS/StyleComputeFFI.h
+++ b/Libraries/LibWeb/CSS/StyleComputeFFI.h
@@ -55,6 +55,7 @@ inline ComputedValuesFFI::FfiLengthResolutionContext to_ffi_length_resolution_co
.container_height_basis_depends_on_viewport_metrics = false,
.subject_inline_axis_is_horizontal = context.subject_inline_axis_is_horizontal,
.resolved_viewport_relative_length = context.viewport_metric_dependency_flag(),
+ .zoom = 1,
};
}
diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp
index 77ff92339c1..c87f891169e 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -768,6 +768,7 @@ NonnullOwnPtr<StyleComputer::AnimationSample> StyleComputer::begin_animation_sam
.device_pixels_per_css_pixel = m_document->page().client().device_pixels_per_css_pixel(),
.initial_font_size_raw = InitialValues::font_size().raw_value(),
.default_font_size_raw = default_user_font_size().raw_value(),
+ .root_effective_zoom = root_element_effective_zoom(),
};
using SampleContext = AnimationSample::Context;
@@ -1861,6 +1862,7 @@ void StyleComputer::update_root_element_font_metrics(ComputedValues const& value
{
m_root_element_font_metrics = Length::FontMetrics { values.font_size(), values.font_list().first_available_font().pixel_metrics(), values.line_height() };
m_root_element_font_metrics_depend_on_viewport_metrics = values.font_metrics_depend_on_viewport_metrics();
+ m_root_element_effective_zoom = values.effective_zoom();
}
CSSPixels StyleComputer::default_user_font_size()
diff --git a/Libraries/LibWeb/CSS/StyleComputer.h b/Libraries/LibWeb/CSS/StyleComputer.h
index f02b1251158..5dd1b2c0c50 100644
--- a/Libraries/LibWeb/CSS/StyleComputer.h
+++ b/Libraries/LibWeb/CSS/StyleComputer.h
@@ -80,6 +80,9 @@ public:
[[nodiscard]] CSSPixelRect const& viewport_rect_for_style_environment() const { return m_viewport_rect; }
[[nodiscard]] Length::FontMetrics const& root_element_font_metrics() const { return m_root_element_font_metrics; }
[[nodiscard]] bool root_element_font_metrics_depend_on_viewport_metrics() const { return m_root_element_font_metrics_depend_on_viewport_metrics; }
+ // https://drafts.csswg.org/css-viewport/#effective-zoom
+ // NB: The root element font metrics are zoomed by this effective zoom of the root element.
+ [[nodiscard]] double root_element_effective_zoom() const { return m_root_element_effective_zoom; }
// Moves with the viewport rect the environment resolves viewport units against.
void bump_viewport_environment_version() { ++m_viewport_environment_version; }
// The environment as a compositor animation request names it: the document's version and the viewport's.
@@ -256,6 +259,7 @@ private:
Length::FontMetrics m_default_font_metrics;
mutable Length::FontMetrics m_root_element_font_metrics;
mutable bool m_root_element_font_metrics_depend_on_viewport_metrics { false };
+ mutable double m_root_element_effective_zoom { 1 };
mutable u64 m_style_update_depth { 0 };
mutable Optional<MediaEnvironmentSnapshot> m_style_update_media_environment;
diff --git a/Libraries/LibWeb/CSS/StyleEngineBridge.cpp b/Libraries/LibWeb/CSS/StyleEngineBridge.cpp
index 61f7d842312..a790678650e 100644
--- a/Libraries/LibWeb/CSS/StyleEngineBridge.cpp
+++ b/Libraries/LibWeb/CSS/StyleEngineBridge.cpp
@@ -619,6 +619,7 @@ void StyleEngine::gather_computation_inputs(LentComputationInputs& lent)
.root_font_zero_advance = root_font_metrics.zero_advance.to_double(),
.root_line_height = root_font_metrics.line_height.to_double(),
.root_font_metrics_depend_on_viewport_metrics = m_style_computer->root_element_font_metrics_depend_on_viewport_metrics(),
+ .root_effective_zoom = m_style_computer->root_element_effective_zoom(),
.initial_font_size = initial_font_metrics.font_size.to_double(),
.initial_font_x_height = initial_font_metrics.x_height.to_double(),
.initial_font_cap_height = initial_font_metrics.cap_height.to_double(),
diff --git a/Libraries/LibWeb/CSS/StylePropertyMapReadOnly.cpp b/Libraries/LibWeb/CSS/StylePropertyMapReadOnly.cpp
index 91cda7df4da..15aa5b6ff13 100644
--- a/Libraries/LibWeb/CSS/StylePropertyMapReadOnly.cpp
+++ b/Libraries/LibWeb/CSS/StylePropertyMapReadOnly.cpp
@@ -14,6 +14,7 @@
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/PropertyNameAndID.h>
#include <LibWeb/CSS/StyleSheetState.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@@ -203,7 +204,10 @@ RefPtr<StyleValue const> StylePropertyMapReadOnly::get_style_value(Source& sourc
property_id = map_logical_alias_to_physical_property(property_id, LogicalAliasMappingContext { computed_values->writing_mode(), computed_values->direction() });
if (property_id == PropertyID::BackgroundColor && computed_values->background_color_style_value())
return computed_values->background_color_style_value();
- return computed_values->computed_style_value(property_id);
+ auto value = computed_values->computed_style_value(property_id);
+ if (!value)
+ return nullptr;
+ return unscaled_by_zoom(property_id, value.release_nonnull(), computed_values->effective_zoom());
}
}
diff --git a/Libraries/LibWeb/CSS/Zoom.cpp b/Libraries/LibWeb/CSS/Zoom.cpp
new file mode 100644
index 00000000000..b8e556bc810
--- /dev/null
+++ b/Libraries/LibWeb/CSS/Zoom.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibWeb/CSS/ComputedValues.h>
+#include <LibWeb/CSS/StyleValues/StyleValue.h>
+#include <LibWeb/CSS/Zoom.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Layout/Node.h>
+
+namespace Web::CSS {
+
+// https://drafts.csswg.org/css-viewport/#zoom-om
+// Computed style APIs (i.e., all values returned by getComputedStyle()) that are non-auto and non-percentage lengths
+// must be unscaled.
+NonnullRefPtr<StyleValue const> unscaled_by_zoom(PropertyID property_id, NonnullRefPtr<StyleValue const> value, double zoom)
+{
+ if (zoom == 1 || property_id == PropertyID::Zoom)
+ return value;
+ if (auto const* unscaled = StyleValueFFI::rust_style_value_unscaled_by_zoom(value->rust_style_value_data(), zoom))
+ return StyleValue::adopt_rust_style_value_data(unscaled);
+ return value;
+}
+
+// https://drafts.csswg.org/css-viewport/#unscaled
+// The unscaled value of a CSS length relative to an element is the scaled value divided by the element's effective
+// zoom.
+double unscaled(double value, double effective_zoom)
+{
+ return effective_zoom == 1 ? value : value / effective_zoom;
+}
+
+CSSPixels unscaled(CSSPixels value, double effective_zoom)
+{
+ if (effective_zoom == 1)
+ return value;
+ return CSSPixels::nearest_value_for(unscaled(value.to_double(), effective_zoom));
+}
+
+// https://drafts.csswg.org/css-viewport/#effective-zoom
+double effective_zoom(DOM::Element const& element)
+{
+ auto const* inherited_box_values = element.style_group<ComputedValues::InheritedBoxValues>();
+ return inherited_box_values ? inherited_box_values->effective_zoom_value() : 1;
+}
+
+double effective_zoom(Layout::NodeWithStyle const& layout_node)
+{
+ return layout_node.style_group<ComputedValues::InheritedBoxValues>().effective_zoom_value();
+}
+
+}
diff --git a/Libraries/LibWeb/CSS/Zoom.h b/Libraries/LibWeb/CSS/Zoom.h
new file mode 100644
index 00000000000..469e4f5087c
--- /dev/null
+++ b/Libraries/LibWeb/CSS/Zoom.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/Forward.h>
+#include <LibWebCommon/PixelUnits.h>
+
+namespace Web::CSS {
+
+NonnullRefPtr<StyleValue const> unscaled_by_zoom(PropertyID, NonnullRefPtr<StyleValue const>, double zoom);
+double unscaled(double, double effective_zoom);
+CSSPixels unscaled(CSSPixels, double effective_zoom);
+double effective_zoom(DOM::Element const&);
+double effective_zoom(Layout::NodeWithStyle const&);
+
+}
diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp
index d20e1220d11..4154db0fa6d 100644
--- a/Libraries/LibWeb/DOM/Element.cpp
+++ b/Libraries/LibWeb/DOM/Element.cpp
@@ -61,6 +61,7 @@
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
#include <LibWeb/CSS/VisualViewport.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/ComputedValuesRustFFI.h>
#include <LibWeb/ContentSecurityPolicy/BlockingAlgorithms.h>
#include <LibWeb/DOM/AbstractElement.h>
@@ -3194,7 +3195,7 @@ int Element::client_top() const
auto const& border_top = style_group<CSS::ComputedValues::BorderValues>()->border_top_value();
if (border_top.line_style == CSS::LineStyle::None || border_top.line_style == CSS::LineStyle::Hidden)
return 0;
- return border_top.width.to_int();
+ return CSS::unscaled(border_top.width, CSS::effective_zoom(*this)).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-element-clientleft
@@ -3219,7 +3220,7 @@ int Element::client_left() const
auto const& border_left = style_group<CSS::ComputedValues::BorderValues>()->border_left_value();
if (border_left.line_style == CSS::LineStyle::None || border_left.line_style == CSS::LineStyle::Hidden)
return 0;
- return border_left.width.to_int();
+ return CSS::unscaled(border_left.width, CSS::effective_zoom(*this)).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-element-clientwidth
@@ -3247,7 +3248,7 @@ int Element::client_width() const
// 3. Return the width of the padding edge excluding the width of any rendered scrollbar between the padding edge and the border edge,
// ignoring any transforms that apply to the element and its ancestors.
// INTEROP: The result is rounded to the nearest integer rather than truncated, as browsers do.
- return round(Painting::absolute_padding_box_rect(*layout_node).width()).to_int();
+ return round(CSS::unscaled(Painting::absolute_padding_box_rect(*layout_node).width(), CSS::effective_zoom(*layout_node))).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-element-clientheight
@@ -3275,14 +3276,19 @@ int Element::client_height() const
// 3. Return the height of the padding edge excluding the height of any rendered scrollbar between the padding edge and the border edge,
// ignoring any transforms that apply to the element and its ancestors.
// INTEROP: The result is rounded to the nearest integer rather than truncated, as browsers do.
- return round(Painting::absolute_padding_box_rect(*layout_node).height()).to_int();
+ return round(CSS::unscaled(Painting::absolute_padding_box_rect(*layout_node).height(), CSS::effective_zoom(*layout_node))).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-element-currentcsszoom
double Element::current_css_zoom() const
{
- dbgln("FIXME: Implement Element::current_css_zoom()");
- return 1.0;
+ // The currentCSSZoom attribute must return the effective zoom of the element, or 1.0 if the element isn't being
+ // rendered.
+ const_cast<Document&>(document()).update_style_for_element(AbstractElement { const_cast<Element&>(*this) }, Document::StyleUpdateMode::OnlyIfNeeded);
+ auto const* box_values = style_group<CSS::ComputedValues::BoxValues>();
+ if (!box_values || CSS::display_from_ffi_display(box_values->display).is_none())
+ return 1.0;
+ return CSS::effective_zoom(*this);
}
static bool style_attribute_is_blocked_by_content_security_policy(Element& element, Utf16View value)
@@ -3848,7 +3854,7 @@ double Element::scroll_top() const
// 9. Return the y-coordinate of the scrolling area at the alignment point with the top of the padding edge of the element.
// FIXME: Is this correct?
- return Painting::scroll_offset(*layout_node).y().to_double();
+ return CSS::unscaled(Painting::scroll_offset(*layout_node).y(), CSS::effective_zoom(*layout_node)).to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-element-scrollleft
@@ -3894,7 +3900,7 @@ double Element::scroll_left() const
// 9. Return the x-coordinate of the scrolling area at the alignment point with the left of the padding edge of the element.
// FIXME: Is this correct?
- return Painting::scroll_offset(*layout_node).x().to_double();
+ return CSS::unscaled(Painting::scroll_offset(*layout_node).x(), CSS::effective_zoom(*layout_node)).to_double();
}
// https://drafts.csswg.org/cssom-view/#dom-element-scrollleft
@@ -3952,7 +3958,8 @@ void Element::set_scroll_left(double x)
// 11. Scroll the element to x,scrollTop, with the scroll behavior being "auto".
auto scroll_offset = Painting::scroll_offset(*layout_node);
- scroll_offset.set_x(CSSPixels::nearest_value_for(x));
+ // NB: The value is unscaled, as scrollLeft answers it.
+ scroll_offset.set_x(CSSPixels::nearest_value_for(x * CSS::effective_zoom(*layout_node)));
if (auto navigable = document.navigable())
navigable->perform_a_scroll_of_an_element(*this, scroll_offset, Bindings::ScrollBehavior::Auto);
}
@@ -4011,7 +4018,8 @@ void Element::set_scroll_top(double y)
// 11. Scroll the element to scrollLeft,y, with the scroll behavior being "auto".
auto scroll_offset = Painting::scroll_offset(*layout_node);
- scroll_offset.set_y(CSSPixels::nearest_value_for(y));
+ // NB: The value is unscaled, as scrollTop answers it.
+ scroll_offset.set_y(CSSPixels::nearest_value_for(y * CSS::effective_zoom(*layout_node)));
if (auto navigable = document.navigable())
navigable->perform_a_scroll_of_an_element(*this, scroll_offset, Bindings::ScrollBehavior::Auto);
}
@@ -4058,7 +4066,7 @@ int Element::scroll_width()
// 7. Return the width of the element’s scrolling area.
// INTEROP: The result is rounded to the nearest integer rather than truncated, as browsers do.
if (auto scrollable_overflow_rect = Painting::scrollable_overflow_rect(*layout_node); scrollable_overflow_rect.has_value())
- return round(scrollable_overflow_rect->width()).to_int();
+ return round(CSS::unscaled(scrollable_overflow_rect->width(), CSS::effective_zoom(*layout_node))).to_int();
return 0;
}
@@ -4105,7 +4113,7 @@ int Element::scroll_height()
// 7. Return the height of the element’s scrolling area.
// INTEROP: The result is rounded to the nearest integer rather than truncated, as browsers do.
if (auto scrollable_overflow_rect = Painting::scrollable_overflow_rect(*layout_node); scrollable_overflow_rect.has_value()) {
- return round(scrollable_overflow_rect->height()).to_int();
+ return round(CSS::unscaled(scrollable_overflow_rect->height(), CSS::effective_zoom(*layout_node))).to_int();
}
return 0;
}
@@ -5921,7 +5929,11 @@ void Element::scroll(Bindings::ScrollToOptions options, GC::Ptr<WebIDL::Promise>
// 11. Scroll the element to x,y, with the scroll behavior being the value of the behavior dictionary member of
// options. Let scrollPromise be the Promise returned from this step.
- auto scroll_offset = CSSPixelPoint { CSSPixels::nearest_value_for(x), CSSPixels::nearest_value_for(y) };
+ // NB: The position is unscaled, as scrollLeft and scrollTop answer it.
+ auto const zoom = CSS::effective_zoom(*layout_node);
+ auto scroll_offset = CSSPixelPoint { CSSPixels::nearest_value_for(x * zoom), CSSPixels::nearest_value_for(y * zoom) };
+ if (relative_displacement.has_value() && zoom != 1)
+ relative_displacement = CSSPixelPoint { CSSPixels::nearest_value_for(relative_displacement->x().to_double() * zoom), CSSPixels::nearest_value_for(relative_displacement->y().to_double() * zoom) };
if (auto navigable = document.navigable()) {
auto scroll_promise = navigable->perform_a_scroll_of_an_element(*this, scroll_offset, options.behavior, relative_displacement);
if (promise)
diff --git a/Libraries/LibWeb/HTML/HTMLElement.cpp b/Libraries/LibWeb/HTML/HTMLElement.cpp
index 32f43099264..06f0eec6d94 100644
--- a/Libraries/LibWeb/HTML/HTMLElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -16,6 +16,7 @@
#include <LibWeb/CSS/SelectorMatching.h>
#include <LibWeb/CSS/StyleEngineInput.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/EditingHostManager.h>
#include <LibWeb/DOM/ElementFactory.h>
@@ -947,7 +948,7 @@ int HTMLElement::offset_top() const
auto offset_parent = this->offset_parent();
auto const* offset_parent_layout_node = offset_parent ? offset_parent->layout_node(read) : nullptr;
if (!offset_parent_layout_node || !Painting::has_committed_box(*offset_parent_layout_node)) {
- return round(top_border_edge_of_element).to_int();
+ return round(CSS::unscaled(top_border_edge_of_element, CSS::effective_zoom(*layout_node))).to_int();
}
// 3. Return the result of subtracting the y-coordinate of the top padding edge
@@ -965,7 +966,7 @@ int HTMLElement::offset_top() const
} else {
top_padding_edge_of_offset_parent = Painting::absolute_padding_box_rect(*offset_parent_layout_node).y() + sticky_offset_of(*offset_parent_layout_node).y();
}
- return round(top_border_edge_of_element - top_padding_edge_of_offset_parent).to_int();
+ return round(CSS::unscaled(top_border_edge_of_element - top_padding_edge_of_offset_parent, CSS::effective_zoom(*layout_node))).to_int();
}
// https://www.w3.org/TR/cssom-view-1/#dom-htmlelement-offsetleft
@@ -993,7 +994,7 @@ int HTMLElement::offset_left() const
auto offset_parent = this->offset_parent();
auto const* offset_parent_layout_node = offset_parent ? offset_parent->layout_node(read) : nullptr;
if (!offset_parent_layout_node || !Painting::has_committed_box(*offset_parent_layout_node)) {
- return round(left_border_edge_of_element).to_int();
+ return round(CSS::unscaled(left_border_edge_of_element, CSS::effective_zoom(*layout_node))).to_int();
}
// 3. Return the result of subtracting the x-coordinate of the left padding edge
@@ -1011,7 +1012,7 @@ int HTMLElement::offset_left() const
} else {
left_padding_edge_of_offset_parent = Painting::absolute_padding_box_rect(*offset_parent_layout_node).x() + sticky_offset_of(*offset_parent_layout_node).x();
}
- return round(left_border_edge_of_element - left_padding_edge_of_offset_parent).to_int();
+ return round(CSS::unscaled(left_border_edge_of_element - left_padding_edge_of_offset_parent, CSS::effective_zoom(*layout_node))).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetwidth
@@ -1031,7 +1032,7 @@ int HTMLElement::offset_width() const
//
// If the element’s principal box is an inline-level box which was "split" by a block-level descendant, also
// include fragments generated by the block-level descendants, unless they are zero width or height.
- return round(Painting::border_box_rect_of_fragments(*layout_node).width()).to_int();
+ return round(CSS::unscaled(Painting::border_box_rect_of_fragments(*layout_node).width(), CSS::effective_zoom(*layout_node))).to_int();
}
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetheight
@@ -1051,7 +1052,7 @@ int HTMLElement::offset_height() const
//
// If the element’s principal box is an inline-level box which was "split" by a block-level descendant, also
// include fragments generated by the block-level descendants, unless they are zero width or height.
- return round(Painting::border_box_rect_of_fragments(*layout_node).height()).to_int();
+ return round(CSS::unscaled(Painting::border_box_rect_of_fragments(*layout_node).height(), CSS::effective_zoom(*layout_node))).to_int();
}
void HTMLElement::attribute_changed(Utf16FlyString const& name, Optional<Utf16String> const& old_value, Optional<Utf16String> const& value, Optional<Utf16FlyString> const& namespace_)
diff --git a/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp b/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp
index 1bbb1527dda..c2c1d429c17 100644
--- a/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp
+++ b/Libraries/LibWeb/ResizeObserver/ResizeObserverEntry.cpp
@@ -5,6 +5,7 @@
*/
#include <LibGC/Heap.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Painting/BoxViews.h>
@@ -50,10 +51,13 @@ WebIDL::ExceptionOr<GC::Ref<ResizeObserverEntry>> ResizeObserverEntry::create_an
// 7. If target is not an SVG element or target is an SVG element with an associated CSS layout box do these steps:
if (!target.is_svg_element() && layout_node && !layout_node->is_inline_node() && Painting::has_committed_box(*layout_node)) {
auto box_model = Painting::box_model(*layout_node);
+ // NB: The padding is unscaled, as the sizes are.
+ // https://drafts.csswg.org/css-viewport/#zoom-om
+ auto const zoom = CSS::effective_zoom(*layout_node);
// Set this.contentRect.top to target.padding top.
- y = box_model.padding.top.to_double();
+ y = CSS::unscaled(box_model.padding.top.to_double(), zoom);
// Set this.contentRect.left to target.padding left.
- x = box_model.padding.left.to_double();
+ x = CSS::unscaled(box_model.padding.left.to_double(), zoom);
} else if (target.is_svg_element() && layout_node && Painting::has_committed_box(*layout_node)) {
// 8. If target is an SVG element without an associated CSS layout box do these steps:
// Set this.contentRect.top and this.contentRect.left to 0.
diff --git a/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp b/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp
index 355eebc6721..f49ec56dd68 100644
--- a/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp
+++ b/Libraries/LibWeb/ResizeObserver/ResizeObserverSize.cpp
@@ -6,6 +6,7 @@
#include <AK/Math.h>
#include <LibGC/Heap.h>
+#include <LibWeb/CSS/Zoom.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/Node.h>
@@ -32,20 +33,24 @@ ResizeObserverSize::RawSize ResizeObserverSize::compute_box_size(DOM::Element& t
if (layout_node && !layout_node->is_inline_node() && Painting::has_committed_box(*layout_node)) {
double width = 0;
double height = 0;
+ // https://drafts.csswg.org/css-viewport/#zoom-om
+ // All other APIs related to element geometries must return unscaled lengths (except as detailed below).
+ // NB: The device pixel content box is measured in device pixels, so it stays scaled.
+ auto const zoom = CSS::effective_zoom(*layout_node);
switch (observed_box) {
// -> If observedBox is "border-box"
case ObservedBox::BorderBox:
// 1. Set computedSize's inlineSize attribute to target's border area inline length.
// 2. Set computedSize's blockSize attribute to target's border area block length.
- width = Painting::border_box_width(*layout_node).to_double();
- height = Painting::border_box_height(*layout_node).to_double();
+ width = CSS::unscaled(Painting::border_box_width(*layout_node).to_double(), zoom);
+ height = CSS::unscaled(Painting::border_box_height(*layout_node).to_double(), zoom);
break;
// -> If observedBox is "content-box"
case ObservedBox::ContentBox:
// 1. Set computedSize's inlineSize attribute to target's content area inline length.
// 2. Set computedSize's blockSize attribute to target's content area block length.
- width = Painting::content_width(*layout_node).to_double();
- height = Painting::content_height(*layout_node).to_double();
+ width = CSS::unscaled(Painting::content_width(*layout_node).to_double(), zoom);
+ height = CSS::unscaled(Painting::content_height(*layout_node).to_double(), zoom);
break;
// -> If observedBox is "device-pixel-content-box"
case ObservedBox::DevicePixelContentBox: {
diff --git a/Libraries/LibWeb/Rust/build.rs b/Libraries/LibWeb/Rust/build.rs
index 7908aecf095..5af8b667495 100644
--- a/Libraries/LibWeb/Rust/build.rs
+++ b/Libraries/LibWeb/Rust/build.rs
@@ -870,6 +870,8 @@ fn generate_property_metadata(manifest_dir: &Path, out_dir: &Path) -> Result<(),
// The longhands other longhands' computation reads, which are computed first.
let manual_order = [
+ // zoom is required to compute every length, including font-size.
+ "zoom",
// math-depth is required to compute font-size.
"math-depth",
// Font properties are required to absolutize font-relative units used in other properties, including line-height.
diff --git a/Libraries/LibWeb/Rust/src/css/absolutize.rs b/Libraries/LibWeb/Rust/src/css/absolutize.rs
index 955ac041f3a..5d0786050f8 100644
--- a/Libraries/LibWeb/Rust/src/css/absolutize.rs
+++ b/Libraries/LibWeb/Rust/src/css/absolutize.rs
@@ -1814,7 +1814,24 @@ pub(crate) fn absolutize(value: &StyleValueData, context: &AbsolutizationContext
values,
} => {
let mut changed = false;
- let values = absolutize_list(values, context, &mut changed)?;
+ let mut values = absolutize_list(values, context, &mut changed)?;
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // NB: The translation of a matrix is a length given in pixels, which zoom applies to as it does to a
+ // <length>.
+ let translation = match *transform_function {
+ crate::css::serialize::transform_function::MATRIX => 4..6,
+ crate::css::serialize::transform_function::MATRIX3D => 12..15,
+ _ => 0..0,
+ };
+ let zoom = context.length.zoom;
+ if zoom != 1.0 && !translation.is_empty() && values.len() >= translation.end {
+ for value in &mut values[translation] {
+ if let Some(StyleValueData::Number { value: number }) = value.optional_data() {
+ *value = retain_new(StyleValueData::Number { value: number * zoom });
+ changed = true;
+ }
+ }
+ }
rebuild!(
changed,
StyleValueData::Transformation {
diff --git a/Libraries/LibWeb/Rust/src/css/animation.rs b/Libraries/LibWeb/Rust/src/css/animation.rs
index 60e84b34720..7eaecd286b3 100644
--- a/Libraries/LibWeb/Rust/src/css/animation.rs
+++ b/Libraries/LibWeb/Rust/src/css/animation.rs
@@ -6468,6 +6468,7 @@ fn animation_length_resolution_context(
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: true,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
})
}
diff --git a/Libraries/LibWeb/Rust/src/css/calc.rs b/Libraries/LibWeb/Rust/src/css/calc.rs
index 9bf06e8e8ce..55e38f81704 100644
--- a/Libraries/LibWeb/Rust/src/css/calc.rs
+++ b/Libraries/LibWeb/Rust/src/css/calc.rs
@@ -2095,6 +2095,22 @@ impl CalcNode {
return self.clone();
}
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // NB: An absolute length computes zoomed by the effective zoom of the element, as it does outside a
+ // calculation.
+ if let CalcNumericValue::Length { value, unit } = *value
+ && let Some(length_context) = context.length_resolution.context
+ && length_context.zoom != 1.0
+ {
+ let ratio = crate::css::style_compute::LENGTH_UNIT_CANONICAL_PX_RATIOS[unit as usize];
+ if ratio.is_finite() {
+ return shared(CalcNode::Numeric(CalcNumericValue::Length {
+ value: value * ratio * length_context.zoom,
+ unit: canonical_unit_code(&crate::css::style_compute::LENGTH_UNIT_CANONICAL_PX_RATIOS),
+ }));
+ }
+ }
+
// 2. If root is a dimension that is not expressed in its canonical unit, and there is enough
// information available to convert it to the canonical unit, do so, and return the value.
if !is_canonical_unit(*value)
@@ -2349,6 +2365,22 @@ impl CalcNode {
shared(CalcNode::Numeric(value.with_raw(value.raw() * multiplier)))
})
.collect();
+ if let Some(length_context) = context.length_resolution.context {
+ // NB: The product's children already resolved their lengths before distribution.
+ let mut neutral_length = *length_context;
+ neutral_length.zoom = 1.0;
+ let neutral_context = CalcEvaluationContext {
+ percentage_leaf_type: context.percentage_leaf_type,
+ resolve_as: context.resolve_as,
+ percentage_basis: context.percentage_basis,
+ length_resolution: LengthResolution {
+ context: Some(&neutral_length),
+ ..context.length_resolution
+ },
+ random_base_value: context.random_base_value,
+ };
+ return shared(CalcNode::Sum(multiplied)).simplify(&neutral_context, callbacks);
+ }
return shared(CalcNode::Sum(multiplied)).simplify(context, callbacks);
}
}
diff --git a/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs b/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
index 5c127f96519..042a9c7e759 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_longhand_table.rs
@@ -591,6 +591,9 @@ pub struct ComputedLonghandTable {
/// The longhands the table's `transition-*` values make transitionable, resolved once per
/// frozen table because every drive seeded from it asks for them.
frozen_transition_longhands: OnceLock<Box<[u16]>>,
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The product of the computed value of zoom and the computed values of zoom of all flat tree ancestors.
+ effective_zoom: f32,
frozen: bool,
}
@@ -649,6 +652,7 @@ impl ComputedLonghandTable {
overflow_before_adjustment: None,
slot_hash_sum: MemoizedHashSum::default(),
frozen_transition_longhands: OnceLock::new(),
+ effective_zoom: 1.0,
frozen: false,
}
}
@@ -936,6 +940,20 @@ impl ComputedLonghandTable {
self.metadata = source.metadata;
self.overflow_before_adjustment = source.overflow_before_adjustment;
self.raw_cascaded_font_size.clone_from(&source.raw_cascaded_font_size);
+ self.effective_zoom = source.effective_zoom;
+ }
+
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ pub(crate) fn effective_zoom(&self) -> f32 {
+ self.effective_zoom
+ }
+
+ pub(crate) fn set_effective_zoom(&mut self, effective_zoom: f32) {
+ assert!(
+ !self.frozen,
+ "the computed longhand table is immutable once its style is created"
+ );
+ self.effective_zoom = effective_zoom;
}
fn copy_from(&mut self, source: &ComputedLonghandTable) {
@@ -1292,6 +1310,7 @@ impl ComputedLonghandTable {
use crate::css::style_value::{optional_style_values_equal, retained_style_values_equal};
self.important_bits == other.important_bits
&& self.inherited_bits == other.inherited_bits
+ && self.effective_zoom.to_bits() == other.effective_zoom.to_bits()
&& self.publication_sidecars() == other.publication_sidecars()
&& self.publication_dependency_flags() == other.publication_dependency_flags()
&& self.pseudo_element_styles() == other.pseudo_element_styles()
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
index 1b4ce908f30..d452f4e08cd 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_views.rs
@@ -743,6 +743,12 @@ impl<'a> ComputedValuesView<'a> {
self.native_group(STYLE_GROUP_INDEX_INHERITED_BOX)
}
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ #[inline]
+ pub(crate) fn effective_zoom(self) -> f32 {
+ self.inherited_box().effective_zoom()
+ }
+
#[inline]
fn inherited_table(self) -> &'a InheritedTableValues {
self.native_group(STYLE_GROUP_INDEX_INHERITED_TABLE)
diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rs
index 747bb20ed87..7de999a0246 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs
@@ -69,6 +69,9 @@ pub struct InheritedBoxValues {
pub content_visibility: u8,
pub image_rendering: u8,
pub text_orientation: u8,
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The bits of the effective zoom, as an `f32`.
+ pub effective_zoom_bits: u32,
}
impl ComputedStyleValueHandle {
@@ -335,6 +338,7 @@ impl_content_hash_by_field!(InheritedBoxValues {
content_visibility,
image_rendering,
text_orientation,
+ effective_zoom_bits,
});
// The anchor-inset wrappers are pure derivatives of the anchor-inset fields, so payload equality
// excludes them and the hash follows it field for field.
@@ -2809,6 +2813,7 @@ pub(crate) fn build_inherited_box_group(
content_visibility: &RetainedStyleValueData,
image_rendering: &RetainedStyleValueData,
text_orientation: &RetainedStyleValueData,
+ effective_zoom: f32,
parent: Option<GroupPayloadRef<'_>>,
) -> *const c_void {
use crate::css::style_value::StyleValueData;
@@ -2829,6 +2834,7 @@ pub(crate) fn build_inherited_box_group(
),
image_rendering: keyword_code(image_rendering, crate::css::style_compute::keyword_to_image_rendering),
text_orientation: keyword_code(text_orientation, crate::css::style_compute::keyword_to_text_orientation),
+ effective_zoom_bits: effective_zoom.to_bits(),
};
share_or_publish_group_payload::<InheritedBoxValues>(group_index, built, parent)
@@ -4230,8 +4236,14 @@ impl InheritedBoxValues {
content_visibility: content_visibility::VISIBLE,
image_rendering: image_rendering::AUTO,
text_orientation: text_orientation::MIXED,
+ effective_zoom_bits: 1.0f32.to_bits(),
}
}
+
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ pub(crate) fn effective_zoom(&self) -> f32 {
+ f32::from_bits(self.effective_zoom_bits)
+ }
}
#[cfg(test)]
diff --git a/Libraries/LibWeb/Rust/src/css/parser/stylesheet_cache.rs b/Libraries/LibWeb/Rust/src/css/parser/stylesheet_cache.rs
index 383a5ce9507..aaad557be9b 100644
--- a/Libraries/LibWeb/Rust/src/css/parser/stylesheet_cache.rs
+++ b/Libraries/LibWeb/Rust/src/css/parser/stylesheet_cache.rs
@@ -20,6 +20,7 @@ struct LengthResolutionKey {
font: [u64; 5],
root_font: [u64; 5],
container: [u64; 2],
+ zoom: u64,
flags: [bool; 7],
}
@@ -40,6 +41,7 @@ impl LengthResolutionKey {
container_height_basis_depends_on_viewport_metrics,
subject_inline_axis_is_horizontal,
resolved_viewport_relative_length,
+ zoom,
} = *context;
// A cache hit cannot reproduce writes to an external dependency-tracking flag.
if !resolved_viewport_relative_length.is_null() {
@@ -66,6 +68,7 @@ impl LengthResolutionKey {
font: font_key(&font_metrics),
root_font: font_key(&root_font_metrics),
container: [container_width_basis.to_bits(), container_height_basis.to_bits()],
+ zoom: zoom.to_bits(),
flags: [
font_metrics_depend_on_viewport_metrics,
root_font_metrics_depend_on_viewport_metrics,
diff --git a/Libraries/LibWeb/Rust/src/css/style/bridge.rs b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
index ed29672a2be..fd679a26279 100644
--- a/Libraries/LibWeb/Rust/src/css/style/bridge.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
@@ -303,6 +303,9 @@ pub struct FfiDocumentStyleComputationInputs {
pub root_font_zero_advance: f64,
pub root_line_height: f64,
pub root_font_metrics_depend_on_viewport_metrics: bool,
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The effective zoom of the document element, which its font metrics above are zoomed by.
+ pub root_effective_zoom: f64,
/// The metrics of the document's initial font, which the document element's own font
/// resolves against.
pub initial_font_size: f64,
@@ -398,6 +401,7 @@ impl Default for FfiDocumentStyleComputationInputs {
root_font_cap_height: 0.0,
root_font_zero_advance: 0.0,
root_line_height: 0.0,
+ root_effective_zoom: 1.0,
root_font_metrics_depend_on_viewport_metrics: false,
initial_font_size: 0.0,
initial_font_x_height: 0.0,
diff --git a/Libraries/LibWeb/Rust/src/css/style/container_queries.rs b/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
index b120014ffd2..ba3a8e935cc 100644
--- a/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/container_queries.rs
@@ -175,6 +175,7 @@ impl RetainedState {
subject_inline_axis_is_horizontal: values.writing_mode()
== crate::css::css_enums::writing_mode::HORIZONTAL_TB,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
})
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs b/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs
index 5bacec550fa..468d5f6572f 100644
--- a/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/custom_property_cascade.rs
@@ -1375,6 +1375,7 @@ impl RetainedState {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: true,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
},
inputs.preferred_color_scheme,
)
diff --git a/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs b/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
index 747197ea271..bbf914a68a8 100644
--- a/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
@@ -60,6 +60,16 @@ impl RetainedState {
})
}
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The effective zoom of the document element, which the font a `rem` resolves against is zoomed by.
+ fn root_effective_zoom(&self) -> f64 {
+ self.held_root_font_inputs
+ .unwrap_or_else(|| {
+ super::publication::RootFontInputs::from_document(&self.document_style_computation_inputs)
+ })
+ .effective_zoom()
+ }
+
/// The font a `rem` resolves against, and whether it reads the viewport: the font of the record
/// the host holds for the document element, which the document inputs only describe as of the
/// transaction they were published with.
@@ -653,6 +663,7 @@ impl super::StyleEngine {
device_pixels_per_css_pixel: inputs.device_pixels_per_css_pixel,
initial_font_size_raw: inputs.initial_font_size_raw,
default_font_size_raw: inputs.default_font_size_raw,
+ root_effective_zoom: self.root_effective_zoom(),
};
// SAFETY: The record's table is frozen, and the record the caller holds keeps it alive throughout the
// sample, which writes only `overlay` and what the engine keeps of the element's animations.
@@ -1332,6 +1343,7 @@ fn length_resolution_context(
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
}
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/position_try.rs b/Libraries/LibWeb/Rust/src/css/style/position_try.rs
index b24e3a0c07c..2ff489dbbc8 100644
--- a/Libraries/LibWeb/Rust/src/css/style/position_try.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/position_try.rs
@@ -898,6 +898,8 @@ impl StyleEngine {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: own.inline_axis_is_horizontal(),
resolved_viewport_relative_length: &raw mut resolved_viewport_relative_length,
+ // NB: The drive zooms the lengths by the effective zoom of the element itself.
+ zoom: 1.0,
};
self.container_unit_bases(node).apply_to(&mut length);
let environment = FfiStyleComputationEnvironment {
@@ -926,6 +928,7 @@ impl StyleEngine {
device_pixels_per_css_pixel: inputs.device_pixels_per_css_pixel,
initial_font_size_raw: inputs.initial_font_size_raw,
default_font_size_raw: inputs.default_font_size_raw,
+ root_effective_zoom: inputs.root_effective_zoom,
};
const LONGHAND_WORD_COUNT: usize = crate::css::property_metadata::NUMBER_OF_LONGHAND_PROPERTIES.div_ceil(64);
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication.rs b/Libraries/LibWeb/Rust/src/css/style/publication.rs
index bfb009102c9..5e724d9a886 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication.rs
@@ -32,6 +32,9 @@ use drive::{DrivenTable, FontDriveGoal, FullDrive, PartialDrive};
pub(super) struct RootFontInputs {
metrics: [u64; 5],
depends_on_viewport: bool,
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The bits of the effective zoom of the document element, which the metrics are zoomed by.
+ effective_zoom: u64,
}
/// An element's old and new style records.
@@ -83,6 +86,11 @@ impl RootFontInputs {
)
}
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ pub(super) fn effective_zoom(self) -> f64 {
+ f64::from_bits(self.effective_zoom)
+ }
+
fn apply_to(self, inputs: &mut bridge::FfiDocumentStyleComputationInputs) {
inputs.root_font_size = f64::from_bits(self.metrics[0]);
inputs.root_font_x_height = f64::from_bits(self.metrics[1]);
@@ -90,6 +98,7 @@ impl RootFontInputs {
inputs.root_font_zero_advance = f64::from_bits(self.metrics[3]);
inputs.root_line_height = f64::from_bits(self.metrics[4]);
inputs.root_font_metrics_depend_on_viewport_metrics = self.depends_on_viewport;
+ inputs.root_effective_zoom = f64::from_bits(self.effective_zoom);
}
pub(super) fn from_document(inputs: &bridge::FfiDocumentStyleComputationInputs) -> Self {
@@ -102,6 +111,7 @@ impl RootFontInputs {
inputs.root_line_height.to_bits(),
],
depends_on_viewport: inputs.root_font_metrics_depend_on_viewport_metrics,
+ effective_zoom: inputs.root_effective_zoom.to_bits(),
}
}
}
@@ -2611,13 +2621,18 @@ impl RetainedState {
}
pub(super) fn root_font_inputs_from_record(&self, record: computed::FinalStyleRecordID) -> Option<RootFontInputs> {
- use crate::css::computed_value_types::STYLE_GROUP_INDEX_FONT;
+ use crate::css::computed_value_types::{STYLE_GROUP_INDEX_FONT, STYLE_GROUP_INDEX_INHERITED_BOX};
let view = self.computed_group_sets.style_record_view(record.raw())?;
let font = unsafe {
view.payloads[STYLE_GROUP_INDEX_FONT]
.cast::<crate::css::computed_value_types::FontValues>()
.deref()
};
+ let inherited_box = unsafe {
+ view.payloads[STYLE_GROUP_INDEX_INHERITED_BOX]
+ .cast::<crate::css::computed_values::InheritedBoxValues>()
+ .deref()
+ };
Some(RootFontInputs {
metrics: [
font.font_size.to_double().to_bits(),
@@ -2627,6 +2642,7 @@ impl RetainedState {
font.line_height_used.to_double().to_bits(),
],
depends_on_viewport: view.dependency_flags & FONT_METRICS_DEPEND_ON_VIEWPORT_METRICS != 0,
+ effective_zoom: f64::from(inherited_box.effective_zoom()).to_bits(),
})
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/publication/drive.rs b/Libraries/LibWeb/Rust/src/css/style/publication/drive.rs
index 4e188d7cca8..d4d9b8a4e3a 100644
--- a/Libraries/LibWeb/Rust/src/css/style/publication/drive.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/publication/drive.rs
@@ -216,6 +216,20 @@ impl RetainedState {
ancestor = self.tree.inheritance_parent(node);
}
views.reverse();
+ let mut inherited_zoom = 1.0;
+ let zooms: Vec<_> = views
+ .iter()
+ .map(|(_, view)| {
+ if let Some(table) = view.as_ref().and_then(|view| view.longhand_table) {
+ inherited_zoom = f64::from(table.effective_zoom());
+ }
+ inherited_zoom
+ })
+ .collect();
+ let applies_zoom_at = |index: usize| {
+ self.computed_group_sets.adjustment_facts(views[index].0) & bridge::element_adjustment_fact::IS_SVG_ELEMENT
+ == 0
+ };
let value_at = |index: usize| {
views[index]
.1
@@ -228,6 +242,8 @@ impl RetainedState {
let mut batch = recascade_font_size_batch(
views.len(),
value_at,
+ |index| zooms[index],
+ applies_zoom_at,
0,
default_size,
false,
@@ -237,13 +253,25 @@ impl RetainedState {
);
while batch.status != FontSizeRecascadeStatus::Complete {
let index = batch.next_index;
+ let zoom = zooms[index];
+ let parent_zoom = index.checked_sub(1).map_or(1.0, |parent| zooms[parent]);
+ let applies_zoom = applies_zoom_at(index);
+ let own_zoom = if applies_zoom { zoom / parent_zoom } else { 1.0 };
+ let inherited_size = CssPixels::from_raw(batch.current_size_raw).scaled(own_zoom);
+ let root_zoom = if !applies_zoom {
+ 1.0
+ } else if inputs.root_effective_zoom > 0.0 {
+ zoom / inputs.root_effective_zoom
+ } else {
+ zoom
+ };
// AD-HOC: C++ measures the platform's monospace font directly, where this resolves the
// generic `monospace` family like any other request. The two differ only where
// an @font-face takes the platform monospace font's name.
let request = bridge::FfiFontResolutionRequest {
font_family: bridge::FfiHostHandle::from_pointer(self.monospace_font_family.pointer().cast()),
font_feature_values: [bridge::FfiHostHandle::default(); bridge::FONT_RESOLUTION_FEATURE_INPUT_COUNT],
- font_size_raw: batch.current_size_raw,
+ font_size_raw: inherited_size.raw_value(),
font_slope: 0,
font_weight: 400.0,
font_width: 100.0,
@@ -273,7 +301,7 @@ impl RetainedState {
.deref()
};
(
- font.line_height_used.to_double(),
+ font.line_height_used.to_double() * own_zoom,
view.dependency_flags & FONT_METRICS_DEPEND_ON_VIEWPORT_METRICS != 0,
)
});
@@ -290,18 +318,18 @@ impl RetainedState {
viewport_width: inputs.viewport_width,
viewport_height: inputs.viewport_height,
font_metrics: FfiFontMetrics {
- font_size: CssPixels::from_raw(batch.current_size_raw).to_double(),
+ font_size: inherited_size.to_double(),
x_height: drive_font_metric(resolved.x_height),
cap_height: drive_font_metric(resolved.ascent),
zero_advance: drive_font_metric(resolved.zero_advance),
line_height,
},
root_font_metrics: FfiFontMetrics {
- font_size: inputs.root_font_size,
- x_height: inputs.root_font_x_height,
- cap_height: inputs.root_font_cap_height,
- zero_advance: inputs.root_font_zero_advance,
- line_height: inputs.root_line_height,
+ font_size: inputs.root_font_size * root_zoom,
+ x_height: inputs.root_font_x_height * root_zoom,
+ cap_height: inputs.root_font_cap_height * root_zoom,
+ zero_advance: inputs.root_font_zero_advance * root_zoom,
+ line_height: inputs.root_line_height * root_zoom,
},
font_metrics_depend_on_viewport_metrics: batch.depends_on_viewport_metrics
|| inherited_font_metrics_depend_on_viewport_metrics,
@@ -314,12 +342,15 @@ impl RetainedState {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: if applies_zoom { zoom } else { 1.0 },
};
// The ancestor's container-relative font size resolves against its own containers.
self.container_unit_bases(*ancestor_node).apply_to(&mut context);
batch = recascade_font_size_batch(
views.len(),
value_at,
+ |index| zooms[index],
+ applies_zoom_at,
index,
batch.current_size_raw,
batch.depends_on_viewport_metrics,
@@ -463,6 +494,7 @@ impl RetainedState {
subject_inline_axis_is_horizontal: inherited_box.writing_mode
== crate::css::css_enums::writing_mode::HORIZONTAL_TB,
resolved_viewport_relative_length: &raw mut resolved_viewport_relative_length,
+ zoom: 1.0,
};
if reads_container_units {
self.container_unit_bases(node).apply_to(&mut length);
@@ -497,6 +529,7 @@ impl RetainedState {
device_pixels_per_css_pixel: inputs.device_pixels_per_css_pixel,
initial_font_size_raw: inputs.initial_font_size_raw,
default_font_size_raw: inputs.default_font_size_raw,
+ root_effective_zoom: inputs.root_effective_zoom,
};
let mut table = view.longhand_table_for_partial_drive();
let mut results = empty_longhand_driver_results();
@@ -872,6 +905,7 @@ impl RetainedState {
device_pixels_per_css_pixel: inputs.device_pixels_per_css_pixel,
initial_font_size_raw: inputs.initial_font_size_raw,
default_font_size_raw: inputs.default_font_size_raw,
+ root_effective_zoom: inputs.root_effective_zoom,
};
let mut resolved_viewport_relative_length = false;
let resolved_viewport_relative_length_pointer = &raw mut resolved_viewport_relative_length;
@@ -898,6 +932,7 @@ impl RetainedState {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal,
resolved_viewport_relative_length: resolved_viewport_relative_length_pointer,
+ zoom: 1.0,
};
if let Some(bases) = &container_unit_bases {
bases.apply_to(&mut length);
@@ -1077,6 +1112,7 @@ impl RetainedState {
line_height_before_adjustments.to_bits(),
],
depends_on_viewport: results.font_metrics_depend_on_viewport_metrics,
+ effective_zoom: f64::from(table.effective_zoom()).to_bits(),
};
font_scratch.pending = Some(PendingFontDrive {
target,
diff --git a/Libraries/LibWeb/Rust/src/css/style/style_invalidation.rs b/Libraries/LibWeb/Rust/src/css/style/style_invalidation.rs
index 3a40be6d522..a9e436d979d 100644
--- a/Libraries/LibWeb/Rust/src/css/style/style_invalidation.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/style_invalidation.rs
@@ -556,7 +556,12 @@ fn property_invalidation(property: u16, old: ComputedValuesView<'_>, new: Comput
result.repaint_text_decorations = property != property_id::COLOR
|| old.text_reset().text_decoration_color != new.text_reset().text_decoration_color;
}
- if matches!(property, property_id::DIRECTION | property_id::WRITING_MODE) {
+ // https://drafts.csswg.org/css-viewport/#effective-zoom
+ // NB: The lengths of each descendant are zoomed by its effective zoom, which the element's zoom is part of.
+ if matches!(
+ property,
+ property_id::DIRECTION | property_id::WRITING_MODE | property_id::ZOOM
+ ) {
result.recompute_descendants = true;
}
if property == property_id::VISIBILITY {
diff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rs
index 47afd20f64c..d70760e48b2 100644
--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs
+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs
@@ -74,6 +74,10 @@ pub struct FfiLengthResolutionContext {
/// resolution here consumed viewport metrics. Callers that report the
/// dependency through their return value may leave this null.
pub resolved_viewport_relative_length: *mut bool,
+ /// https://drafts.csswg.org/css-viewport/#effective-zoom
+ /// The effective zoom that absolute and viewport-relative lengths are multiplied by. The font metrics are those
+ /// of fonts the effective zoom already applies to.
+ pub zoom: f64,
}
/// A context with no viewport, font metrics or container basis, which tracks no viewport dependency.
@@ -94,6 +98,7 @@ impl Default for FfiLengthResolutionContext {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: false,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
}
}
}
@@ -314,18 +319,30 @@ pub(crate) fn absolutize_length(value: f64, unit: usize, context: &FfiLengthReso
let Some(kind) = kinds.get(unit) else {
return unhandled;
};
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // To apply zoom, the used value of a CSS property is pre-multiplied (before any other steps in the used value
+ // stage) by the used value of zoom for the element.
+ // INTEROP: Lengths are zoomed as they compute instead, as other browsers do. Font-relative lengths resolve against
+ // font metrics that are zoomed already.
+ let zoom = context.zoom;
match *kind {
- LengthUnitKind::Px => FfiAbsolutizedLength {
+ LengthUnitKind::Px if zoom == 1.0 => FfiAbsolutizedLength {
handled: true,
changed: false,
resolved_viewport_relative_length: false,
px: value,
},
+ LengthUnitKind::Px => FfiAbsolutizedLength {
+ handled: true,
+ changed: true,
+ resolved_viewport_relative_length: false,
+ px: value * zoom,
+ },
LengthUnitKind::Absolute { px_per_unit } => FfiAbsolutizedLength {
handled: true,
changed: true,
resolved_viewport_relative_length: false,
- px: px_per_unit * value,
+ px: px_per_unit * value * zoom,
},
LengthUnitKind::FontRelative { metric, root } => {
let metrics = if root {
@@ -360,7 +377,7 @@ pub(crate) fn absolutize_length(value: f64, unit: usize, context: &FfiLengthReso
handled: true,
changed: true,
resolved_viewport_relative_length: true,
- px: basis * value / 100.0,
+ px: basis * value / 100.0 * zoom,
}
}
LengthUnitKind::ContainerRelative { axis } => {
@@ -771,6 +788,7 @@ pub struct FfiFontSizeRecascadeBatch {
#[derive(Clone, Copy)]
pub struct FfiFontSizeRecascadeDocumentInputs {
pub root_font_size: f64,
+ pub root_effective_zoom: f64,
pub root_font_metrics_depend_on_viewport_metrics: bool,
pub viewport_width: f64,
pub viewport_height: f64,
@@ -780,6 +798,7 @@ impl FfiFontSizeRecascadeDocumentInputs {
pub(crate) fn from_document(inputs: &crate::css::style::bridge::FfiDocumentStyleComputationInputs) -> Self {
Self {
root_font_size: inputs.root_font_size,
+ root_effective_zoom: inputs.root_effective_zoom,
root_font_metrics_depend_on_viewport_metrics: inputs.root_font_metrics_depend_on_viewport_metrics,
viewport_width: inputs.viewport_width,
viewport_height: inputs.viewport_height,
@@ -802,6 +821,8 @@ impl FfiFontSizeRecascadeDocumentInputs {
pub(crate) fn recascade_font_size_batch<'a>(
value_count: usize,
mut value_at: impl FnMut(usize) -> Option<&'a StyleValueData>,
+ effective_zoom_at: impl Fn(usize) -> f64,
+ applies_zoom_at: impl Fn(usize) -> bool,
start_index: usize,
current_size_raw: i32,
current_depends_on_viewport_metrics: bool,
@@ -813,6 +834,11 @@ pub(crate) fn recascade_font_size_batch<'a>(
let mut current_size = CssPixels::from_raw(current_size_raw);
let mut depends_on_viewport_metrics = current_depends_on_viewport_metrics;
let default_size = CssPixels::from_raw(default_size_raw);
+ let root_zoom = if document_inputs.root_effective_zoom > 0.0 {
+ document_inputs.root_effective_zoom
+ } else {
+ 1.0
+ };
let mut skipped_calculated_value = false;
let stopped =
|status, next_index, current_size: CssPixels, depends_on_viewport_metrics, skipped_calculated_value| {
@@ -826,20 +852,30 @@ pub(crate) fn recascade_font_size_batch<'a>(
};
for index in start_index..value_count {
+ // NB: Keep the size before this ancestor for a batch that must retry this index with font metrics.
+ let inherited_size = current_size;
+ let zoom = effective_zoom_at(index);
+ let parent_zoom = index.checked_sub(1).map_or(1.0, &effective_zoom_at);
+ let applies_zoom = applies_zoom_at(index);
+ let own_zoom = if applies_zoom { zoom / parent_zoom } else { 1.0 };
+ let length_zoom = if applies_zoom { zoom } else { 1.0 };
+ let root_metric_zoom = if applies_zoom { zoom / root_zoom } else { 1.0 };
+ current_size = current_size.scaled(own_zoom);
+ let zoomed_default_size = default_size.scaled(length_zoom);
let Some(value) = value_at(index) else {
continue;
};
match value {
StyleValueData::Keyword { keyword } => {
if *keyword == keyword::INITIAL || *keyword == keyword::UNSET {
- current_size = default_size;
+ current_size = zoomed_default_size;
depends_on_viewport_metrics = false;
continue;
}
if *keyword == keyword::INHERIT {
continue;
}
- if let Some(px) = absolute_size_font_mapping(*keyword, default_size) {
+ if let Some(px) = absolute_size_font_mapping(*keyword, zoomed_default_size) {
current_size = px;
depends_on_viewport_metrics = false;
continue;
@@ -859,13 +895,13 @@ pub(crate) fn recascade_font_size_batch<'a>(
}
StyleValueData::Length { value, unit } => {
let directly_resolved = match length_unit_kinds().get(*unit as usize) {
- Some(LengthUnitKind::Px) => Some((*value, false)),
- Some(LengthUnitKind::Absolute { px_per_unit }) => Some((*value * px_per_unit, false)),
+ Some(LengthUnitKind::Px) => Some((*value * length_zoom, false)),
+ Some(LengthUnitKind::Absolute { px_per_unit }) => Some((*value * px_per_unit * length_zoom, false)),
Some(LengthUnitKind::FontRelative {
metric: FontMetricSelector::FontSize,
root: true,
}) => Some((
- *value * document_inputs.root_font_size,
+ *value * document_inputs.root_font_size * root_metric_zoom,
document_inputs.root_font_metrics_depend_on_viewport_metrics,
)),
Some(LengthUnitKind::FontRelative {
@@ -879,7 +915,7 @@ pub(crate) fn recascade_font_size_batch<'a>(
ViewportAxis::Min => document_inputs.viewport_width.min(document_inputs.viewport_height),
ViewportAxis::Max => document_inputs.viewport_width.max(document_inputs.viewport_height),
};
- Some((basis * *value / 100.0, true))
+ Some((basis * *value / 100.0 * length_zoom, true))
}
_ => None,
};
@@ -895,7 +931,7 @@ pub(crate) fn recascade_font_size_batch<'a>(
return stopped(
FontSizeRecascadeStatus::NeedsLengthResolution,
index,
- current_size,
+ inherited_size,
depends_on_viewport_metrics,
skipped_calculated_value,
);
@@ -905,7 +941,7 @@ pub(crate) fn recascade_font_size_batch<'a>(
return stopped(
FontSizeRecascadeStatus::NeedsCppLengthResolution,
index,
- current_size,
+ inherited_size,
depends_on_viewport_metrics,
skipped_calculated_value,
);
@@ -928,7 +964,7 @@ pub(crate) fn recascade_font_size_batch<'a>(
return stopped(
status,
index,
- current_size,
+ inherited_size,
depends_on_viewport_metrics,
skipped_calculated_value,
);
@@ -2081,15 +2117,17 @@ fn compute_line_height(value: &StyleValueData, computed_font_size: CssPixels) ->
fn compute_border_or_outline_width(
value: &StyleValueData,
device_pixels_per_css_pixel: f64,
+ zoom: f64,
length_resolution_context: Option<&FfiLengthResolutionContext>,
) -> FfiComputedNumber {
let absolute_length = match value {
// The thin, medium, and thick keywords are equivalent to 1px, 3px, and 5px, respectively.
// https://drafts.csswg.org/css-backgrounds/#typedef-line-width
+ // NB: As a length is, the keyword is zoomed by the effective zoom.
StyleValueData::Keyword { keyword } => match *keyword {
- keyword::THIN => CssPixels::from_integer(1),
- keyword::MEDIUM => CssPixels::from_integer(3),
- keyword::THICK => CssPixels::from_integer(5),
+ keyword::THIN => CssPixels::from_integer(1).scaled(zoom),
+ keyword::MEDIUM => CssPixels::from_integer(3).scaled(zoom),
+ keyword::THICK => CssPixels::from_integer(5).scaled(zoom),
_ => return NUMBER_UNHANDLED,
},
StyleValueData::Length { value, unit } => {
@@ -2979,6 +3017,8 @@ pub struct FfiStyleComputationEnvironment {
pub device_pixels_per_css_pixel: f64,
pub initial_font_size_raw: i32,
pub default_font_size_raw: i32,
+ /// The effective zoom of the document element, whose font metrics `rem` and `rlh` lengths resolve against.
+ pub root_effective_zoom: f64,
}
#[repr(C)]
@@ -3064,6 +3104,7 @@ fn property_has_dedicated_compute_rule(property_id: u16) -> bool {
| prop::MATH_DEPTH
| prop::POSITION_AREA
| prop::TRANSFORM_ORIGIN
+ | prop::ZOOM
)
}
@@ -3470,6 +3511,94 @@ const BACKGROUND_LAYER_LONGHANDS: [u16; 7] = {
]
};
+/// https://drafts.csswg.org/css-viewport/#zoom-property
+/// The used value of a computed zoom: a 0 value is treated as if it was 1.
+pub(crate) fn used_zoom(value: Option<&StyleValueData>) -> f64 {
+ match value {
+ Some(StyleValueData::Number { value }) if *value > 0.0 => *value,
+ _ => 1.0,
+ }
+}
+
+/// https://drafts.csswg.org/css-viewport/#effective-zoom
+/// The zoom a longhand drive applies to the lengths it computes.
+#[derive(Clone, Copy)]
+struct DriveZoom {
+ parent_effective_zoom: f64,
+ zoom: f64,
+ root_effective_zoom: f64,
+ /// FIXME: Zoom SVG content as a whole, instead of leaving the lengths of SVG elements unzoomed.
+ applies_to_lengths: bool,
+}
+
+/// AD-HOC: The effective zoom is kept within a range where the lengths it multiplies, and the unscaled values that
+/// divide by it, stay finite.
+const EFFECTIVE_ZOOM_RANGE: std::ops::RangeInclusive<f64> = 1.0e-6..=1.0e6;
+
+impl DriveZoom {
+ fn effective_zoom(self) -> f64 {
+ (self.parent_effective_zoom * self.zoom).clamp(*EFFECTIVE_ZOOM_RANGE.start(), *EFFECTIVE_ZOOM_RANGE.end())
+ }
+
+ /// The factor the element's own zoom multiplies the effective zoom of its parent by.
+ fn own_zoom(self) -> f64 {
+ if EFFECTIVE_ZOOM_RANGE.contains(&(self.parent_effective_zoom * self.zoom)) {
+ self.zoom
+ } else {
+ self.effective_zoom() / self.parent_effective_zoom
+ }
+ }
+
+ /// The zoom the lengths of a value inherited from the parent take.
+ fn length_zoom(self) -> f64 {
+ if self.applies_to_lengths { self.own_zoom() } else { 1.0 }
+ }
+
+ /// The zoom the lengths of a value that is not inherited take.
+ fn length_effective_zoom(self) -> f64 {
+ if self.applies_to_lengths {
+ self.effective_zoom()
+ } else {
+ 1.0
+ }
+ }
+
+ fn is_identity(self) -> bool {
+ !self.applies_to_lengths
+ || (self.zoom == 1.0 && self.parent_effective_zoom == 1.0 && self.root_effective_zoom == 1.0)
+ }
+
+ /// The context the lengths of a value resolve against. The lengths of a value inherited from the parent are
+ /// zoomed by the parent's effective zoom already, so they only take the element's own zoom.
+ /// NB: The font metrics of the font phase are the parent's, which the element's own zoom applies to as well.
+ fn context(
+ self,
+ context: &FfiLengthResolutionContext,
+ inherited: bool,
+ font_metrics_are_parents: bool,
+ ) -> FfiLengthResolutionContext {
+ let scaled = |metrics: FfiFontMetrics, factor: f64| FfiFontMetrics {
+ font_size: metrics.font_size * factor,
+ x_height: metrics.x_height * factor,
+ cap_height: metrics.cap_height * factor,
+ zero_advance: metrics.zero_advance * factor,
+ line_height: metrics.line_height * factor,
+ };
+ let mut context = *context;
+ let own_zoom = self.own_zoom();
+ context.zoom = if inherited { own_zoom } else { self.effective_zoom() };
+ if font_metrics_are_parents && own_zoom != 1.0 {
+ context.font_metrics = scaled(context.font_metrics, own_zoom);
+ }
+ // NB: The root font metrics are those of the document element, zoomed by its effective zoom.
+ let root_zoom = self.effective_zoom() / self.root_effective_zoom;
+ if root_zoom != 1.0 {
+ context.root_font_metrics = scaled(context.root_font_metrics, root_zoom);
+ }
+ context
+ }
+}
+
/// Drives the property computation loop: iterates every longhand in
/// computation order, resolves logical pairing, reads the winning cascaded
/// declarations straight from the store, selects between the cascaded,
@@ -3542,6 +3671,24 @@ pub(crate) unsafe fn drive_property_computation(
let mut cached_writing_mode_and_direction: Option<(u8, u8)> = None;
let computation_order = property_computation_order_for_phase(phase);
+ // https://drafts.csswg.org/css-viewport/#effective-zoom
+ // The effective zoom of an element is the product of its computed value of zoom and all flat tree ancestors'
+ // computed values of zoom.
+ // NB: A drive that does not compute zoom reads what an earlier phase computed.
+ let mut zoom = DriveZoom {
+ parent_effective_zoom: snapshot.map_or(1.0, |snapshot| f64::from(snapshot.table.effective_zoom())),
+ zoom: used_zoom(
+ longhand_table
+ .get(prop::ZOOM)
+ .and_then(RetainedStyleValueData::optional_data),
+ ),
+ root_effective_zoom: if environment.root_effective_zoom > 0.0 {
+ environment.root_effective_zoom
+ } else {
+ 1.0
+ },
+ applies_to_lengths: !environment.box_type_input.is_svg_element,
+ };
let mut pending_overflow_x_store: Option<ComputedStoreEntry> = None;
let mut pending_effective_color_scheme: i16 = -1;
// The element's used color scheme, produced by the preceding color-scheme
@@ -3642,7 +3789,22 @@ pub(crate) unsafe fn drive_property_computation(
longhand_table.set_raw_cascaded_font_size(Some(value_data.clone()));
}
} else if property_id == crate::css::property_metadata::property_id::FONT_SIZE && has_new_font_size {
- // NOTE: The recascaded font-size has already been stored before the loop.
+ // NB: The recascade walks the ancestors. The inherited result still takes this element's own zoom.
+ if zoom.length_zoom() != 1.0 {
+ let recascaded = longhand_table.get(property_id).and_then(|value| {
+ if let StyleValueData::Length { value, unit } = value.data() {
+ Some((
+ CssPixels::nearest_value_for(value * zoom.length_zoom()).to_double(),
+ *unit,
+ ))
+ } else {
+ None
+ }
+ });
+ if let Some((value, unit)) = recascaded {
+ longhand_table.set_computed(property_id, StyleValueData::Length { value, unit }, -1);
+ }
+ }
continue;
} else if property_id == crate::css::property_metadata::property_id::FONT_SIZE {
longhand_table.set_raw_cascaded_font_size(None);
@@ -3730,7 +3892,30 @@ pub(crate) unsafe fn drive_property_computation(
required_level = REQUIRES_COMPUTATION_NON_INHERITED;
}
- let requires_computation = property_requires_computation_level(property_id) >= required_level;
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // NB: The lengths an element inherits are zoomed by its parent's effective zoom, so an element with a zoom of
+ // its own computes them again, zoomed by its own zoom. The lengths of an initial value are zoomed by the
+ // element's effective zoom as they compute. A drive that resolves no lengths has nothing to zoom.
+ let zooms_value = length_resolution_context.is_some()
+ && if use_initial {
+ zoom.length_effective_zoom() != 1.0
+ } else {
+ zoom.length_zoom() != 1.0 && inherit_fetch_attempted
+ };
+ let requires_computation = property_requires_computation_level(property_id) >= required_level || zooms_value;
+
+ let zoomed_length_resolution_context;
+ let length_resolution_context = match length_resolution_context {
+ Some(context) if !zoom.is_identity() => {
+ zoomed_length_resolution_context = zoom.context(
+ context,
+ inherit_fetch_attempted && !use_initial,
+ phase == LONGHAND_DRIVE_PHASE_FONT,
+ );
+ Some(&zoomed_length_resolution_context)
+ }
+ context => context,
+ };
// Whether the computed value depends on inherited information, so the specified
// value must be kept for re-resolution when an ancestor changes.
@@ -3883,9 +4068,11 @@ pub(crate) unsafe fn drive_property_computation(
unit,
} = value_data
{
- let resolution_context =
- length_resolution_context.expect("a length-valued property must run with a resolution context");
- let result = absolutize_length(*length_value, *unit as usize, resolution_context);
+ // NB: Recursive simplification already applied zoom to these length leaves.
+ let mut resolution_context =
+ *length_resolution_context.expect("a length-valued property must run with a resolution context");
+ resolution_context.zoom = 1.0;
+ let result = absolutize_length(*length_value, *unit as usize, &resolution_context);
if result.handled {
absolutized = Some(result.changed.then_some(result.px));
}
@@ -3926,6 +4113,7 @@ pub(crate) unsafe fn drive_property_computation(
let result = compute_border_or_outline_width(
synthesized.as_ref().unwrap_or(value_data),
device_pixels_per_css_pixel,
+ length_resolution_context.map_or(1.0, |context| context.zoom),
None,
);
if result.handled {
@@ -3952,6 +4140,7 @@ pub(crate) unsafe fn drive_property_computation(
let result = compute_border_or_outline_width(
value_data,
device_pixels_per_css_pixel,
+ 1.0,
Some(&calc_resolution_context),
);
if resolved_viewport_relative_length {
@@ -4078,11 +4267,17 @@ pub(crate) unsafe fn drive_property_computation(
Some(StyleValueData::Integer { value }) => *value,
_ => 0,
};
- Some((CssPixels::nearest_value_for(*value), math_depth))
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // NB: The parent's font-size is zoomed by its effective zoom already, so it takes
+ // the element's own zoom alone.
+ Some((CssPixels::nearest_value_for(*value * zoom.length_zoom()), math_depth))
}
_ => None,
},
- None => Some((CssPixels::from_raw(initial_font_size_raw), 0)),
+ None => Some((
+ CssPixels::from_raw(initial_font_size_raw).scaled(zoom.length_effective_zoom()),
+ 0,
+ )),
};
match inherited {
Some((inherited_font_size, inherited_math_depth)) => {
@@ -4092,7 +4287,7 @@ pub(crate) unsafe fn drive_property_computation(
computed_math_depth,
inherited_font_size,
inherited_math_depth,
- CssPixels::from_raw(default_font_size_raw),
+ CssPixels::from_raw(default_font_size_raw).scaled(zoom.length_effective_zoom()),
);
if result.handled {
if result.unchanged {
@@ -4453,6 +4648,35 @@ pub(crate) unsafe fn drive_property_computation(
None => NativeValue::Unsupported,
}
}
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // Computed value: as specified, but with <percentage> converted to the equivalent <number>
+ (_, prop::ZOOM) => {
+ let number = match value_data {
+ StyleValueData::Number { value } => Some(*value),
+ StyleValueData::Percentage { value } => Some(value / 100.0),
+ // INTEROP: Other browsers accept normal, as a zoom of 1.
+ StyleValueData::Keyword {
+ keyword: keyword::NORMAL,
+ } => Some(1.0),
+ StyleValueData::Calculated { .. } => {
+ let resolution_context =
+ length_resolution_context.expect("a calculated zoom requires a resolution context");
+ crate::css::calc::resolve_calculated_number_with_context(value_data, resolution_context)
+ .or_else(|| {
+ crate::css::calc::resolve_calculated_percentage_without_context(value_data)
+ .map(|percentage| percentage / 100.0)
+ })
+ }
+ _ => None,
+ };
+ match number {
+ // A 0 value is treated as if it was 1.
+ // INTEROP: Other browsers compute it to 1.
+ Some(0.0) => NativeValue::Number(1.0),
+ Some(number) => NativeValue::Number(number),
+ None => NativeValue::Unsupported,
+ }
+ }
(_, prop::CONTAIN) => match collapse_containment_list(value_data) {
Some(value) => NativeValue::StyleValue(value),
None => NativeValue::Unchanged,
@@ -4463,6 +4687,12 @@ pub(crate) unsafe fn drive_property_computation(
None => NativeValue::Unchanged,
}
}
+ (None, _)
+ if externally_absolutized.is_some()
+ && !property_has_dedicated_compute_rule(inherited_property_id) =>
+ {
+ NativeValue::Unchanged
+ }
(None, _) if !property_has_dedicated_compute_rule(inherited_property_id) => {
// The recursive native absolutization: structural values and their
// length leaves resolve here; anything it declines computes in C++.
@@ -4649,8 +4879,16 @@ pub(crate) unsafe fn drive_property_computation(
}
store(entry);
}
+ if property_id == prop::ZOOM {
+ zoom.zoom = used_zoom(
+ longhand_table
+ .get(prop::ZOOM)
+ .and_then(RetainedStyleValueData::optional_data),
+ );
+ }
}
+ longhand_table.set_effective_zoom(zoom.effective_zoom() as f32);
assert!(
pending_overflow_x_store.is_none(),
"overflow-y must follow overflow-x in computation order"
@@ -5660,6 +5898,7 @@ pub unsafe extern "C" fn rust_create_document_longhand_table(
device_pixels_per_css_pixel: input.device_pixels_per_css_pixel,
initial_font_size_raw: input.initial_font_size_raw,
default_font_size_raw: input.default_font_size_raw,
+ root_effective_zoom: 1.0,
};
let mut results = empty_longhand_driver_results();
let mut effective_color_scheme = -1;
@@ -5814,6 +6053,9 @@ pub(crate) fn compute_animation_keyframe_longhands(
property_id::_WEBKIT_BOX_ORIENT,
property_id::CONTINUE,
property_id::BACKGROUND_IMAGE,
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // NB: The keyframe lengths are zoomed by the element's zoom, as its own lengths are.
+ property_id::ZOOM,
] {
if let Some(value) = underlying_longhand_table.get(property_id) {
table.set(property_id, value.clone_retained(), -1);
@@ -8275,6 +8517,7 @@ mod tests {
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: true,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
}
}
@@ -8318,12 +8561,15 @@ mod tests {
let batch = recascade_font_size_batch(
values.len(),
|index| values[index],
+ |_| 1.0,
+ |_| true,
0,
default_size.raw_value(),
false,
default_size.raw_value(),
FfiFontSizeRecascadeDocumentInputs {
root_font_size: 16.0,
+ root_effective_zoom: 1.0,
root_font_metrics_depend_on_viewport_metrics: false,
viewport_width: 800.0,
viewport_height: 600.0,
@@ -8349,12 +8595,15 @@ mod tests {
let batch = recascade_font_size_batch(
values.len(),
|index| values[index],
+ |_| 1.0,
+ |_| true,
0,
CssPixels::from_integer(13).raw_value(),
false,
CssPixels::from_integer(13).raw_value(),
FfiFontSizeRecascadeDocumentInputs {
root_font_size: 20.0,
+ root_effective_zoom: 1.0,
root_font_metrics_depend_on_viewport_metrics: false,
viewport_width: 800.0,
viewport_height: 600.0,
@@ -8366,6 +8615,41 @@ mod tests {
assert!(batch.depends_on_viewport_metrics);
}
+ #[test]
+ fn font_size_recascade_applies_each_ancestor_zoom_once() {
+ let px = StyleValueData::Length {
+ value: 10.0,
+ unit: unit_code("px") as u8,
+ };
+ let percentage = StyleValueData::Percentage { value: 200.0 };
+ let em = StyleValueData::Length {
+ value: 2.0,
+ unit: unit_code("em") as u8,
+ };
+ let values = [Some(&px), None, Some(&percentage), Some(&em)];
+ let zooms = [2.0, 6.0, 3.0, 1.5];
+ let batch = recascade_font_size_batch(
+ values.len(),
+ |index| values[index],
+ |index| zooms[index],
+ |_| true,
+ 0,
+ CssPixels::from_integer(13).raw_value(),
+ false,
+ CssPixels::from_integer(13).raw_value(),
+ FfiFontSizeRecascadeDocumentInputs {
+ root_font_size: 20.0,
+ root_effective_zoom: 2.0,
+ root_font_metrics_depend_on_viewport_metrics: false,
+ viewport_width: 800.0,
+ viewport_height: 600.0,
+ },
+ None,
+ );
+ assert!(batch.status == FontSizeRecascadeStatus::Complete);
+ assert_eq!(batch.current_size_raw, CssPixels::from_integer(60).raw_value());
+ }
+
#[test]
fn font_size_recascade_stops_for_a_length_that_needs_font_metrics() {
let ex = StyleValueData::Length {
@@ -8376,12 +8660,15 @@ mod tests {
let batch = recascade_font_size_batch(
values.len(),
|index| values[index],
+ |_| 1.0,
+ |_| true,
0,
CssPixels::from_integer(13).raw_value(),
false,
CssPixels::from_integer(13).raw_value(),
FfiFontSizeRecascadeDocumentInputs {
root_font_size: 16.0,
+ root_effective_zoom: 1.0,
root_font_metrics_depend_on_viewport_metrics: false,
viewport_width: 800.0,
viewport_height: 600.0,
@@ -8560,13 +8847,13 @@ mod tests {
value: 2.5,
unit: unit_code("px") as u8,
};
- assert_eq!(compute_border_or_outline_width(&length, 2.0, None).value, 2.5);
+ assert_eq!(compute_border_or_outline_width(&length, 2.0, 1.0, None).value, 2.5);
// 0.4px at 1 dppx rounds up to 1 device pixel.
let thin = StyleValueData::Length {
value: 0.4,
unit: unit_code("px") as u8,
};
- assert_eq!(compute_border_or_outline_width(&thin, 1.0, None).value, 1.0);
+ assert_eq!(compute_border_or_outline_width(&thin, 1.0, 1.0, None).value, 1.0);
// medium is 3px.
assert_eq!(
compute_border_or_outline_width(
@@ -8574,6 +8861,7 @@ mod tests {
keyword: keyword::MEDIUM
},
1.0,
+ 1.0,
None
)
.value,
diff --git a/Libraries/LibWeb/Rust/src/css/style_value.rs b/Libraries/LibWeb/Rust/src/css/style_value.rs
index 330c11c00a1..c7bebbbd415 100644
--- a/Libraries/LibWeb/Rust/src/css/style_value.rs
+++ b/Libraries/LibWeb/Rust/src/css/style_value.rs
@@ -3610,6 +3610,40 @@ pub unsafe extern "C" fn rust_style_value_retain(value: *const StyleValueData) -
unsafe { retain_style_value(value) }
}
+/// https://drafts.csswg.org/css-viewport/#zoom-om
+/// Computed style APIs (i.e., all values returned by getComputedStyle()) that are non-auto and non-percentage lengths
+/// must be unscaled.
+/// The computed value `value` of an element whose effective zoom is `zoom`, with its lengths unscaled, retained for the
+/// caller; null where unscaling changes nothing.
+#[unsafe(no_mangle)]
+pub extern "C" fn rust_style_value_unscaled_by_zoom(value: &StyleValueData, zoom: f64) -> *const StyleValueData {
+ if zoom == 1.0 || !zoom.is_normal() || zoom < 0.0 {
+ return std::ptr::null();
+ }
+ let length = crate::css::style_compute::FfiLengthResolutionContext {
+ zoom: 1.0 / zoom,
+ ..Default::default()
+ };
+ let context = crate::css::absolutize::AbsolutizationContext {
+ length: &length,
+ scheme: None,
+ resolved_viewport_relative_length: std::cell::Cell::new(false),
+ tree_counting: None,
+ random_base_values: &[],
+ document_base_url: &[],
+ style_sheet_resource_context: None,
+ current_color: None,
+ };
+ match crate::css::absolutize::absolutize(value, &context) {
+ Some(crate::css::absolutize::Absolutized::Changed(unscaled)) => {
+ let pointer = unscaled.pointer();
+ std::mem::forget(unscaled);
+ pointer
+ }
+ _ => std::ptr::null(),
+ }
+}
+
#[cfg(test)]
mod substitution_clone_tests {
use super::*;
diff --git a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
index 30c39b24a4f..f6e4bb38501 100644
--- a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
+++ b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
@@ -3358,6 +3358,7 @@ pub(crate) fn rebuild_group_from_table_and_overlay(
values.handle(property_id::CONTENT_VISIBILITY),
values.handle(property_id::IMAGE_RENDERING),
values.handle(property_id::TEXT_ORIENTATION),
+ table.effective_zoom(),
parent,
),
group_index::SIZING => build_sizing_group(
@@ -3442,6 +3443,7 @@ pub(crate) unsafe fn build_group_payloads_from_table(
values.handle(property_id::CONTENT_VISIBILITY),
values.handle(property_id::IMAGE_RENDERING),
values.handle(property_id::TEXT_ORIENTATION),
+ table.effective_zoom(),
parent,
),
group_index::SIZING => build_sizing_group(
diff --git a/Libraries/LibWeb/Rust/src/layout/node_facts.rs b/Libraries/LibWeb/Rust/src/layout/node_facts.rs
index d7facdc6888..f93fc529b63 100644
--- a/Libraries/LibWeb/Rust/src/layout/node_facts.rs
+++ b/Libraries/LibWeb/Rust/src/layout/node_facts.rs
@@ -854,6 +854,35 @@ impl<'pass> NodeFacts<'pass> {
}
fn physical_replaced_content(&self) -> crate::layout::FfiReplacedContentFacts {
+ let mut facts = self.unzoomed_physical_replaced_content();
+ // NB: SVG geometry and explicit intrinsic inner sizes already resolve against computed lengths.
+ if self.data().kind.get() == NodeKind::SVGSVGBox
+ || (self.data().kind.get() != NodeKind::SVGImageBox && self.node_has_size_containment())
+ {
+ return facts;
+ }
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // It also multiplies the natural size of all replaced elements [...] by the used value of 'zoom'.
+ let zoom = self
+ .computed_values_view_if_styled()
+ .map_or(1.0, |style| style.effective_zoom());
+ if zoom != 1.0 {
+ match self.data().kind.get() {
+ // NB: These dimensions are derived from font metrics that already include zoom.
+ NodeKind::TextAreaBox | NodeKind::TextInputBox => {}
+ NodeKind::RangeInputBox => {
+ facts.auto_content_height = facts.auto_content_height.scaled(f64::from(zoom));
+ }
+ _ => {
+ facts.auto_content_width = facts.auto_content_width.scaled(f64::from(zoom));
+ facts.auto_content_height = facts.auto_content_height.scaled(f64::from(zoom));
+ }
+ }
+ }
+ facts
+ }
+
+ fn unzoomed_physical_replaced_content(&self) -> crate::layout::FfiReplacedContentFacts {
if self.data().kind.get() == NodeKind::SVGSVGBox {
return self.svg_root_replaced_content();
}
diff --git a/Libraries/LibWeb/Rust/src/layout/svg_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/svg_formatting_context.rs
index 292e7c4c1e7..c46de80b5a4 100644
--- a/Libraries/LibWeb/Rust/src/layout/svg_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/svg_formatting_context.rs
@@ -2568,6 +2568,7 @@ fn length_resolution_context(
container_height_basis_depends_on_viewport_metrics: false,
subject_inline_axis_is_horizontal: style.writing_mode() == writing_mode::HORIZONTAL_TB,
resolved_viewport_relative_length: std::ptr::null_mut(),
+ zoom: 1.0,
}
}
diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/background_resolution.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/background_resolution.rs
index 7cd6a9a3df9..d554b9e2807 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/paint/background_resolution.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/background_resolution.rs
@@ -488,6 +488,7 @@ fn resolve_layers<'a, O: Observer>(
border_radii: crate::painting::border_radii::BorderRadii,
edges: Option<(FfiPixelBox, FfiPixelBox)>,
layer_type: LayerType,
+ zoom: f32,
) -> ResolvedBackground<'a> {
use css_enums::{background_attachment, repetition};
let border_box = BackgroundBox {
@@ -539,7 +540,14 @@ fn resolve_layers<'a, O: Observer>(
transparent_mask_layer(&mut resolved_layers);
continue;
};
- let intrinsics = layer_image_intrinsics(recorder, &image);
+ let mut intrinsics = layer_image_intrinsics(recorder, &image);
+ // https://drafts.csswg.org/css-viewport/#zoom-property
+ // It also multiplies the natural size of [...] background images [...] by the used value of 'zoom'.
+ if zoom != 1.0 {
+ let zoomed = |size: Option<CssPixels>| size.map(|size| size.scaled(f64::from(zoom)));
+ intrinsics.natural.width = zoomed(intrinsics.natural.width);
+ intrinsics.natural.height = zoomed(intrinsics.natural.height);
+ }
image.selected_image_value = intrinsics.selected_image_value;
if !intrinsics.is_paintable {
transparent_mask_layer(&mut resolved_layers);
@@ -793,6 +801,7 @@ pub(crate) fn resolve_background_layers<'a, O: Observer>(
border_radii,
edges,
LayerType::Background,
+ style.effective_zoom(),
)
}
@@ -813,6 +822,7 @@ pub(crate) fn resolve_mask_layers<'a, O: Observer>(
crate::painting::border_radii::BorderRadii::default(),
None,
LayerType::Mask,
+ style.effective_zoom(),
)
}
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/iframe-very-small-zoom-001-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/iframe-very-small-zoom-001-crash.html
new file mode 100644
index 00000000000..05369040456
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/iframe-very-small-zoom-001-crash.html
@@ -0,0 +1,4 @@
+<style>
+* { zoom: 13% }
+</style>
+<iframe>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/massive-zoom-viewbox-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/massive-zoom-viewbox-crash.html
new file mode 100644
index 00000000000..b3b2bac6eea
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/massive-zoom-viewbox-crash.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<style>
+* {
+ zoom: 18446744073709551617;
+}
+</style>
+<fieldset>
+<svg height="0em" viewbox="0,65537,0,0"></svg>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/perspective-small-effective-zoom-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/perspective-small-effective-zoom-crash.html
new file mode 100644
index 00000000000..ab6f563d19e
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/perspective-small-effective-zoom-crash.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!-- Reference bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1922339 -->
+<style>
+@keyframes kf {
+ from { transform: perspective(10px) }
+}
+* {
+ zoom: 10%;
+ animation: kf 1s;
+}
+</style>
+<svg></svg>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scroll-corner-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scroll-corner-crash.html
new file mode 100644
index 00000000000..0ec88deb748
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scroll-corner-crash.html
@@ -0,0 +1,7 @@
+<style>
+* {
+ overflow: scroll scroll;
+}
+</style>
+<h4 style="zoom: 3">
+<figure>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scrollbar-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scrollbar-crash.html
new file mode 100644
index 00000000000..791022407fd
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/scrollbar-crash.html
@@ -0,0 +1,2 @@
+<textarea style="zoom: 0.20">
+
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/textarea-very-small-zoom-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/textarea-very-small-zoom-crash.html
new file mode 100644
index 00000000000..071aaabe609
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/textarea-very-small-zoom-crash.html
@@ -0,0 +1,6 @@
+<style>
+*:nth-of-type(1) {
+ zoom: 5%;
+}
+</style>
+<textarea>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/tiny-zoom-iframe-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/tiny-zoom-iframe-crash.html
new file mode 100644
index 00000000000..97c2c4d753c
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/tiny-zoom-iframe-crash.html
@@ -0,0 +1,10 @@
+<style>
+* { zoom: 5% }
+</style>
+<script>
+document.addEventListener("DOMContentLoaded", () => {
+ b.appendChild(document.createElement("iframe"))
+})
+</script>
+<math>
+<ms id="b">1</ms>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/view-timeline-inset-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/view-timeline-inset-crash.html
new file mode 100644
index 00000000000..36fedb33ab2
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/view-timeline-inset-crash.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<title>Inheriting initial view-timeline-inset into zoomed element should not crash</title>
+<link rel="help" href="https://crbug.com/562857743">
+<p>Pass if no crash</p>
+<div style="zoom:2;view-timeline-inset: inherit"></div>
diff --git a/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/zoom-revert-layer-crash.html b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/zoom-revert-layer-crash.html
new file mode 100644
index 00000000000..c75b792e6de
--- /dev/null
+++ b/Tests/LibWeb/Crash/wpt-import/css/css-viewport/zoom/zoom-revert-layer-crash.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<title>Don't crash when zooming revert-layer</title>
+<link rel="help" href="https://issues.chromium.org/issues/398060133">
+<span style="zoom: 101%; line-height: revert-layer">PASS if no crash</span>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/background-image-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/background-image-ref.html
new file mode 100644
index 00000000000..925ad4ed116
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/background-image-ref.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<style>
+div {
+ width: 10px;
+ height: 10px;
+ background-image: image-set(url("../../../images/pattern.png") 2x);
+}
+</style>
+<div></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/basic-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/basic-ref.html
new file mode 100644
index 00000000000..5de90caf7f0
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/basic-ref.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS test reference</title>
+<style>
+div {
+ background-color: green;
+}
+</style>
+<div style="width: 100px; height: 100px"></div>
+<div style="width: 200px; height: 200px;"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-image-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-image-width-ref.html
new file mode 100644
index 00000000000..64d26e39f05
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-image-width-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-width when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+.box {
+ width: calc(60px * var(--scale));
+ height: calc(60px * var(--scale));
+ border-image: url("data:image/svg+xml,%3csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100' height='100' fill='red'/%3e%3c/svg%3e") 30;
+ border-image-width: calc(8px * var(--scale));
+ margin: calc(10px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div class="box"></div>
+
+<div class="zoom">
+ <div class="box"></div>
+</div>
+
+<div class="zoom box"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-ref.html
new file mode 100644
index 00000000000..14a1dab3a19
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>border:inherit applies zoom (ref)</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<style>
+ body > div {
+ border: 1px solid black;
+ }
+ body > div > div {
+ width: 100px;
+ height: 100px;
+ border: 10px solid black;
+ background: green;
+ }
+</style>
+<div>
+ <div></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-width-ref.html
new file mode 100644
index 00000000000..3365a8c5e7f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/border-width-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-width when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+.box {
+ width: calc(60px * var(--scale));
+ height: calc(60px * var(--scale));
+ border: calc(8px * var(--scale)) solid red;
+ margin: calc(10px * var(--scale));
+ display: inline-block;
+ font-size: calc(16px * var(--scale));
+}
+.box-rem {
+ width: calc(60px * var(--scale));
+ height: calc(60px * var(--scale));
+ border: calc(0.5rem * var(--scale)) solid blue;
+ margin: calc(10px * var(--scale));
+ display: inline-block;
+ font-size: calc(1rem * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+.box-left {
+ border-left-width: calc(3px * var(--scale, 1));
+ border-left-style: solid;
+ font-size: calc(1rem * var(--scale));
+ display: inline-block;
+}
+</style>
+
+<div class="box">unzoomed px</div>
+<div class="box-rem">unzoomed rem</div>
+
+<div class="zoom">
+ <div class="box">zoomed px</div>
+</div>
+
+<div class="zoom box">zoomed inherited px</div>
+<div class="zoom box-rem">zoomed inherited rem</div>
+
+<div>
+ <div class="zoom box-left">zoomed px</div>
+ <div class="zoom box-left">zoomed px</div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/canvas-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/canvas-ref.html
new file mode 100644
index 00000000000..d1b9a0d68dd
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/canvas-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<style>
+canvas {
+ width: 600px;
+ height: 200px;
+}
+</style>
+<script>
+document.addEventListener("DOMContentLoaded", () => {
+ const ctx = document.getElementById("canvas").getContext("2d");
+ ctx.font = "48px serif";
+ ctx.fillText(ctx.font, 10, 50);
+});
+</script>
+<canvas id="canvas" width="300" height="100"></canvas>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius-ref.html
new file mode 100644
index 00000000000..13d823db860
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<title>border-radius:inherit applies zoom (ref)</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<style>
+ .zoomed {
+ background: coral;
+ width: 200px;
+ height: 200px;
+ border: 10px solid black;
+ border-radius: 40px;
+ }
+</style>
+<div class=zoomed></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/column-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/column-ref.html
new file mode 100644
index 00000000000..739f1f50ca5
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/column-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<title>column:inherit applies zoom (ref)</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<style>
+ .zoomed {
+ background: skyblue;
+ font-size: 32px;
+ width: 600px;
+ height: 400px;
+ column-width: 80px;
+ column-height: 300px;
+ column-gap: 20px;
+ column-rule-color: black;
+ column-rule-style: solid;
+ column-rule-width: 10px;
+ column-fill: auto;
+ }
+ .inner {
+ background: coral;
+ }
+</style>
+<div class=zoomed>
+ <div class=inner>1</div>
+ <div class=inner>2</div>
+ <div class=inner>3</div>
+ <div class=inner>4</div>
+ <div class=inner>5</div>
+ <div class=inner>6</div>
+ <div class=inner>7</div>
+ <div class=inner>8</div>
+ <div class=inner>9</div>
+ <div class=inner>10</div>
+ <div class=inner>11</div>
+ <div class=inner>12</div>
+ <div class=inner>13</div>
+ <div class=inner>14</div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis-ref.html
new file mode 100644
index 00000000000..037aae9c2c8
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>flex-basis:inherit applies zoom (ref)</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<style>
+ .container {
+ display: flex;
+ background: skyblue;
+ }
+ .zoomed {
+ background: coral;
+ flex-basis: 100px;
+ height: 200px;
+ }
+</style>
+<div class=container>
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/margin-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/margin-ref.html
new file mode 100644
index 00000000000..940295901dd
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/margin-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>margin:inherit applies zoom (ref)</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<style>
+ .zoomed {
+ background: coral;
+ width: 100px;
+ height: 100px;
+ margin: 20px;
+ }
+</style>
+<div class=zoomed></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/outline-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/outline-ref.html
new file mode 100644
index 00000000000..7889460ea96
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/outline-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<title>outline:inherit applies zoom (ref)</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<style>
+ .zoomed {
+ background: coral;
+ width: 100px;
+ height: 100px;
+ margin: 100px;
+ outline-width: 20px;
+ outline-offset: 10px;
+ outline-style: solid;
+ outline-color: black;
+ }
+</style>
+<div class=zoomed></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/padding-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/padding-ref.html
new file mode 100644
index 00000000000..7c8c4eca0fd
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/padding-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>padding:inherit applies zoom (ref)</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<style>
+ .parent {
+ background: coral;
+ width: 100px;
+ height: 100px;
+ padding: 20px;
+ }
+ .inner {
+ background: green;
+ width: 100%;
+ height: 100%;
+ }
+</style>
+<div class=parent>
+ <div class=inner></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/width-ref.html
new file mode 100644
index 00000000000..b1b5e115672
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/explicit-inherit/width-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to width when specified and inherited</title>
+<link rel="author" title="Chris Harrelson" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<style>
+ #parent {
+ width: 100px;
+ background: red;
+ }
+ #child-zoomed {
+ width: inherit;
+ background: lime;
+ width: 200px;
+ height: 200px;
+ }
+ #child {
+ width: 200px;
+ height: 200px;
+ background: green;
+ }
+</style>
+<p>You should see two squares below. One lime, and one green.</p>
+<div id="parent">
+ <div id="child-zoomed"></div>
+ <div id="child"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-specified-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-specified-ref.html
new file mode 100644
index 00000000000..3395465c5d5
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-specified-ref.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to font-size when specified by keywords</title>
+<div style="font-size: medium">
+ <div style="zoom: 2">This is some zoomed medium text</div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-ref.html
new file mode 100644
index 00000000000..30eaa4aeb9f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/font-size-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>CSS Test reference</title>
+<div style="font-size: 12px">
+ 12px text
+</div>
+
+<hr>
+
+<div style="font-size: 24px;">
+ 12px zoomed text
+</div>
+
+<hr>
+
+<div style="font-size: 12px">
+ <div style="font-size: 24px">
+ 12px zoomed inherited text
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/green-square-100px.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/green-square-100px.html
new file mode 100644
index 00000000000..6677176230e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/green-square-100px.html
@@ -0,0 +1,3 @@
+<!doctype html>
+<meta charset="utf-8">
+<div style="width: 100px; height: 100px; background-color: green"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/line-height-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/line-height-ref.html
new file mode 100644
index 00000000000..a34093cce75
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/line-height-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to line-height when specified and inherited</title>
+<link rel="author" title="Chris Harrelson" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<div style="line-height: 12px; font-size: 12px">
+ Double-spaced<br>12px font text
+</div>
+
+<hr>
+
+<div style="line-height: 24px; font-size: 24px;">
+ Double-spaced<br>12px font zoomed text
+</div>
+
+<hr>
+
+<div style="line-height: 12px; font-size: 12px">
+ <div style="line-height: 24px; font-size: 24px">
+ Double-spaced<br>12px font zoomed inherited text
+ </div>
+</div>
+
+<hr>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/mask-border-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/mask-border-width-ref.html
new file mode 100644
index 00000000000..184a08f3356
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/mask-border-width-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style>
+ body {
+ --scale: 1;
+ }
+
+ .box {
+ width: calc(50px * var(--scale));
+ height: calc(50px * var(--scale));
+ background-color: red;
+ mask-border-slice: 10;
+ mask-border-source: linear-gradient(45deg, pink, blue, white, black, green);
+ mask-border-width: calc(8px * var(--scale));
+ margin: calc(10px * var(--scale));
+ }
+
+ .zoom {
+ --scale: 2;
+ }
+</style>
+
+<div class="box"></div>
+
+<div class="zoom">
+ <div class="box"></div>
+</div>
+
+<div class="zoom box"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-anim-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-anim-ref.html
new file mode 100644
index 00000000000..aca525d0826
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-anim-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Reference: Zoom property on transformed animated element</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+
+<style>
+.container {
+ width: 200px;
+ height: 200px;
+ border: 1px solid;
+}
+
+#foo {
+ width: 100px;
+ height: 100px;
+ background: purple;
+ transform: matrix(1, 0, 0, 1, 100, 100);
+}
+</style>
+
+<div class="container">
+ <div id="foo"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-ref.html
new file mode 100644
index 00000000000..de3a71c047f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix-zoom-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Zoom property on elements with a transformation matrix used</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+<style>
+div {
+ width: 200px;
+ height: 200px;
+ background-color: green;
+}
+</style>
+<div style="transform: translate(200px, 200px)"></div>
+<div style="transform: matrix(1, 0, 0, -1, 200, 200)"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix3d-zoom-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix3d-zoom-ref.html
new file mode 100644
index 00000000000..cef71e0cc9e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/matrix3d-zoom-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Zoom property on elements with a 3D transformation matrix used</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+<style>
+div {
+ width: 200px;
+ height: 200px;
+ background: green;
+}
+</style>
+<div style="transform: translate(200px, 200px)"></div>
+<div style="transform: matrix3d(
+ 0.5,0,-0.75,0,
+ 0.75,1.25,-1,0,
+ 0.75,0,0.5,0,
+ 50,0,30,1
+);"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/abspos-static-position-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/abspos-static-position-ref.html
new file mode 100644
index 00000000000..49077ed497e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/abspos-static-position-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<style>
+body {
+ margin: 0;
+}
+.parent {
+ margin-top: 100px;
+ margin-left: 25%;
+ height: 200px;
+ outline: 4px solid black;
+}
+
+.abspos {
+ position: absolute;
+ width: 200px;
+ height: 200px;
+ background-color: green;
+}
+</style>
+<body>
+<div class="parent">
+ <div class="abspos"></div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/animation-range-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/animation-range-ref.html
new file mode 100644
index 00000000000..712deba7230
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/animation-range-ref.html
@@ -0,0 +1,102 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.spacer {
+ height: 1000px;
+}
+.scroller {
+ display: inline-block;
+ outline: 1px solid black;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: scroll;
+ width: 200px;
+ height: 200px;
+}
+
+.scroller-zoomed {
+ display: inline-block;
+ outline: 1px solid black;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: scroll;
+ width: 200px;
+ height: 200px;
+}
+
+.target {
+ position: fixed;
+ height: 100px;
+ width: 100px;
+ background-color: black;
+}
+.target-zoomed {
+ position: fixed;
+ height: 100px;
+ width: 100px;
+ background-color: black;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="scroller" id="scroller1">
+ <div class="target" id="target1"></div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller" id="scroller2">
+ <div class="target" id="target2"></div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div class="scroller-zoomed" id="scroller3">
+ <div class="target-zoomed" id="target3"></div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller-zoomed" id="scroller4">
+ <div class="target-zoomed" id="target4"></div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<script>
+ window.addEventListener('load', function() {
+ const target1 = document.getElementById('target1');
+ const target2 = document.getElementById('target2');
+ const target3 = document.getElementById('target3');
+ const target4 = document.getElementById('target4');
+
+ const scroller1 = document.getElementById('scroller1');
+ const scroller2 = document.getElementById('scroller2');
+ const scroller3 = document.getElementById('scroller3');
+ const scroller4 = document.getElementById('scroller4');
+
+ const maxScroll1 = scroller1.scrollHeight - scroller1.clientHeight;
+ scroller1.scrollTop = (maxScroll1 + 300) * 0.5;
+
+ const maxScroll2 = scroller2.scrollHeight - scroller2.clientHeight;
+ scroller2.scrollTop = (maxScroll2 + 300) * 0.5;
+
+ const maxScroll3 = scroller3.scrollHeight - scroller3.clientHeight;
+ scroller3.scrollTop = (maxScroll3 + 300) * 0.5;
+
+ const maxScroll4 = scroller4.scrollHeight - scroller4.clientHeight;
+ scroller4.scrollTop = (maxScroll4 + 300) * 0.5;
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/background-size-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/background-size-ref.html
new file mode 100644
index 00000000000..89a67c58de4
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/background-size-ref.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ background-size: 50px;
+ display: inline-block;
+}
+.container {
+ background-image: url("../../../../images/pattern.png");
+ width: 40px;
+ height: 40px;
+}
+.container-zoom {
+ background-image: url("../../../../images/pattern.png");
+ width: 80px;
+ height: 80px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="background-size: 50px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="background-size: 50px;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="background-size: 100px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="background-size: 100px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-image-outset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-image-outset-ref.html
new file mode 100644
index 00000000000..097e498bf03
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-image-outset-ref.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border-image-outset: 5px;
+ display: inline-block;
+ padding: 10px;
+}
+.container {
+ border: 10px solid red;
+ border-image: url("../../../../images/green.png") 2;
+}
+.container-zoom {
+ border: 20px solid red;
+ border-image: url("../../../../images/green.png") 2;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="border-image-outset: 5px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="border-image-outset: 5px;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="border-image-outset: 10px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="border-image-outset: 10px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-radius-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-radius-ref.html
new file mode 100644
index 00000000000..592a4824586
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-radius-ref.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 10px;
+ margin: 10px;
+ width: max-content;
+}
+
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ border: solid black 1px;
+}
+
+#container-zoomed {
+ display: inline-block;
+ width: 400px;
+ height: 200px;
+ border: solid black 2px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching border radii.</p>
+<div class="group">
+ <div id="container" style="border-radius: 20px;">
+ </div>
+ <div style="display: inline-block; border-radius: 20px;">
+ <div id="container" style="border-radius: 20px;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div id="container-zoomed" style="border-radius: 40px;">
+ </div>
+ <div style="display: inline-block;">
+ <div id="container-zoomed" style="border-radius: 40px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-ref.html
new file mode 100644
index 00000000000..c5b18cc3c37
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-ref.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-spacing when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+.table {
+ display: table;
+}
+.row {
+ display: table-row;
+}
+.cell {
+ display: table-cell;
+ border: calc(0.5rem * var(--scale)) solid hotpink;
+ font-size: calc(1rem * var(--scale));
+}
+.spacing {
+ border-collapse: separate;
+ border-spacing: calc(17px * var(--scale)) calc(11px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div class="table spacing">
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+</div>
+
+<div class="table spacing zoom">
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+</div>
+
+<div class="table spacing zoom">
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-without-border-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-without-border-ref.html
new file mode 100644
index 00000000000..cec4adccaab
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-without-border-ref.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-spacing when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+.table {
+ display: table;
+}
+.row {
+ display: table-row;
+}
+.cell {
+ display: table-cell;
+ font-size: calc(1rem * var(--scale));
+}
+.spacing {
+ border-collapse: separate;
+ border-spacing: calc(17px * var(--scale)) calc(11px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div class="table spacing">
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+</div>
+
+<div class="table spacing zoom">
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+</div>
+
+<div class="table spacing zoom">
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-width-keywords-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-width-keywords-ref.html
new file mode 100644
index 00000000000..b4312c6f81f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/border-width-keywords-ref.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ .initial {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ border-color: blue;
+ border-style: solid;
+ border-top-width: 6px;
+ border-right-width: 6px;
+ border-bottom-width: 6px;
+ border-left-width: 6px;
+ }
+
+ .thin {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ border: 2px solid blue;
+ }
+
+ .medium {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ border: 6px solid blue;
+ }
+
+ .thick {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ border: 10px solid blue;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial"></div>
+ <div class="thin"></div>
+ <div class="medium"></div>
+ <div class="thick"></div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-inset-spread-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-inset-spread-ref.html
new file mode 100644
index 00000000000..d23b539fa0d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-inset-spread-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Inset box-shadow 1px spread stays even under fractional zoom</title>
+<style>
+ body { margin: 0; }
+ .box {
+ margin: 9.6px;
+ width: 120px; height: 72px;
+ box-shadow: inset 0 0 0 1.2px green;
+ background: white;
+ }
+</style>
+<div class="box"></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-ref.html
new file mode 100644
index 00000000000..95aaae1ba8a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to box-shadow when specified and inherited</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+ --shadowScaleOffsetX: 1;
+ --shadowScaleOffsetY: 1;
+ --shadowScaleBlurRadius: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ box-shadow: calc(5px * var(--shadowScaleOffsetX)) calc(5px * var(--shadowScaleOffsetY)) calc(2px * var(--shadowScaleBlurRadius)) black;
+}
+.zoomFont {
+ --scale: 2;
+}
+.zoomShadow {
+ --shadowScaleOffsetX: 2;
+ --shadowScaleOffsetY: 2;
+ --shadowScaleBlurRadius: 2;
+}
+</style>
+<div>unzoomed</div>
+<div class="zoomFont zoomShadow">zoomed</div>
+<div class="zoomFont">zoomed inherited</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-gap-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-gap-ref.html
new file mode 100644
index 00000000000..7a01269c4bf
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-gap-ref.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: block;
+ border: 1px solid black;
+ padding: 10px;
+ column-gap: 20px;
+}
+.container {
+ display: flex;
+ flex-direction: row;
+ width: 100px;
+}
+.container-zoom {
+ display: flex;
+ flex-direction: row;
+ width: 200px;
+}
+.container > div {
+ background-color: black;
+ width: 40px;
+ height: 10px;
+}
+.container-zoom > div {
+ background-color: black;
+ width: 80px;
+ height: 20px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-gap: 20px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-gap: 20px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="column-gap: 40px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="column-gap: 40px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-keywords-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-keywords-ref.html
new file mode 100644
index 00000000000..391bfc8df82
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-keywords-ref.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ body {
+ font-size: 32px;
+ }
+
+ .initial {
+ width: 200px;
+ height: 100px;
+ margin-bottom: 20px;
+ column-count: 2;
+ column-gap: 40px;
+ column-rule-color: blue;
+ column-rule-style: solid;
+ column-rule-width: 6px;
+ }
+
+ .thin {
+ width: 200px;
+ height: 100px;
+ margin-bottom: 20px;
+ column-count: 2;
+ column-gap: 40px;
+ column-rule: 2px solid blue;
+ }
+
+ .medium {
+ width: 200px;
+ height: 100px;
+ margin-bottom: 20px;
+ column-count: 2;
+ column-gap: 40px;
+ column-rule: 6px solid blue;
+ }
+
+ .thick {
+ width: 200px;
+ height: 100px;
+ margin-bottom: 20px;
+ column-count: 2;
+ column-gap: 40px;
+ column-rule: 10px solid blue;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial">Text content here to fill columns</div>
+ <div class="thin">Text content here to fill columns</div>
+ <div class="medium">Text content here to fill columns</div>
+ <div class="thick">Text content here to fill columns</div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-ref.html
new file mode 100644
index 00000000000..b4e47b1847b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-ref.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ column-rule-style: solid;
+ column-rule-width: 5px;
+ column-rule-color: transparent;
+ border: solid black 1px;
+}
+.container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ font-size: 16px;
+ column-count: 2;
+ column-rule-style: solid;
+ overflow: clip;
+}
+.container-zoomed {
+ display: inline-block;
+ width: 400px;
+ height: 200px;
+ font-size: 32px;
+ column-count: 2;
+ column-rule-style: solid;
+ overflow: clip;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-rule-width: 5px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-rule-width: 5px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoomed" style="column-rule-width: 10px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoomed" style="column-rule-width: 10px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-width-ref.html
new file mode 100644
index 00000000000..9ccea303474
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/column-width-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: block;
+ border: 1px solid black;
+ padding: 10px;
+ column-width: 100px;
+}
+.container {
+ height: 200px;
+ width: 300px;
+}
+.container-zoom {
+ height: 400px;
+ width: 600px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-width: 100px; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-width: 100px; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="column-width: 200px; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="column-width: 200px; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/custom-property-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/custom-property-ref.html
new file mode 100644
index 00000000000..bc162ce208a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/custom-property-ref.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+}
+.container {
+ background-color: black;
+ height: 20px;
+}
+.container-zoom {
+ background-color: black;
+ height: 40px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="width: 100px;"></div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="width: 100px;"></div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="width: 200px;"></div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="width: 200px;"></div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-blur-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-blur-ref.html
new file mode 100644
index 00000000000..071a1450b57
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-blur-ref.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: 1px solid black;
+ filter: blur(1px);
+}
+.container {
+ padding: 10px;
+ width: 25px;
+ height: 50px;
+}
+.container-zoom {
+ padding: 30px;
+ width: 75px;
+ height: 150px;
+}
+.swatch {
+ width: 25px;
+ height: 25px;
+}
+.swatch-zoom {
+ width: 75px;
+ height: 75px;
+}
+.red {
+ background-color: red;
+}
+.blue {
+ background-color: blue;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="filter: blur(1px);">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="filter: blur(1px);">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="filter: blur(3px);">
+ <div class="swatch-zoom red"></div>
+ <div class="swatch-zoom blue"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="filter: blur(3px);">
+ <div class="swatch-zoom red"></div>
+ <div class="swatch-zoom blue"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-drop-shadow-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-drop-shadow-ref.html
new file mode 100644
index 00000000000..b82f4609985
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/filters-drop-shadow-ref.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to drop-shadow when specified and inherited</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<style>
+body {
+ --scale: 1;
+}
+.container {
+ filter: drop-shadow(calc(5px * var(--scale)) calc(5px * var(--scale)) calc(5px * var(--scale)) black);
+ padding: calc(20px * var(--scale));
+}
+.circle-mask {
+ border-radius: calc(80px * var(--scale));;
+ overflow: hidden;
+ width: calc(100px * var(--scale));
+ height: calc(100px * var(--scale));
+}
+.green-box {
+ width: calc(100px * var(--scale));
+ height: calc(100px * var(--scale));
+ background-color: green;
+ font-size: calc(1rem * var(--scale));
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+<div class="container">
+ <div class="circle-mask">
+ <div class="green-box">unzoomed</div>
+ </div>
+</div>
+<div class="container">
+ <div class="circle-mask zoom">
+ <div class="green-box">zoomed</div>
+ </div>
+</div>
+<div class="container zoom">
+ <div class="circle-mask">
+ <div class="green-box">zoomed inherited</div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/grid-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/grid-ref.html
new file mode 100644
index 00000000000..a5469f0fd2d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/grid-ref.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: solid black 1px;
+}
+.container {
+ width: 100px;
+ height: 100px;
+ display: grid;
+ gap: 10px;
+}
+.container-zoom {
+ width: 200px;
+ height: 200px;
+ display: grid;
+ gap: 20px;
+}
+.item {
+ background: black;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="grid-template-columns: 40px 1fr 20px; grid-template-rows: 10px 30px 40px;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="grid-template-columns: 40px 1fr 20px; grid-template-rows: 10px 30px 40px;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="grid-template-columns: 80px 1fr 40px; grid-template-rows: 20px 60px 80px;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="grid-template-columns: 80px 1fr 40px; grid-template-rows: 20px 60px 80px;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/letter-spacing-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/letter-spacing-ref.html
new file mode 100644
index 00000000000..59df4318320
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/letter-spacing-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to letter-spacing when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<div style="letter-spacing: 2px; font-size: 12px">
+ 12px font text with 2px letter-spacing
+</div>
+
+<hr>
+
+<div style="letter-spacing: 4px; font-size: 24px;">
+ 12px font zoomed text with 2px letter-spacing
+</div>
+
+<hr>
+
+<div style="letter-spacing: 2px; font-size: 12px">
+ <div style="letter-spacing: 4px; font-size: 24px">
+ 12px font zoomed inherited text with 2px letter-spacing
+ </div>
+</div>
+
+<hr>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/list-style-image-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/list-style-image-ref.html
new file mode 100644
index 00000000000..c9f5f53b24d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/list-style-image-ref.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to list-style-image</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ list-style-image: url('#marker');
+ --scale: 1;
+}
+ul {
+ font-size: calc(1rem * var(--scale));
+ margin-block-start: calc(1rem * var(--scale));
+ margin-block-end: calc(1rem * var(--scale));
+ margin-inline-start: 0px;
+ margin-inline-end: 0px;
+ padding-inline-start: calc(40px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div>
+ <ul>
+ <li>unzoomed</li>
+ </ul>
+</div>
+
+<div>
+ <ul class="zoom">
+ <li>zoomed</li>
+ </ul>
+</div>
+
+<div>
+ <ul class="zoom">
+ <li>zoomed inherited</li>
+ </ul>
+</div>
+
+<svg viewBox="0 0 100 100" style="display:none">
+ <defs>
+ <g id="marker">
+ <circle cx="50%" cy="50%" r="50%" stroke="none" />
+ </g>
+ </defs>
+</svg>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/margin-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/margin-ref.html
new file mode 100644
index 00000000000..d64411cc5f5
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/margin-ref.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<title>CSS Zoom applies to margins</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<style>
+body {
+ --scale: 1;
+}
+
+#reference-overlapped-red {
+ background-color: red;
+ width: calc(100px * var(--scale));
+ height: calc(100px * var(--scale));
+ z-index: -1;
+}
+#reference-overlapped-big-red {
+ background-color: red;
+ width: calc(200px * var(--scale));
+ height: calc(200px * var(--scale));
+ z-index: -1;
+}
+
+.container {
+ padding: calc(20px * var(--scale));
+}
+.margin-container {
+ width: calc(200px * var(--scale));
+ margin-left: calc(-50px * var(--scale));
+}
+.margin-big-container {
+ width: 400px;
+ margin-left: -100px /*calc(-100px * var(--scale))*/;
+}
+.green-box {
+ background-color: green;
+ width: calc(100px * var(--scale));
+ height: calc(100px * var(--scale));
+ font-size: calc(1rem * var(--scale));
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+ margin: auto;
+ margin-top: calc(-100px * var(--scale));
+ justify-self: right;
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div class="container">
+ <div id=reference-overlapped-red></div>
+
+ <div class="margin-container">
+ <div class="green-box">unzoomed</div>
+ </div>
+</div>
+
+<div class="container">
+ <div id=reference-overlapped-big-red></div>
+
+ <div class="margin-big-container">
+ <div class="green-box zoom">zoomed</div>
+ </div>
+</div>
+
+<div class="container zoom">
+ <div id=reference-overlapped-red></div>
+
+ <div class="margin-container">
+ <div class="green-box">zoomed inherited</div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/mask-border-outset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/mask-border-outset-ref.html
new file mode 100644
index 00000000000..ae8739918f2
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/mask-border-outset-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ mask-border-outset: 5px;
+ display: inline-block;
+}
+.container {
+ mask-border-source: url("../../../../images/green.png");
+ mask-border-slice: 20;
+ background-color: black;
+ width: 50px;
+ height: 50px;
+}
+.container-zoom {
+ mask-border-source: url("../../../../images/green.png");
+ mask-border-slice: 20;
+ background-color: black;
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="mask-border-outset: 5px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="mask-border-outset: inherit;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="mask-border-outset: 10px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="mask-border-outset: 10px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-offset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-offset-ref.html
new file mode 100644
index 00000000000..f9f18d6c804
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-offset-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ outline-style: solid;
+}
+#container-zoomed {
+ display: inline-block;
+ width: 400px;
+ height: 200px;
+ outline-style: solid;
+}
+#spacer {
+ display: inline-block;
+ width: 40px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching outlines.</p>
+<div class="group">
+ <div id="container" style="outline-offset: 5px; outline-width: 1px;">
+ </div>
+ <div id="spacer"></div>
+ <div style="display: inline-block;">
+ <div id="container" style="outline-offset: 5px; outline-width: 1px;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div id="container-zoomed" style="outline-offset: 10px; outline-width: 2px;">
+ </div>
+ <div id="spacer"></div>
+ <div style="display: inline-block;">
+ <div id="container-zoomed" style="outline-offset: 10px; outline-width: 2px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-keywords-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-keywords-ref.html
new file mode 100644
index 00000000000..24d7735b3c7
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-keywords-ref.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ .initial {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ outline: 6px solid blue;
+ }
+
+ .thin {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ outline: 2px solid blue;
+ }
+
+ .medium {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ outline: 6px solid blue;
+ }
+
+ .thick {
+ width: 100px;
+ height: 100px;
+ margin-bottom: 20px;
+ outline: 10px solid blue;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial"></div>
+ <div class="thin"></div>
+ <div class="medium"></div>
+ <div class="thick"></div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-ref.html
new file mode 100644
index 00000000000..d1209cdc222
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/outline-width-ref.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ outline-style: solid;
+ outline-width: 5px;
+ outline-color: transparent;
+}
+.container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ outline-style: solid;
+}
+.container-zoomed {
+ display: inline-block;
+ width: 400px;
+ height: 200px;
+ outline-style: solid;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching outlines.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="outline-width: 5px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="outline-width: 5px;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoomed" style="outline-width: 10px;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoomed" style="outline-width: 10px;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/perspective-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/perspective-ref.html
new file mode 100644
index 00000000000..8e807989602
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/perspective-ref.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ padding: 10px;
+ width: 100px;
+ height: 100px;
+ background: red;
+ transform: rotateY(60deg);
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="perspective: 100px;">
+ <div class="box"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="perspective: 100px;">
+ <div class="box"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="perspective: 100px;">
+ <div class="box"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="perspective: 100px;">
+ <div class="box"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/row-gap-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/row-gap-ref.html
new file mode 100644
index 00000000000..335027f8b26
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/row-gap-ref.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: 1px solid black;
+ padding: 10px;
+ row-gap: 20px;
+}
+.container {
+ display: flex;
+ flex-wrap: wrap;
+ width: 150px;
+}
+.container-zoom {
+ display: flex;
+ flex-wrap: wrap;
+ width: 300px;
+}
+.container > div {
+ background-color: black;
+ flex: 1 1 auto;
+ width: 100px;
+ height: 20px;
+}
+.container-zoom > div {
+ background-color: black;
+ flex: 1 1 auto;
+ width: 200px;
+ height: 40px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="row-gap: 20px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="row-gap: 20px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="row-gap: 40px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="row-gap: 40px;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-margin-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-margin-ref.html
new file mode 100644
index 00000000000..d061c49165a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-margin-ref.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ display: inline-block;
+ border: solid black 1px;
+ padding: 10px;
+}
+
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ overflow-x: hidden;
+ overflow-y: scroll;
+ padding: 40px 0;
+ margin: auto;
+ scroll-snap-type: y mandatory;
+}
+
+.buffer {
+ scroll-snap-align: start;
+ background-color: lightblue;
+ height: 300px;
+ width: 200px;
+}
+
+.target {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 10px;
+ width: 200px;
+}
+.target-zoomed {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 20px;
+ width: 400px;
+}
+</style>
+</head>
+<body>
+<p>The black bars should line up in each group</p>
+<div class="group">
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: 20px;"></div>
+ <div class="buffer"></div>
+ </div>
+
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: 20px;"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+<div class="group">
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target-zoomed" style="scroll-margin-top: 40px;"></div>
+ <div class="buffer"></div>
+ </div>
+
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target-zoomed" style="scroll-margin-top: 40px;"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+<script>
+ for (match of document.querySelectorAll(".target, .target-zoomed")) {
+ match.scrollIntoView();
+ }
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-padding-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-padding-ref.html
new file mode 100644
index 00000000000..51a0ffb2ed1
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/scroll-padding-ref.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ border: solid black 1px;
+ overflow-x: hidden;
+ overflow-y: hidden;
+ scroll-snap-type: y mandatory;
+}
+
+#container-zoomed {
+ display: inline-block;
+ width: 400px;
+ height: 200px;
+ border: solid black 2px;
+ overflow-x: hidden;
+ overflow-y: hidden;
+ scroll-snap-type: y mandatory;
+}
+
+.buffer {
+ scroll-snap-align: start;
+ background-color: lightblue;
+ height: 1000px;
+ width: 200px;
+}
+
+.buffer-zoomed {
+ scroll-snap-align: start;
+ background-color: lightblue;
+ height: 2000px;
+ width: 400px;
+}
+
+.target {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 20px;
+ width: 200px;
+}
+
+.target-zoomed {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 40px;
+ width: 400px;
+}
+</style>
+</head>
+<body>
+
+<div id="container" style="scroll-padding-top: 20px;">
+ <div class="buffer"></div>
+ <div class="target" id="target1"></div>
+ <div class="buffer"></div>
+</div>
+
+<div id="container" style="scroll-padding-top: 20px;">
+ <div class="buffer"></div>
+ <div class="target" id="target3"></div>
+ <div class="buffer"></div>
+</div>
+
+<div id="container-zoomed" style="scroll-padding-top: 40px;">
+ <div class="buffer-zoomed"></div>
+ <div class="target-zoomed" id="target2"></div>
+ <div class="buffer-zoomed"></div>
+</div>
+
+<div id="container-zoomed" style="scroll-padding-top: 40px;">
+ <div class="buffer-zoomed"></div>
+ <div class="target-zoomed" id="target4"></div>
+ <div class="buffer-zoomed"></div>
+</div>
+
+<script>
+ for (match of document.querySelectorAll(".target, .target-zoomed")) {
+ match.scrollIntoView();
+ }
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-inset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-inset-ref.html
new file mode 100644
index 00000000000..19f1c01744b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-inset-ref.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.inset {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="inset" style="shape-outside: inset(40px 60px 40px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="inset" style="shape-outside: inset(40px 60px 40px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="inset" style="shape-outside: inset(40px 60px 40px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="inset" style="shape-outside: inset(40px 60px 40px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-polygon-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-polygon-ref.html
new file mode 100644
index 00000000000..52aaf23fcc0
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-polygon-ref.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.polygon {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="polygon" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="polygon" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="polygon" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="polygon" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-rect-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-rect-ref.html
new file mode 100644
index 00000000000..3f034ab5c26
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-rect-ref.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.rect {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="rect" style="shape-outside: rect(40px 140px 160px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="rect" style="shape-outside: rect(40px 140px 160px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="rect" style="shape-outside: rect(40px 140px 160px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="rect" style="shape-outside: rect(40px 140px 160px 0 round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-xywh-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-xywh-ref.html
new file mode 100644
index 00000000000..2064452a087
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-xywh-ref.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.xywh {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="xywh" style="shape-outside: xywh(0 40px 140px 120px round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="xywh" style="shape-outside: xywh(0 40px 140px 120px round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="xywh" style="shape-outside: xywh(0 40px 140px 120px round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="xywh" style="shape-outside: xywh(0 40px 140px 120px round 60px);"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/tab-size-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/tab-size-ref.html
new file mode 100644
index 00000000000..7bd5c7a073b
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/tab-size-ref.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ tab-size: 40px;
+ border: solid black 1px;
+}
+.container {
+ display: inline-block;
+ font-size: 16px;
+}
+.container-zoom {
+ display: inline-block;
+ font-size: 32px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <pre class="container" style="tab-size: 40px;"> hello</pre>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <pre class="container" style="tab-size: 40px;"> hello</pre>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <pre class="container-zoom" style="tab-size: 80px;"> hello</pre>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <pre class="container-zoom" style="tab-size: 80px;"> hello</pre>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-decoration-thickness-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-decoration-thickness-ref.html
new file mode 100644
index 00000000000..64a03fdf824
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-decoration-thickness-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-decoration-thickness when specified and inherited</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ text-decoration: underline blue;
+ text-decoration-thickness: calc(5px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div>unzoomed</div>
+<div class="zoom">zoomed</div>
+<div class="zoom">zoomed inherited</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-indent-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-indent-ref.html
new file mode 100644
index 00000000000..7ec1f57c7b4
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-indent-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-indent when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ text-indent: calc(1rem * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div>unzoomed</div>
+<div class="zoom">zoomed</div></div>
+<div class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-shadow-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-shadow-ref.html
new file mode 100644
index 00000000000..8341822f610
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-shadow-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-shadow when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ text-shadow: calc(5px * var(--scale)) calc(5px * var(--scale)) hotpink;
+}
+.zoom {
+ --scale: 2;
+}
+
+</style>
+<div>unzoomed</div>
+<div class="zoom">zoomed</div>
+<div class="zoom">zoomed inherited</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-stroke-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-stroke-width-ref.html
new file mode 100644
index 00000000000..1fb1b9c0886
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-stroke-width-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to -webkit-text-stroke-width when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+div {
+ font-size: calc(3rem * var(--scale));
+ -webkit-text-stroke-width: calc(2px * var(--scale));
+ color: cornflowerblue;
+ -webkit-text-stroke-color: hotpink;
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div>unzoomed</div>
+<div class="zoom">zoomed</div>
+<div class="zoom">zoomed inherited</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-underline-offset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-underline-offset-ref.html
new file mode 100644
index 00000000000..a60d46a6e92
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/text-underline-offset-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-underline-offset when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+body {
+ --scale: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ text-decoration: underline hotpink;
+ text-underline-offset: calc(5px * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div>unzoomed</div>
+<div class="zoom">zoomed</div>
+<div class="zoom">zoomed inherited</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-2d-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-2d-ref.html
new file mode 100644
index 00000000000..7bccfa5ca6a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-2d-ref.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix(1, 0, 0, 1, 20, 40);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container">
+ <div class="box" style="transform: matrix(1, 0, 0, 1, 20, 40);"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix(1, 0, 0, 1, 30, 60);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix(1, 0, 0, 1, 30, 60);"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-3d-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-3d-ref.html
new file mode 100644
index 00000000000..a067d32a646
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-3d-ref.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 20, 40, 0, 1);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container">
+ <div class="box" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 20, 40, 0, 1);"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 30, 60, 0, 1);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 30, 60, 0, 1);"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-perspective-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-perspective-ref.html
new file mode 100644
index 00000000000..ffebedf36ac
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-perspective-ref.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.box {
+ padding: 10px;
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each box below should match the corresponding box in references/transform-perspective-ref.html</p>
+<div class="outer">
+ <div class="container">
+ <div class="box" style="transform: perspective(100px) rotateY(60deg);"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer" >
+ <div class="container" style="transform: perspective(100px) rotateY(60deg);">
+ <div class="box" style="transform: perspective(100px) rotateY(60deg);"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer">
+ <div class="container">
+ <div class="box" style="transform: perspective(100px) rotateY(60deg);"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer">
+ <div class="container" style="transform: perspective(50px) rotateY(60deg);">
+ <div class="box" style="transform: perspective(100px) rotateY(60deg);"></div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-translate-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-translate-ref.html
new file mode 100644
index 00000000000..af707483e41
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/transform-translate-ref.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: translate(20px, 40px);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container">
+ <div class="box" style="transform: translate(20px, 40px);"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: translate(30px, 60px);"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: translate(30px, 60px);"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/translate-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/translate-ref.html
new file mode 100644
index 00000000000..56c5cf7a2fa
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/translate-ref.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="translate: 20px 40px;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container">
+ <div class="box" style="translate: 20px 40px;"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="translate: 30px 60px;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="translate: 30px 60px;"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/vertical-align-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/vertical-align-ref.html
new file mode 100644
index 00000000000..bde4853cf32
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/vertical-align-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ vertical-align: 20px;
+ display: inline-block;
+}
+.container {
+ width: 20px;
+ height: 20px;
+}
+.container-zoom {
+ width: 40px;
+ height: 40px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <img class="container" src="../../../../images/green.png" style="vertical-align: 20px;">
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <img class="container" src="../../../../images/green.png" style="vertical-align: 20px;">
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <img class="container-zoom" src="../../../../images/green.png" style="vertical-align: 40px;">
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <img class="container-zoom" src="../../../../images/green.png" style="vertical-align: 40px;">
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/view-timeline-inset-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/view-timeline-inset-ref.html
new file mode 100644
index 00000000000..c546ad5784e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/view-timeline-inset-ref.html
@@ -0,0 +1,123 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.group {
+ outline: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+ position: relative;
+ top: 250px;
+}
+.spacer {
+ height: 500px;
+}
+.scroller {
+ outline: 1px solid black;
+ display: inline-block;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: auto;
+ width: 200px;
+ height: 200px;
+}
+
+.indicator {
+ display: block;
+ position: fixed;
+ width: 100px;
+ height: 100px;
+ top: 100px;
+ margin: 0;
+ padding: 0;
+ background-color: green
+}
+#indicator1 {
+ left: 100px;
+}
+
+#indicator2 {
+ left: 300px;
+}
+
+#indicator3 {
+ left: 500px;
+}
+
+#indicator4 {
+ left: 700px;
+}
+
+.target {
+ height: 100px;
+ width: 100px;
+ background-color: black;
+}
+</style>
+</head>
+<body>
+<p>There should be 4 green boxes below.</p>
+<div class="group">
+ <div class="scroller" id="scroller1">
+ <div class="spacer"></div>
+ <div class="target" id="target1">
+ <div class="indicator" id="indicator1"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller" id="scroller2">
+ <div class="spacer"></div>
+ <div class="target" id="target2">
+ <div class="indicator" id="indicator2"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div class="scroller" id="scroller3">
+ <div class="spacer"></div>
+ <div class="target" id="target3">
+ <div class="indicator" id="indicator3"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller" id="scroller4">
+ <div class="spacer"></div>
+ <div class="target" id="target4">
+ <div class="indicator" id="indicator4"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+</div>
+<script>
+ window.addEventListener('load', function() {
+ const target1 = document.getElementById('target1');
+ const target2 = document.getElementById('target2');
+ const target3 = document.getElementById('target3');
+ const target4 = document.getElementById('target4');
+
+ const scroller1 = document.getElementById('scroller1');
+ const scroller2 = document.getElementById('scroller2');
+ const scroller3 = document.getElementById('scroller3');
+ const scroller4 = document.getElementById('scroller4');
+
+ const maxScroll1 = scroller1.scrollHeight - scroller1.clientHeight;
+ scroller1.scrollTop = (maxScroll1 - 250) * 0.5;
+
+ const maxScroll2 = scroller2.scrollHeight - scroller2.clientHeight;
+ scroller2.scrollTop = (maxScroll2 - 250) * 0.5;
+
+ const maxScroll3 = scroller3.scrollHeight - scroller3.clientHeight;
+ scroller3.scrollTop = (maxScroll3 - 250) * 0.5;
+
+ const maxScroll4 = scroller4.scrollHeight - scroller4.clientHeight;
+ scroller4.scrollTop = (maxScroll4 - 250) * 0.5;
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/word-spacing-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/word-spacing-ref.html
new file mode 100644
index 00000000000..f2f59c36dec
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/reference/word-spacing-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to word-spacing when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+
+<style>
+html {
+ --scale: 1;
+}
+div {
+ font-size: calc(1rem * var(--scale));
+ word-spacing: calc(2rem * var(--scale));
+}
+.zoom {
+ --scale: 2;
+}
+</style>
+
+<div class="spacing">
+ <div>unzoomed lorem ipsum</div>
+</div>
+
+<div class="spacing zoom">
+ <div>zoomed lorem ipsum</div>
+</div>
+
+<div class="spacing zoom">
+ <div>zoomed inherited lorem ipsum</div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size-ref.html
new file mode 100644
index 00000000000..104634a44eb
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size-ref.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Zoom: foreignObject font-size reference</title>
+<style>
+ :root {
+ zoom: 4;
+ font-size: 16px;
+ }
+</style>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/zoom-precision-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/zoom-precision-ref.html
new file mode 100644
index 00000000000..b24d903e5ba
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-viewport/zoom/zoom-precision-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+ .s {
+ display: inline-block;
+ background: green;
+ width: 161.5px;
+ height: 85px;
+ }
+
+ .t {
+ font-size: 0;
+ width: 484.5px;
+ background: red;
+ }
+</style>
+<div class="t">
+ <div class="s"></div>
+ <div class="s"></div>
+ <div class="s"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/images/green.png b/Tests/LibWeb/Ref/expected/wpt-import/images/green.png
new file mode 100644
index 00000000000..28a1faab377
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/images/green.png differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/images/pattern.png b/Tests/LibWeb/Ref/expected/wpt-import/images/pattern.png
new file mode 100644
index 00000000000..65ce5b44a64
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/images/pattern.png differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/abspos-static-position.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/abspos-static-position.html
new file mode 100644
index 00000000000..1bf8c0fd70f
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/abspos-static-position.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/abspos-static-position-ref.html">
+<style>
+body {
+ margin: 0;
+ zoom: 2;
+}
+.parent {
+ margin-top: 50px;
+ margin-left: 25%;
+ height: 100px;
+ outline: 2px solid black;
+}
+
+.abspos {
+ position: absolute;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+</style>
+</head>
+<body>
+<div class="parent">
+ <div class="abspos"></div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/animation-range.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/animation-range.html
new file mode 100644
index 00000000000..486471f39c5
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/animation-range.html
@@ -0,0 +1,155 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<title>CSS Zoom applies to animation-range-start/animation-range-end</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/animation-range-ref.html">
+<script src="../../../web-animations/testcommon.js"></script>
+<script src="../../../common/reftest-wait.js"></script>
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.spacer {
+ height: 1000px;
+}
+.scroller {
+ display: inline-block;
+ outline: 1px solid black;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: scroll;
+ width: 200px;
+ height: 200px;
+ scroll-timeline: --t1;
+ animation-range: 200px 900px;
+}
+
+.scroller-zoomed {
+ display: inline-block;
+ outline: 1px solid black;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: scroll;
+ width: 200px;
+ height: 200px;
+ scroll-timeline: --t1;
+ animation-range: 100px 450px;
+}
+
+@keyframes grow {
+ to { width: 200px }
+}
+
+@keyframes grow-zoomed {
+ to { width: 100px }
+}
+
+.target {
+ position: fixed;
+ height: 100px;
+ width: 0px;
+ background-color: black;
+}
+.target-zoomed {
+ position: fixed;
+ height: 50px;
+ width: 0px;
+ background-color: black;
+}
+
+.anim-1 {
+ animation: auto grow linear;
+ animation-timeline: --t1;
+ animation-range: 200px 900px;
+}
+.anim-2 {
+ animation: auto grow linear;
+ animation-timeline: --t1;
+ animation-range: inherit;
+}
+.anim-3 {
+ animation: auto grow-zoomed linear;
+ animation-timeline: --t1;
+ animation-range: 100px 450px;
+}
+.anim-4 {
+ animation: auto grow-zoomed linear;
+ animation-timeline: --t1;
+ animation-range: inherit;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="scroller" id="scroller1">
+ <div class="target" id="target1" style="zoom: 1"></div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller" id="scroller2">
+ <div class="target" id="target2" style="zoom: 1"></div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div class="scroller-zoomed" id="scroller3">
+ <div class="target-zoomed" id="target3" style="zoom: 2"></div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller-zoomed" id="scroller4">
+ <div class="target-zoomed" id="target4" style="zoom: 2"></div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<script>
+ const target1 = document.getElementById('target1');
+ const target2 = document.getElementById('target2');
+ const target3 = document.getElementById('target3');
+ const target4 = document.getElementById('target4');
+
+ const scroller1 = document.getElementById('scroller1');
+ const scroller2 = document.getElementById('scroller2');
+ const scroller3 = document.getElementById('scroller3');
+ const scroller4 = document.getElementById('scroller4');
+
+ target1.classList.add("anim-1");
+ const animation1 = target1.getAnimations()[0];
+
+ target2.classList.add("anim-2");
+ const animation2 = target2.getAnimations()[0];
+
+ target3.classList.add("anim-3");
+ const animation3 = target3.getAnimations()[0];
+
+ target4.classList.add("anim-4");
+ const animation4 = target4.getAnimations()[0];
+
+ Promise.all([animation1.ready, animation2.ready, animation3.ready, animation4.ready]).then(() => {
+ const maxScroll1 = scroller1.scrollHeight - scroller1.clientHeight;
+ scroller1.scrollTop = (maxScroll1 + 300) * 0.5;
+
+ const maxScroll2 = scroller2.scrollHeight - scroller2.clientHeight;
+ scroller2.scrollTop = (maxScroll2 + 300) * 0.5;
+
+ const maxScroll3 = scroller3.scrollHeight - scroller3.clientHeight;
+ scroller3.scrollTop = (maxScroll3 + 300) * 0.5;
+
+ const maxScroll4 = scroller4.scrollHeight - scroller4.clientHeight;
+ scroller4.scrollTop = (maxScroll4 + 300) * 0.5;
+
+ waitForAnimationFrames(2).then(takeScreenshot);
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-image.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-image.html
new file mode 100644
index 00000000000..5edb27215da
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-image.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<title>Zoom affects background-image intrinsic sizes</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/background-image-ref.html">
+<style>
+div {
+ width: 20px;
+ height: 20px;
+ zoom: 0.5;
+ background-image: url("../../../images/pattern.png"); /* 20x20 */
+}
+</style>
+<div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-size.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-size.html
new file mode 100644
index 00000000000..202219c9656
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/background-size.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to background-size</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/background-size-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ background-size: 50px;
+ display: inline-block;
+}
+.container {
+ background-image: url("../../../images/pattern.png");
+ width: 40px;
+ height: 40px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="background-size: 50px; zoom: 1;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="background-size: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="background-size: 50px; zoom: 2;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="background-size: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/basic.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/basic.html
new file mode 100644
index 00000000000..728c089c805
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/basic.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>zoom property: basic test</title>
+<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/basic-ref.html">
+<style>
+div {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+</style>
+<div></div>
+<div style="zoom: 2"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-outset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-outset.html
new file mode 100644
index 00000000000..ba05da1148c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-outset.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to border-image-outset</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/border-image-outset-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border-image-outset: 5px;
+ display: inline-block;
+ padding: 10px;
+}
+.container {
+ border: 10px solid red;
+ border-image: url("../../../images/green.png") 2;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="border-image-outset: 5px; zoom: 1;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="border-image-outset: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="border-image-outset: 5px; zoom: 2;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="border-image-outset: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-width.html
new file mode 100644
index 00000000000..37a6794f5f0
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-image-width.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-image-width when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/border-image-width-ref.html">
+<style>
+.box {
+ width: 60px;
+ height: 60px;
+ border-image: url("data:image/svg+xml,%3csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100' height='100' fill='red'/%3e%3c/svg%3e") 30;
+ border-image-width: 8px;
+ margin: 10px;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="box"></div>
+
+<div class="zoom">
+ <div class="box"></div>
+</div>
+
+<div class="zoom box"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-radius.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-radius.html
new file mode 100644
index 00000000000..e1ad10bd320
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-radius.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to border-radius</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/border-radius-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 10px;
+ margin: 10px;
+ width: max-content;
+}
+
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ border: solid black 1px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching border radii.</p>
+<div class="group">
+ <div id="container" style="border-radius: 20px; zoom: 1;">
+ </div>
+ <div style="display: inline-block; border-radius: 20px;">
+ <div id="container" style="border-radius: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div id="container" style="border-radius: 20px; zoom: 2;">
+ </div>
+ <div style="display: inline-block; border-radius: 20px;">
+ <div id="container" style="border-radius: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing-without-border.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing-without-border.html
new file mode 100644
index 00000000000..16c19d0bd2b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing-without-border.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-spacing when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-without-border-ref.html">
+
+<style>
+.table {
+ display: table;
+}
+.row {
+ display: table-row;
+}
+.cell {
+ display: table-cell;
+}
+.spacing {
+ border-collapse: separate;
+ border-spacing: 17px 11px;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="table spacing">
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+</div>
+
+<div class="zoom spacing">
+ <div class="table">
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ </div>
+</div>
+
+<div class="spacing">
+ <div class="table zoom">
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing.html
new file mode 100644
index 00000000000..0fbac6b451c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-spacing.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-spacing when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/border-spacing-ref.html">
+
+<style>
+.table {
+ display: table;
+}
+.row {
+ display: table-row;
+}
+.cell {
+ display: table-cell;
+ border: 0.5rem solid hotpink;
+}
+.spacing {
+ border-collapse: separate;
+ border-spacing: 17px 11px;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="table spacing">
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">unzoomed</div>
+ <div class="cell">unzoomed</div>
+ </div>
+</div>
+
+<div class="zoom spacing">
+ <div class="table">
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed</div>
+ <div class="cell">zoomed</div>
+ </div>
+ </div>
+</div>
+
+<div class="spacing">
+ <div class="table zoom">
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ <div class="row">
+ <div class="cell">zoomed inherited</div>
+ <div class="cell">zoomed inherited</div>
+ </div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width-keywords.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width-keywords.html
new file mode 100644
index 00000000000..6f68e341fed
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width-keywords.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>CSS zoom applies to border-width keywords</title>
+ <link rel="help" href="https://drafts.csswg.org/css-viewport/">
+ <link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/border-width-keywords-ref.html">
+
+ <style>
+ .initial {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ border-color: blue;
+ border-style: solid;
+ border-top-width: initial;
+ border-right-width: initial;
+ border-bottom-width: initial;
+ border-left-width: initial;
+ zoom: 2;
+ }
+
+ .thin {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ border: thin solid blue;
+ zoom: 2;
+ }
+
+ .medium {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ border: medium solid blue;
+ zoom: 2;
+ }
+
+ .thick {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ border: thick solid blue;
+ zoom: 2;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial"></div>
+ <div class="thin"></div>
+ <div class="medium"></div>
+ <div class="thick"></div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width.html
new file mode 100644
index 00000000000..0bae37dba37
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/border-width.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to border-width when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/border-width-ref.html">
+<style>
+.box {
+ width: 60px;
+ height: 60px;
+ border: 8px solid red;
+ margin: 10px;
+ display: inline-block;
+}
+.box-rem {
+ width: 60px;
+ height: 60px;
+ border: 0.5rem solid blue;
+ margin: 10px;
+ display: inline-block;
+}
+.zoom {
+ zoom: 2;
+}
+.box-left {
+ border-left-style: solid;
+ display: inline-block;
+}
+.box-left-medium {
+ border-left-width: medium;
+}
+</style>
+
+<div class="box">unzoomed px</div>
+<div class="box-rem">unzoomed rem</div>
+
+<div class="zoom">
+ <div class="box">zoomed px</div>
+</div>
+
+<div class="zoom box">zoomed inherited px</div>
+<div class="zoom box-rem">zoomed inherited rem</div>
+
+<div>
+ <div class="zoom box-left box-left-medium">zoomed px</div>
+ <div class="zoom box-left">zoomed px</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow-inset-spread.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow-inset-spread.html
new file mode 100644
index 00000000000..b8d399dbf6b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow-inset-spread.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Inset box-shadow 1px spread stays even under fractional zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-backgrounds/#box-shadow">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-inset-spread-ref.html">
+<style>
+ body { margin: 0; }
+ .zoom { zoom: 1.2; }
+ .box {
+ margin: 8px;
+ width: 100px; height: 60px;
+ box-shadow: inset 0 0 0 1px green;
+ background: white;
+ }
+</style>
+<div class="zoom"><div class="box"></div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow.html
new file mode 100644
index 00000000000..87fe2331fae
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/box-shadow.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to box-shadow when specified and inherited</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/box-shadow-ref.html">
+
+<style>
+
+.shadow {
+ box-shadow: 5px 5px 2px black;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="shadow">unzoomed</div>
+<div class="zoom"><div class="shadow">zoomed</div></div>
+<div class="shadow"><div class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/canvas.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/canvas.html
new file mode 100644
index 00000000000..ef39fcab3cf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/canvas.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1909625">
+<link rel="help" href="https://html.spec.whatwg.org/#dom-context-2d-font">
+<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/canvas-ref.html">
+<title>zoom is ignored for canvas</title>
+<style>
+canvas {
+ zoom: 2;
+}
+</style>
+<script>
+document.addEventListener("DOMContentLoaded", () => {
+ const ctx = document.getElementById("canvas").getContext("2d");
+ ctx.font = "48px serif";
+ ctx.fillText(ctx.font, 10, 50);
+});
+</script>
+<canvas id="canvas" width="300" height="100"></canvas>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-gap.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-gap.html
new file mode 100644
index 00000000000..73ae18bc221
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-gap.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to column-gap</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/column-gap-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: block;
+ border: 1px solid black;
+ padding: 10px;
+ column-gap: 20px;
+}
+.container {
+ display: flex;
+ flex-direction: row;
+ column-gap: 24px;
+ width: 100px;
+}
+.container > div {
+ background-color: black;
+ width: 40px;
+ height: 10px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-gap: 20px; zoom: 1;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-gap: inherit; zoom: 1;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-gap: 20px; zoom: 2;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-gap: inherit; zoom: 2;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width-keywords.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width-keywords.html
new file mode 100644
index 00000000000..e5d60a1080c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width-keywords.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>CSS zoom applies to column-rule-width keywords</title>
+ <link rel="help" href="https://drafts.csswg.org/css-viewport/">
+ <link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-keywords-ref.html">
+ <style>
+ .initial {
+ width: 100px;
+ height: 50px;
+ margin-bottom: 10px;
+ column-count: 2;
+ column-gap: 20px;
+ column-rule-color: blue;
+ column-rule-style: solid;
+ column-rule-width: initial;
+ zoom: 2;
+ }
+
+ .thin {
+ width: 100px;
+ height: 50px;
+ margin-bottom: 10px;
+ column-count: 2;
+ column-gap: 20px;
+ column-rule: thin solid blue;
+ zoom: 2;
+ }
+
+ .medium {
+ width: 100px;
+ height: 50px;
+ margin-bottom: 10px;
+ column-count: 2;
+ column-gap: 20px;
+ column-rule: medium solid blue;
+ zoom: 2;
+ }
+
+ .thick {
+ width: 100px;
+ height: 50px;
+ margin-bottom: 10px;
+ column-count: 2;
+ column-gap: 20px;
+ column-rule: thick solid blue;
+ zoom: 2;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial">Text content here to fill columns</div>
+ <div class="thin">Text content here to fill columns</div>
+ <div class="medium">Text content here to fill columns</div>
+ <div class="thick">Text content here to fill columns</div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width.html
new file mode 100644
index 00000000000..1c8d69ab0fc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-rule-width.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to column-rule-width</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/column-rule-width-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ column-rule-style: solid;
+ column-rule-width: 5px;
+ column-rule-color: transparent;
+ border: solid black 1px;
+}
+.container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ font-size: 16px;
+ column-count: 2;
+ column-rule-style: solid;
+ overflow: clip;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-rule-width: 5px; zoom: 1;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-rule-width: inherit; zoom: 1;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-rule-width: 5px; zoom: 2;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-rule-width: inherit; zoom: 2;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-width.html
new file mode 100644
index 00000000000..964d32cb457
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/column-width.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to column-width</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/column-width-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: block;
+ border: 1px solid black;
+ padding: 10px;
+ column-width: 100px;
+}
+.container {
+ height: 200px;
+ width: 300px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-width: 100px; zoom: 1; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-width: inherit; zoom: 1; font-size: 16px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="column-width: 100px; zoom: 2; font-size: 8px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="column-width: inherit; zoom: 2; font-size: 8px;">
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-height.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-height.html
new file mode 100644
index 00000000000..d8d367becf3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-height.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
+<style>
+html {
+ font-size: 1px;
+}
+p {
+ font-size: initial;
+}
+.containment {
+ zoom: 10;
+ width: 10px;
+ contain-intrinsic-height: 10rem;
+ contain: size;
+ background-color: green;
+}
+</style>
+</head>
+<body>
+ <p>Test passes if there is a filled green square.</p>
+ <div class="containment">
+ <div style="width: 10px; height: 10px;"></div>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-width.html
new file mode 100644
index 00000000000..d2ed87c8085
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/contain-intrinsic-width.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import//css/reference/ref-filled-green-100px-square-only.html">
+<style>
+html {
+ font-size: 1px;
+}
+p {
+ font-size: initial;
+}
+.containment {
+ zoom: 10;
+ width: min-content;
+ contain-intrinsic-width: 10rem;
+ contain: inline-size;
+ background-color: green;
+}
+</style>
+</head>
+<body>
+ <p>Test passes if there is a filled green square.</p>
+ <div class="containment">
+ <div style="width: 10px; height: 10px;"></div>
+ </div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/custom-property.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/custom-property.html
new file mode 100644
index 00000000000..9bf51805ed4
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/custom-property.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to custom properties</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/custom-property-ref.html">
+<style>
+@property --test {
+ syntax: "<length-percentage>";
+ inherits: false;
+ initial-value: 0px;
+}
+
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ --test: 100px;
+ display: inline-block;
+}
+.container {
+ background-color: black;
+ height: 20px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="--test: 100px; width: var(--test); zoom: 1;"></div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="--test: inherit; width: var(--test); zoom: 1;"></div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="--test: 100px; width: var(--test); zoom: 2;"></div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="--test: inherit; width: var(--test); zoom: 2;"></div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius.html
new file mode 100644
index 00000000000..d1a2b9fb49d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<title>border-radius:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius-ref.html>
+<style>
+ .zoomed {
+ background: coral;
+ width: 100px;
+ height: 100px;
+ border: 5px solid black;
+ border-radius: inherit;
+ zoom: 2;
+ }
+</style>
+<div style="border-radius:20px; display:contents">
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border.html
new file mode 100644
index 00000000000..d25d25dc18b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/border.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<title>border:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../border-ref.html">
+<style>
+ body > div {
+ border: 1px solid black;
+ }
+ body > div > div {
+ zoom: 10;
+ width: 10px;
+ height: 10px;
+ border: 0px solid black;
+ border-width: inherit;
+ background: green;
+ }
+</style>
+<div>
+ <div></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/bottom.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/bottom.html
new file mode 100644
index 00000000000..b0eb2f7ac18
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/bottom.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>bottom:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ width: 50px;
+ height: 50px;
+ }
+</style>
+<div style="contain:layout; height:100px; bottom:50px; translate:0px 100px;">
+ <div style="zoom:2; position:absolute; bottom:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/column.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/column.html
new file mode 100644
index 00000000000..b0e16fcd888
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/column.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<title>column-*:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-multicol/>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/column-ref.html>
+<style>
+ .zoomed {
+ background: skyblue;
+ font-size: 16px;
+ width: 300px;
+ height: 200px;
+ column-width: inherit;
+ column-height: inherit;
+ column-gap: inherit;
+ column-rule-color: black;
+ column-rule-style: solid;
+ column-rule-width: inherit;
+ column-fill: auto;
+ zoom: 2;
+ }
+ .inner {
+ background: coral;
+ }
+</style>
+<div style="column-width:40px; column-height:150px; column-gap:10px; column-rule: 5px solid; display:contents">
+ <div class=zoomed>
+ <div class=inner>1</div>
+ <div class=inner>2</div>
+ <div class=inner>3</div>
+ <div class=inner>4</div>
+ <div class=inner>5</div>
+ <div class=inner>6</div>
+ <div class=inner>7</div>
+ <div class=inner>8</div>
+ <div class=inner>9</div>
+ <div class=inner>10</div>
+ <div class=inner>11</div>
+ <div class=inner>12</div>
+ <div class=inner>13</div>
+ <div class=inner>14</div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis.html
new file mode 100644
index 00000000000..b639c4bebf9
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>flex-basis:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-flexbox/>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis-ref.html>
+<style>
+ .container {
+ display: flex;
+ background: skyblue;
+ flex-basis: 50px; /* For explicit inheritance. */
+ }
+ .zoomed {
+ background: coral;
+ zoom: 2;
+ flex-basis: inherit;
+ height: 100px;
+ }
+</style>
+<div class=container>
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/height.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/height.html
new file mode 100644
index 00000000000..762d9fed806
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/height.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>height:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ }
+</style>
+<div style="height:50px">
+ <div style="zoom:2; width:50px; height:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/left.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/left.html
new file mode 100644
index 00000000000..2af8468186a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/left.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>left:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ width: 50px;
+ height: 50px;
+ }
+</style>
+<div style="contain:layout; left:50px; translate:-100px">
+ <div style="zoom:2; position:absolute; left:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/margin.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/margin.html
new file mode 100644
index 00000000000..338f759277b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/margin.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<title>margin:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/margin-ref.html>
+<style>
+ .zoomed {
+ background: coral;
+ width: 50px;
+ height: 50px;
+ zoom: 2;
+ margin: inherit;
+ }
+</style>
+<div style="margin:10px; display:contents">
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-height.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-height.html
new file mode 100644
index 00000000000..463e498504c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-height.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>max-height:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ }
+</style>
+<div style="max-height:50px">
+ <div style="zoom:2; width:50px; height:200px; max-height:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-width.html
new file mode 100644
index 00000000000..9fc4e5990b8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/max-width.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>max-width:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ }
+</style>
+<div style="max-width:50px">
+ <div style="zoom:2; max-width:inherit; height:50px; width:300px;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-height.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-height.html
new file mode 100644
index 00000000000..8d3cf69c44b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-height.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>min-height:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ }
+</style>
+<div style="min-height:50px">
+ <div style="zoom:2; width:50px; min-height:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-width.html
new file mode 100644
index 00000000000..17f7e2f07ba
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/min-width.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<title>min-width:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ }
+</style>
+<div style="min-width:50px">
+ <div style="zoom:2; min-width:inherit; height:50px; width:0px"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/outline.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/outline.html
new file mode 100644
index 00000000000..4092ad7aaea
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/outline.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<title>outline:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/outline-ref.html>
+<style>
+ .zoomed {
+ background: coral;
+ width: 50px;
+ height: 50px;
+ margin: 50px;
+ outline-width: inherit;
+ outline-offset: inherit;
+ outline-style: solid;
+ outline-color: black;
+ zoom: 2;
+ }
+</style>
+<div style="outline-width:10px; outline-offset:5px; display:contents">
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/padding.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/padding.html
new file mode 100644
index 00000000000..e3e2619184d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/padding.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>padding:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/padding-ref.html">
+<style>
+ .parent {
+ background: coral;
+ width: 50px;
+ height: 50px;
+ padding: inherit;
+ zoom: 2;
+ }
+ .inner {
+ background: green;
+ width: 100%;
+ height: 100%;
+ }
+</style>
+<div style="padding:10px; display:contents">
+ <div class=parent>
+ <div class=inner></div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/right.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/right.html
new file mode 100644
index 00000000000..c78d668b52a
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/right.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>right:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ width: 50px;
+ height: 50px;
+ }
+</style>
+<div style="contain:layout; width:100px; right:50px; translate:100px;">
+ <div style="zoom:2; position:absolute; right:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/top.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/top.html
new file mode 100644
index 00000000000..e7effb25970
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/top.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<title>top:inherit applies zoom</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/../green-square-100px.html">
+<style>
+ div > div {
+ background-color: green;
+ width: 50px;
+ height: 50px;
+ }
+</style>
+<div style="contain:layout; top:50px; translate:0 -100px">
+ <div style="zoom:2; position:absolute; top:inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-border-radius.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-border-radius.html
new file mode 100644
index 00000000000..15fd15ffe29
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-border-radius.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>-webkit-border-radius:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=help href=https://compat.spec.whatwg.org/#propdef--webkit-border-radius>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/border-radius-ref.html>
+<style>
+ .zoomed {
+ background: coral;
+ width: 100px;
+ height: 100px;
+ border: 5px solid black;
+ -webkit-border-radius: inherit;
+ zoom: 2;
+ }
+</style>
+<div style="-webkit-border-radius:20px; display:contents">
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-flex-basis.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-flex-basis.html
new file mode 100644
index 00000000000..e5bd43f3e55
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/webkit-flex-basis.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<title>-webkit-flex-basis:inherit applies zoom</title>
+<link rel=help href=https://drafts.csswg.org/css-flexbox/>
+<link rel=help href=https://drafts.csswg.org/css-viewport/>
+<link rel=help href=https://compat.spec.whatwg.org/#propdef--webkit-flex-basis>
+<link rel=match href=../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/flex-basis-ref.html>
+<style>
+ .container {
+ display: flex;
+ background: skyblue;
+ -webkit-flex-basis: 50px; /* For explicit inheritance. */
+ }
+ .zoomed {
+ background: coral;
+ -webkit-flex-basis: inherit;
+ height: 100px;
+ zoom: 2;
+ }
+</style>
+<div class=container>
+ <div class=zoomed></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/width.html
new file mode 100644
index 00000000000..8eb8a63dc11
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/explicit-inherit/width.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to width when specified and inherited</title>
+<link rel="author" title="Chris Harrelson" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../../expected/wpt-import/css/css-viewport/zoom/explicit-inherit/width-ref.html">
+<style>
+ #parent {
+ width: 100px;
+ background: red;
+ }
+ #child-zoomed {
+ zoom: 2;
+ width: inherit;
+ background: lime;
+ height: 100px;
+ }
+ #child {
+ width: 200px;
+ height: 200px;
+ background: green;
+ }
+</style>
+<p>You should see two squares below. One lime, and one green.</p>
+<div id="parent">
+ <div id="child-zoomed"></div>
+ <div id="child"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-blur.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-blur.html
new file mode 100644
index 00000000000..dc96352b2dd
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-blur.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to filter: blur()</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/filters-blur-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: 1px solid black;
+ filter: blur(1px);
+}
+.container {
+ padding: 10px;
+ width: 25px;
+ height: 50px;
+}
+.swatch {
+ width: 25px;
+ height: 25px;
+}
+.red {
+ background-color: red;
+}
+.blue {
+ background-color: blue;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="filter: blur(1px); zoom: 1;">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="filter: inherit; zoom: 1;">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="filter: blur(1px); zoom: 3;">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="filter: inherit; zoom: 3;">
+ <div class="swatch red"></div>
+ <div class="swatch blue"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-drop-shadow.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-drop-shadow.html
new file mode 100644
index 00000000000..b2e5ca628fc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/filters-drop-shadow.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to drop-shadow when specified and inherited</title>
+<link rel="author" title="Stephen White" href="mailto:[email protected]">
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#FilterProperty">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/filters-drop-shadow-ref.html">
+<meta name="fuzzy" content="maxDifference=0-20; totalPixels=0-862" />
+<meta name="assert" content="Check that clipping gets correctly applied on children of a container with a drop-shadow filter in effect."/>
+
+<style>
+.container {
+ filter: drop-shadow(5px 5px 5px black);
+ padding: 20px;
+}
+.circle-mask {
+ border-radius: 80px;
+ overflow: hidden;
+ width: 100px;
+ height: 100px;
+}
+.green-box {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+<div class="container">
+ <div class="circle-mask">
+ <div class="green-box">unzoomed</div>
+ </div>
+</div>
+<div class="container">
+ <div class="circle-mask zoom">
+ <div class="green-box">zoomed</div>
+ </div>
+</div>
+<div class="container zoom">
+ <div class="circle-mask">
+ <div class="green-box">zoomed inherited</div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size-keyword-specified.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size-keyword-specified.html
new file mode 100644
index 00000000000..d53bd98f8c5
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size-keyword-specified.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to font-size when specified by keywords</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/font-size-keyword-specified-ref.html">
+<div style="zoom: 2">
+ <div style="font-size: medium">This is some zoomed medium text</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size.html
new file mode 100644
index 00000000000..8b4eee0e5bf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/font-size.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to font-size when specified and inherited</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/font-size-ref.html">
+<div style="font-size: 12px">
+ 12px text
+</div>
+<hr>
+<div style="font-size: 12px; zoom: 2">
+ 12px zoomed text
+</div>
+<hr>
+<div style="font-size: 12px">
+ <div style="zoom:2">
+ 12px zoomed inherited text
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/grid.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/grid.html
new file mode 100644
index 00000000000..e8e59139c91
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/grid.html
@@ -0,0 +1,97 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to grid-template-columns/grid-template-rows</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/grid-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: solid black 1px;
+ grid-template-columns: 40px 1fr 20px;
+ grid-template-rows: 10px 30px 40px;
+}
+.container {
+ width: 100px;
+ height: 100px;
+ display: grid;
+ gap: 10px;
+}
+.item {
+ background: black;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="grid-template-columns: 40px 1fr 20px; grid-template-rows: 10px 30px 40px; zoom: 1;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="grid-template-columns: inherit; grid-template-rows: inherit; zoom: 1;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="grid-template-columns: 40px 1fr 20px; grid-template-rows: 10px 30px 40px; zoom: 2;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="grid-template-columns: inherit; grid-template-rows: inherit; zoom: 2;">
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ <div class="item"> </div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/image-intrinsic-size.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/image-intrinsic-size.html
new file mode 100644
index 00000000000..819033adc46
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/image-intrinsic-size.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Zoom affects image intrinsic sizes</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/background-image-ref.html">
+<style>
+img {
+ vertical-align: top;
+ zoom: .5;
+}
+</style>
+<img src="../../../images/pattern.png">
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited-length.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited-length.html
new file mode 100644
index 00000000000..dd075ee3a4b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited-length.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>zoom property: inherited length into zoom</title>
+<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/green-square-100px.html">
+<style>
+div {
+ background-color: green;
+}
+</style>
+<div style="width: 50px; height: 50px;">
+ <div style="zoom: 2; width: inherit; height: inherit;"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited.html
new file mode 100644
index 00000000000..ead5199e204
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/inherited.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Effective zoom value is inherited</title>
+<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/basic-ref.html">
+<style>
+.container {
+ zoom: 2;
+}
+.child {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+</style>
+<div class="child"></div>
+<div class="container">
+ <div class="child"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/letter-spacing.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/letter-spacing.html
new file mode 100644
index 00000000000..270e3a8e4f3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/letter-spacing.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to letter-spacing when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/letter-spacing-ref.html">
+<div style="letter-spacing: 2px; font-size: 12px">
+ 12px font text with 2px letter-spacing
+</div>
+
+<hr>
+
+<div style="letter-spacing: 2px; font-size: 12px; zoom: 2">
+ 12px font zoomed text with 2px letter-spacing
+</div>
+
+<hr>
+
+<div style="letter-spacing: 2px; font-size: 12px">
+ <div style="zoom:2">
+ 12px font zoomed inherited text with 2px letter-spacing
+ </div>
+</div>
+
+<hr>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/line-height.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/line-height.html
new file mode 100644
index 00000000000..d2a623c3a11
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/line-height.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to line-height when specified and inherited</title>
+<link rel="author" title="Chris Harrelson" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/line-height-ref.html">
+<div style="line-height: 12px; font-size: 12px">
+ Double-spaced<br>12px font text
+</div>
+
+<hr>
+
+<div style="line-height: 12px; font-size: 12px; zoom: 2">
+ Double-spaced<br>12px font zoomed text
+</div>
+
+<hr>
+
+<div style="line-height: 12px; font-size: 12px">
+ <div style="zoom:2">
+ Double-spaced<br>12px font zoomed inherited text
+ </div>
+</div>
+
+<hr>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/list-style-image.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/list-style-image.html
new file mode 100644
index 00000000000..30597e458da
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/list-style-image.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to list-style-image</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/list-style-image-ref.html">
+
+<style>
+.marker {
+ list-style-image: url('#marker');
+}
+ul {
+ margin-block-start: 1rem;
+ margin-block-end: 1rem;
+ margin-inline-start: 0px;
+ margin-inline-end: 0px;
+ padding-inline-start: 40px;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div>
+ <ul>
+ <li class="marker">unzoomed</li>
+ </ul>
+</div>
+
+<div>
+ <ul class="zoom">
+ <li class="marker">zoomed</li>
+ </ul>
+</div>
+
+<div class="marker">
+ <ul class="zoom">
+ <li>zoomed inherited</li>
+ </ul>
+</div>
+
+<svg viewBox="0 0 100 100" style="display:none">
+ <defs>
+ <g id="marker">
+ <circle cx="50%" cy="50%" r="50%" stroke="none" />
+ </g>
+ </defs>
+</svg>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/margin.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/margin.html
new file mode 100644
index 00000000000..c3de3f01800
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/margin.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<title>CSS Zoom applies to margins</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/margin-ref.html">
+<style>
+#reference-overlapped-red {
+ background-color: red;
+ width: 100px;
+ height: 100px;
+ z-index: -1;
+}
+#reference-overlapped-big-red {
+ background-color: red;
+ width: 200px;
+ height: 200px;
+ z-index: -1;
+}
+
+.container {
+ padding: 20px;
+}
+.margin-container {
+ width: 200px;
+ margin-left: -50px;
+}
+.margin-big-container {
+ width: 400px;
+ margin-left: -100px;
+}
+.green-box {
+ background-color: green;
+ width: 100px;
+ height: 100px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+ margin: auto;
+ margin-top: -100px;
+ justify-self: right;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="container">
+ <div id=reference-overlapped-red></div>
+
+ <div class="margin-container">
+ <div class="green-box">unzoomed</div>
+ </div>
+</div>
+
+<div class="container">
+ <div id=reference-overlapped-big-red></div>
+
+ <div class="margin-big-container">
+ <div class="green-box zoom">zoomed</div>
+ </div>
+</div>
+
+<div class="container zoom">
+ <div id=reference-overlapped-red></div>
+
+ <div class="margin-container">
+ <div class="green-box">zoomed inherited</div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-outset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-outset.html
new file mode 100644
index 00000000000..0e8f6e05331
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-outset.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to mask-border-outset</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/mask-border-outset-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ mask-border-outset: 5px;
+ display: inline-block;
+}
+.container {
+ mask-border-source: url("../../../images/green.png");
+ mask-border-slice: 20;
+ background-color: black;
+ width: 50px;
+ height: 50px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="mask-border-outset: 5px; zoom: 1;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="mask-border-outset: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="mask-border-outset: 5px; zoom: 2;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="mask-border-outset: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-width.html
new file mode 100644
index 00000000000..53599ea42b8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/mask-border-width.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to mask-border-width when specified and inherited</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="help" href="https://drafts.csswg.org/css-masking-1/#the-mask-border-width">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/mask-border-width-ref.html">
+<style>
+ .box {
+ width: 50px;
+ height: 50px;
+ background-color: red;
+ mask-border-slice: 10;
+ mask-border-source: linear-gradient(45deg, pink, blue, white, black, green);
+ mask-border-width: 8px;
+ margin: 10px;
+ }
+
+ .zoom {
+ zoom: 2;
+ }
+</style>
+
+<div class="box"></div>
+
+<div class="zoom">
+ <div class="box"></div>
+</div>
+
+<div class="zoom box"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom-anim.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom-anim.html
new file mode 100644
index 00000000000..b099b8ea2b8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom-anim.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Zoom property on elements with a transformation matrix and animation used</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/matrix-zoom-anim-ref.html">
+
+<style>
+.container {
+ width: 200px;
+ height: 200px;
+ border: 1px solid;
+}
+
+@keyframes kf {
+ from { transform: matrix(1, 0, 0, 1, 50, 50); }
+ to { transform: matrix(1, 0, 0, 1, 0, 0); }
+}
+
+#foo {
+ width: 50px;
+ height: 50px;
+ background: purple;
+ animation: kf 99999s steps(5) infinite alternate;
+}
+</style>
+
+<div class="container">
+ <div style="zoom: 2">
+ <div id="foo"></div>
+ </div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom.html
new file mode 100644
index 00000000000..688c59976b6
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix-zoom.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Zoom property on elements with a transformation matrix used</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/matrix-zoom-ref.html">
+<style>
+div {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ zoom: 2;
+}
+</style>
+<div style="transform: translate(100px, 100px)"></div>
+<div style="transform: matrix(1, 0, 0, -1, 100, 100)"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix3d-zoom.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix3d-zoom.html
new file mode 100644
index 00000000000..08a37b08bb9
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/matrix3d-zoom.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Zoom property on elements with a 3D transformation matrix used</title>
+<link rel="author" href="mailto:[email protected]" title="Seva Alipov">
+<link rel="author" href="https://mozilla.com" title="Mozilla">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1927186">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/matrix3d-zoom-ref.html">
+<style>
+div {
+ width: 100px;
+ height: 100px;
+ background: green;
+ zoom: 2;
+}
+</style>
+<div style="transform: translate(100px, 100px)"></div>
+<div style="transform: matrix3d(
+ 0.5,0,-0.75,0,
+ 0.75,1.25,-1,0,
+ 0.75,0,0.5,0,
+ 25,0,15,1
+);"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-offset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-offset.html
new file mode 100644
index 00000000000..f3f8c278e01
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-offset.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to outline-offset</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/outline-offset-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ outline-style: solid;
+ outline-width: 1px;
+ outline-offset: 5px;
+ outline-color: transparent;
+}
+.container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ outline-width: 1px;
+ outline-style: solid;
+ outline-color: black;
+}
+.spacer {
+ display: inline-block;
+ width: 40px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching outlines.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="outline-offset: 5px; zoom: 1;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="outline-offset: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="outline-offset: 5px; zoom: 2;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="outline-offset: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width-keywords.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width-keywords.html
new file mode 100644
index 00000000000..d126ec46e6b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width-keywords.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>CSS zoom applies to outline-width keywords</title>
+ <link rel="help" href="https://drafts.csswg.org/css-viewport/">
+ <link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/outline-width-keywords-ref.html">
+ <style>
+ .initial {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ outline-color: blue;
+ outline-style: solid;
+ outline-width: initial;
+ zoom: 2;
+ }
+
+ .thin {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ outline: thin solid blue;
+ zoom: 2;
+ }
+
+ .medium {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ outline: medium solid blue;
+ zoom: 2;
+ }
+
+ .thick {
+ width: 50px;
+ height: 50px;
+ margin-bottom: 10px;
+ outline: thick solid blue;
+ zoom: 2;
+ }
+ </style>
+</head>
+
+<body>
+ <div class="initial"></div>
+ <div class="thin"></div>
+ <div class="medium"></div>
+ <div class="thick"></div>
+</body>
+
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width.html
new file mode 100644
index 00000000000..44e9e5ae566
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/outline-width.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to outline-width</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/outline-width-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ outline-style: solid;
+ outline-width: 5px;
+ outline-color: transparent;
+}
+.container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ outline-style: solid;
+ outline-color: black;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two boxes with matching outlines.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="outline-width: 5px; zoom: 1;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="outline-width: inherit; zoom: 1;">
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="outline-width: 5px; zoom: 2;">
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="outline-width: inherit; zoom: 2;">
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/perspective.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/perspective.html
new file mode 100644
index 00000000000..df88de19373
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/perspective.html
@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to perspective</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/perspective-ref.html">
+<meta name="fuzzy" content="maxDifference=0-62; totalPixels=0-40">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ padding: 10px;
+ width: 100px;
+ height: 100px;
+ background: red;
+ transform: rotateY(60deg);
+}
+.box-zoom {
+ padding: 5px;
+ width: 50px;
+ height: 50px;
+ background: red;
+ transform: rotateY(60deg);
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.container-zoom {
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="perspective: 100px; zoom: 1;">
+ <div class="box"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="perspective: 100px;">
+ <div class="container" style="perspective: inherit; zoom: 1;">
+ <div class="box"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom" style="perspective: 50px; zoom: 2;">
+ <div class="box-zoom"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="perspective: 50px;">
+ <div class="container-zoom" style="perspective: inherit; zoom: 2;">
+ <div class="box-zoom"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/row-gap.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/row-gap.html
new file mode 100644
index 00000000000..92c7711f6f7
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/row-gap.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to row-gap</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/row-gap-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ border: 1px solid black;
+ padding: 10px;
+ row-gap: 20px;
+}
+.container {
+ display: flex;
+ flex-wrap: wrap;
+ width: 150px;
+}
+.container > div {
+ background-color: black;
+ flex: 1 1 auto;
+ width: 100px;
+ height: 20px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="row-gap: 20px; zoom: 1;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="row-gap: inherit; zoom: 1;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container" style="row-gap: 20px; zoom: 2;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container" style="row-gap: inherit; zoom: 2;">
+ <div></div>
+ <div></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-margin.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-margin.html
new file mode 100644
index 00000000000..b5e1b8bb6ea
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-margin.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to scroll-margin</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/scroll-margin-ref.html">
+<style>
+.group {
+ display: inline-block;
+ border: solid black 1px;
+ padding: 10px;
+}
+
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ overflow-x: hidden;
+ overflow-y: scroll;
+ padding: 40px 0;
+ margin: auto;
+ scroll-snap-type: y mandatory;
+}
+
+.buffer {
+ scroll-snap-align: start;
+ background-color: lightblue;
+ height: 300px;
+ width: 200px;
+}
+
+.target {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 10px;
+ width: 200px;
+}
+</style>
+</head>
+<body>
+<p>The black bars should line up in each group</p>
+<div class="group">
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: 20px; zoom 1;"></div>
+ <div class="buffer"></div>
+ </div>
+
+ <div id="container" style="scroll-margin-top: 20px;">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: inherit; zoom: 1;"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+<div class="group">
+ <div id="container">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: 20px; zoom: 2;"></div>
+ <div class="buffer"></div>
+ </div>
+
+ <div id="container" style="scroll-margin-top: 20px;">
+ <div class="buffer"></div>
+ <div class="target" style="scroll-margin-top: inherit; zoom: 2;"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+<script>
+ for (match of document.querySelectorAll(".target")) {
+ match.scrollIntoView();
+ }
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-padding.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-padding.html
new file mode 100644
index 00000000000..5749b52bf77
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/scroll-padding.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to scroll-padding</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/scroll-padding-ref.html">
+<style>
+#container {
+ display: inline-block;
+ width: 200px;
+ height: 100px;
+ border: solid black 1px;
+ overflow-x: hidden;
+ overflow-y: hidden;
+ scroll-snap-type: y mandatory;
+}
+
+.buffer {
+ scroll-snap-align: start;
+ background-color: lightblue;
+ height: 1000px;
+ width: 200px;
+}
+
+.target {
+ scroll-snap-align: start;
+ background-color: black;
+ height: 20px;
+ width: 200px;
+}
+</style>
+</head>
+<body>
+
+<div id="container" style="scroll-padding-top: 20px; zoom: 1;">
+ <div class="buffer"></div>
+ <div class="target"></div>
+ <div class="buffer"></div>
+</div>
+
+<div style="display: inline-block; scroll-padding-top: 20px;">
+ <div id="container" style="scroll-padding-top: inherit; zoom: 1;">
+ <div class="buffer"></div>
+ <div class="target"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+
+<div id="container" style="scroll-padding-top: 20px; zoom: 2;">
+ <div class="buffer"></div>
+ <div class="target"></div>
+ <div class="buffer"></div>
+</div>
+
+<div style="display: inline-block; scroll-padding-top: 20px;">
+ <div id="container" style="scroll-padding-top: inherit; zoom: 2;">
+ <div class="buffer"></div>
+ <div class="target"></div>
+ <div class="buffer"></div>
+ </div>
+</div>
+
+<script>
+ for (match of document.querySelectorAll(".target")) {
+ match.scrollIntoView();
+ }
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-inset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-inset.html
new file mode 100644
index 00000000000..a811ef5c279
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-inset.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to shape-outside: inset(...)</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-inset-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.inset {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.inset-zoom {
+ float: left;
+ width: 100px;
+ height: 100px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer" style="shape-outside: inset(40px 60px 40px 0 round 60px);">
+ <div class="inset" style="shape-outside: inset(40px 60px 40px 0 round 60px); zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: inset(40px 60px 40px 0 round 60px);">
+ <div class="inset" style="shape-outside: inherit; zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer" style="shape-outside: inset(20px 30px 20px 0 round 30px);">
+ <div class="inset-zoom" style="shape-outside: inset(20px 30px 20px 0 round 30px); zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: inset(20px 30px 20px 0 round 30px);">
+ <div class="inset-zoom" style="shape-outside: inherit; zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-polygon.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-polygon.html
new file mode 100644
index 00000000000..b31daa4bb5b
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-polygon.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to shape-outside: polygon(...)</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-polygon-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.polygon {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.polygon-zoom {
+ float: left;
+ width: 100px;
+ height: 100px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);">
+ <div class="polygon" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px); zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: polygon(0 40px, 140px 40px, 140px 160px, 0 160px);">
+ <div class="polygon" style="shape-outside: inherit; zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer" style="shape-outside: polygon(0 20px, 70px 20px, 70px 80px, 0 80px);">
+ <div class="polygon-zoom" style="shape-outside: polygon(0 20px, 70px 20px, 70px 80px, 0 80px); zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: polygon(0 20px, 70px 20px, 70px 80px, 0 80px);">
+ <div class="polygon-zoom" style="shape-outside: inherit; zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-rect.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-rect.html
new file mode 100644
index 00000000000..df024420cc7
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-rect.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to shape-outside: rect(...)</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-rect-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.rect {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.rect-zoom {
+ float: left;
+ width: 100px;
+ height: 100px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer" style="shape-outside: rect(40px 140px 160px 0 round 60px);">
+ <div class="rect" style="shape-outside: rect(40px 140px 160px 0 round 60px); zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: rect(40px 140px 160px 0 round 60px);">
+ <div class="rect" style="shape-outside: inherit; zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer" style="shape-outside: rect(20px 70px 80px 0 round 30px);">
+ <div class="rect-zoom" style="shape-outside: rect(20px 70px 80px 0 round 30px); zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: rect(20px 70px 80px 0 round 30px);">
+ <div class="rect-zoom" style="shape-outside: inherit; zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-xywh.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-xywh.html
new file mode 100644
index 00000000000..bb187794f1d
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/shape-outside-xywh.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to shape-outside: xywh(...)</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/shape-outside-xywh-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 300px;
+ height: 200px;
+ overflow: clip;
+}
+.outer > p {
+ margin: 0;
+}
+.xywh {
+ float: left;
+ width: 200px;
+ height: 200px;
+ margin: 0px;
+}
+.xywh-zoom {
+ float: left;
+ width: 100px;
+ height: 100px;
+ margin: 0px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer" style="shape-outside: xywh(0 40px 140px 120px round 60px);">
+ <div class="xywh" style="shape-outside: xywh(0 40px 140px 120px round 60px); zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: xywh(0 40px 140px 120px round 60px);">
+ <div class="xywh" style="shape-outside: inherit; zoom: 1;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+<div class="group">
+ <div class="outer" style="shape-outside: xywh(0 20px 70px 60px round 30px);">
+ <div class="xywh-zoom" style="shape-outside: xywh(0 20px 70px 60px round 30px); zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" style="shape-outside: xywh(0 20px 70px 60px round 30px);">
+ <div class="xywh-zoom" style="shape-outside: inherit; zoom: 2;"></div>
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size.html
new file mode 100644
index 00000000000..ef3c60824a6
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Zoom: foreignObject font-size should not be double-zoomed</title>
+<link rel="help" href="https://drafts.csswg.org/css-viewport/#zoom-property">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/svg-foreignObject-font-size-ref.html">
+<style>
+ :root {
+ zoom: 4;
+ font-size: 16px;
+ }
+</style>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div style="font-size:16px">TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25">
+ <foreignObject width="50" height="25">
+ <div style="font-size:inherit">TEST</div>
+ </foreignObject>
+</svg>
+<svg width="50" height="25" style="font-size:inherit">
+ <foreignObject width="50" height="25">
+ <div>TEST</div>
+ </foreignObject>
+</svg>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/tab-size.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/tab-size.html
new file mode 100644
index 00000000000..5f609882404
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/tab-size.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to tab-size</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/tab-size-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ display: inline-block;
+ tab-size: 40px;
+ border: solid black 1px;
+}
+.container {
+ display: inline-block;
+ font-size: 16px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <pre class="container" style="tab-size: 40px; zoom: 1;"> hello</pre>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <pre class="container" style="tab-size: inherit; zoom: 1;"> hello</pre>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <pre class="container" style="tab-size: 40px; zoom: 2;"> hello</pre>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <pre class="container" style="tab-size: inherit; zoom: 2;"> hello</pre>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-decoration-thickness.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-decoration-thickness.html
new file mode 100644
index 00000000000..65ee77fba54
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-decoration-thickness.html
@@ -0,0 +1,24 @@
+<title>CSS zoom applies to text-decoration-thickness when specified and inherited</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/text-decoration-thickness-ref.html">
+
+<style>
+.decoration-thickness {
+ text-decoration-thickness: 5px;
+}
+#unzoomed, #zoomed, #zoomed-inherited {
+ text-decoration-line: underline;
+ text-decoration-color: blue;
+}
+.zoom {
+ zoom: 2;
+}
+#zoomed-inherited {
+ text-decoration-thickness: inherit;
+}
+</style>
+
+<div id="unzoomed" class="decoration-thickness">unzoomed</div>
+<div class="zoom"><div id="zoomed" class="decoration-thickness">zoomed</div></div>
+<div class="decoration-thickness"><div id="zoomed-inherited" class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-indent.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-indent.html
new file mode 100644
index 00000000000..0e0fdc44ea3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-indent.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-indent when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/text-indent-ref.html">
+
+<style>
+.indent {
+ text-indent: 1rem;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="indent">unzoomed</div>
+<div class="zoom"><div class="indent">zoomed</div></div>
+<div class="indent"><div class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-shadow.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-shadow.html
new file mode 100644
index 00000000000..d32ddf43b2f
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-shadow.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-shadow when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/text-shadow-ref.html">
+
+<style>
+.shadow {
+ text-shadow: 5px 5px hotpink;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="shadow">unzoomed</div>
+<div class="zoom"><div class="shadow">zoomed</div></div>
+<div class="shadow"><div class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-stroke-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-stroke-width.html
new file mode 100644
index 00000000000..f7df0758e86
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-stroke-width.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to -webkit-text-stroke-width when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/text-stroke-width-ref.html">
+
+<style>
+div {
+ font-size: 3rem;
+ color: cornflowerblue;
+ -webkit-text-stroke-color: hotpink;
+}
+.text-stroke-width {
+ -webkit-text-stroke-width: 2px;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="text-stroke-width" >unzoomed</div>
+<div class="zoom"><div class="text-stroke-width">zoomed</div></div>
+<div class="text-stroke-width"><div class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-underline-offset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-underline-offset.html
new file mode 100644
index 00000000000..959bed0ac4c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/text-underline-offset.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<title>CSS zoom applies to text-underline-offset when specified and inherited</title>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/text-underline-offset-ref.html">
+
+<style>
+.underline-offset {
+ text-underline-offset: 5px;
+}
+.zoom {
+ zoom: 2;
+}
+#unzoomed, #zoomed, #zoomed-inherited {
+ text-decoration: underline hotpink;
+}
+</style>
+
+<div id="unzoomed" class="underline-offset">unzoomed</div>
+<div class="zoom"><div id="zoomed" class="underline-offset">zoomed</div></div>
+<div class="underline-offset"><div id="zoomed-inherited" class="zoom">zoomed inherited</div></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-2d.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-2d.html
new file mode 100644
index 00000000000..90722f4f484
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-2d.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to transform: matrix()</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-2d-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.box-zoom {
+ width: 50px;
+ height: 50px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.container-zoom {
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix(1, 0, 0, 1, 20, 40); zoom: 1;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container" style="transform: matrix(1, 0, 0, 1, 10, 20);">
+ <div class="box" style="transform: inherit; zoom: 1;"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom">
+ <div class="box-zoom" style="transform: matrix(1, 0, 0, 1, 15, 30); zoom: 2;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="transform: matrix(1, 0, 0, 1, 10, 20);">
+ <div class="box-zoom" style="transform: inherit; zoom: 2;"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-3d.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-3d.html
new file mode 100644
index 00000000000..dd1315ea855
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-matrix-3d.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to transform: matrix3d()</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/transform-matrix-3d-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.box-zoom {
+ width: 50px;
+ height: 50px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.container-zoom {
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 20, 40, 0, 1); zoom: 1;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 20, 0, 1);">
+ <div class="box" style="transform: inherit; zoom: 1;"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom">
+ <div class="box-zoom" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 15, 30, 0, 1); zoom: 2;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 20, 0, 1);">
+ <div class="box-zoom" style="transform: inherit; zoom: 2;"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-perspective.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-perspective.html
new file mode 100644
index 00000000000..615c71e8873
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-perspective.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to transform: perspective()</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/transform-perspective-ref.html">
+<meta name="fuzzy" content="maxDifference=0-62; totalPixels=0-40">
+<style>
+.box {
+ padding: 10px;
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.box-zoom {
+ padding: 5px;
+ width: 50px;
+ height: 50px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each box below should match the corresponding box in references/transform-perspective-ref.html</p>
+<div class="outer">
+ <div class="container">
+ <div class="box" style="transform: perspective(100px) rotateY(60deg); zoom: 1;"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer" >
+ <div class="container" style="transform: perspective(100px) rotateY(60deg);">
+ <div class="box" style="transform: inherit; zoom: 1;"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer">
+ <div class="container">
+ <div class="box-zoom" style="transform: perspective(50px) rotateY(60deg); zoom: 2;"></div>
+ </div>
+</div>
+<div class="spacer"></div>
+<div class="outer">
+ <div class="container" style="transform: perspective(50px) rotateY(60deg);">
+ <div class="box-zoom" style="transform: inherit; zoom: 2;"></div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-translate.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-translate.html
new file mode 100644
index 00000000000..41c10624180
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/transform-translate.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to transform: translate()</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/transform-translate-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.box-zoom {
+ width: 50px;
+ height: 50px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.container-zoom {
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="transform: translate(20px, 40px); zoom: 1;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container" style="transform: translate(10px, 20px);">
+ <div class="box" style="transform: inherit; zoom: 1;"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom">
+ <div class="box-zoom" style="transform: translate(15px, 30px); zoom: 2;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="transform: translate(10px, 20px);">
+ <div class="box-zoom" style="transform: inherit; zoom: 2;"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/translate.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/translate.html
new file mode 100644
index 00000000000..619314c7205
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/translate.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to translate</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/translate-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.box {
+ width: 100px;
+ height: 100px;
+ background: red;
+}
+.box-zoom {
+ width: 50px;
+ height: 50px;
+ background: red;
+}
+.outer {
+ border: solid black 1px;
+ display: inline-block;
+ width: 200px;
+ height: 200px;
+ overflow: clip;
+}
+.container {
+ width: 200px;
+ height: 200px;
+}
+.container-zoom {
+ width: 100px;
+ height: 100px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <div class="container">
+ <div class="box" style="translate: 20px 40px; zoom: 1;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer" >
+ <div class="container" style="translate: 10px 20px;">
+ <div class="box" style="translate: inherit; zoom: 1;"></div>
+ </div>
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <div class="container-zoom">
+ <div class="box-zoom" style="translate: 15px 30px; zoom: 2;"></div>
+ </div>
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <div class="container-zoom" style="translate: 10px 20px;">
+ <div class="box-zoom" style="translate: inherit; zoom: 2;"></div>
+ </div>
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/vertical-align.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/vertical-align.html
new file mode 100644
index 00000000000..12cc0ac477c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/vertical-align.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>CSS Zoom applies to vertical-align</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/vertical-align-ref.html">
+<style>
+.group {
+ border: solid black 1px;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+}
+.outer {
+ vertical-align: 20px;
+ display: inline-block;
+}
+.container {
+ width: 20px;
+ height: 20px;
+}
+.spacer {
+ display: inline-block;
+ width: 20px;
+}
+</style>
+</head>
+<body>
+<p>Each grouping below should have two matching boxes.</p>
+<div class="group">
+ <div class="outer">
+ <img class="container" src="../../../images/green.png" style="vertical-align: 20px; zoom: 1;">
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <img class="container" src="../../../images/green.png" style="vertical-align: inherit; zoom: 1;">
+ </div>
+</div>
+<div class="group">
+ <div class="outer">
+ <img class="container" src="../../../images/green.png" style="vertical-align: 20px; zoom: 2;">
+ </div>
+ <div class="spacer"></div>
+ <div class="outer">
+ <img class="container" src="../../../images/green.png" style="vertical-align: inherit; zoom: 2;">
+ </div>
+</div>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/view-timeline-inset.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/view-timeline-inset.html
new file mode 100644
index 00000000000..d718d0c7a45
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/view-timeline-inset.html
@@ -0,0 +1,204 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<title>CSS Zoom applies to view-timeline-inset</title>
+<link rel="author" title="Sam Weinig" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/view-timeline-inset-ref.html">
+<script src="../../../web-animations/testcommon.js"></script>
+<script src="../../../common/reftest-wait.js"></script>
+<style>
+.group {
+ outline: 1px solid black;
+ padding: 20px;
+ margin: 10px;
+ width: max-content;
+ position: relative;
+ top: 250px;
+}
+.spacer {
+ height: 500px;
+}
+.scroller {
+ outline: 1px solid black;
+ display: inline-block;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: auto;
+ width: 200px;
+ height: 200px;
+ view-timeline-inset: 50px 50px;
+}
+
+.scroller-zoomed {
+ display: inline-block;
+ outline: 1px solid black;
+ margin: 0 10px;
+ padding: 0;
+ border: 0;
+ overflow-y: scroll;
+ width: 200px;
+ height: 200px;
+ view-timeline-inset: 25px 25px;
+}
+
+@keyframes grow {
+ from { --bg: yellow; }
+ to { --bg: red; }
+}
+
+.indicator {
+ display: block;
+ position: fixed;
+ width: 100px;
+ height: 100px;
+ top: 100px;
+ margin: 0;
+ padding: 0;
+ background-color: var(--bg);
+}
+#indicator1 {
+ left: 100px;
+}
+
+#indicator2 {
+ left: 300px;
+}
+
+#indicator3 {
+ top: 50px;
+ width: 50px;
+ height: 50px;
+ left: 250px;
+}
+
+#indicator4 {
+ top: 50px;
+ width: 50px;
+ height: 50px;
+ left: 350px;
+}
+
+.target {
+ height: 100px;
+ width: 100px;
+ --bg: green;
+ background-color: black;
+}
+.target-zoomed {
+ height: 50px;
+ width: 50px;
+ --bg: green;
+ background-color: black;
+}
+
+.anim-1 {
+ animation: grow step-end 1 forwards;
+ animation-timeline: --t1;
+
+ view-timeline-name: --t1;
+ view-timeline-inset: 50px 50px;
+}
+.anim-2 {
+ animation: grow step-end 1 forwards;
+ animation-timeline: --t1;
+
+ view-timeline-name: --t1;
+ view-timeline-inset: inherit;
+}
+.anim-3 {
+ animation: grow step-end 1 forwards;
+ animation-timeline: --t1;
+
+ view-timeline-name: --t1;
+ view-timeline-inset: 25px 25px;
+}
+.anim-4 {
+ animation: grow step-end 1 forwards;
+ animation-timeline: --t1;
+
+ view-timeline-name: --t1;
+ view-timeline-inset: inherit;
+}
+</style>
+</head>
+<body>
+<p>There should be 4 green boxes below.</p>
+<div class="group">
+ <div class="scroller" id="scroller1">
+ <div class="spacer"></div>
+ <div class="target" id="target1" style="zoom: 1">
+ <div class="indicator" id="indicator1"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller" id="scroller2">
+ <div class="spacer"></div>
+ <div class="target" id="target2" style="zoom: 1">
+ <div class="indicator" id="indicator2"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<div class="group">
+ <div class="scroller-zoomed" id="scroller3">
+ <div class="spacer"></div>
+ <div class="target-zoomed" id="target3" style="zoom: 2">
+ <div class="indicator" id="indicator3"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+
+ <div class="scroller-zoomed" id="scroller4">
+ <div class="spacer"></div>
+ <div class="target-zoomed" id="target4" style="zoom: 2">
+ <div class="indicator" id="indicator4"></div>
+ </div>
+ <div class="spacer"></div>
+ </div>
+</div>
+
+<script>
+ const target1 = document.getElementById('target1');
+ const target2 = document.getElementById('target2');
+ const target3 = document.getElementById('target3');
+ const target4 = document.getElementById('target4');
+
+ const scroller1 = document.getElementById('scroller1');
+ const scroller2 = document.getElementById('scroller2');
+ const scroller3 = document.getElementById('scroller3');
+ const scroller4 = document.getElementById('scroller4');
+
+ target1.classList.add("anim-1");
+ const animation1 = target1.getAnimations()[0];
+
+ target2.classList.add("anim-2");
+ const animation2 = target2.getAnimations()[0];
+
+ target3.classList.add("anim-3");
+ const animation3 = target3.getAnimations()[0];
+
+ target4.classList.add("anim-4");
+ const animation4 = target4.getAnimations()[0];
+
+ Promise.all([animation1.ready, animation2.ready, animation3.ready, animation4.ready]).then(() => {
+ const maxScroll1 = scroller1.scrollHeight - scroller1.clientHeight;
+ scroller1.scrollTop = (maxScroll1 - 250) * 0.5;
+
+ const maxScroll2 = scroller2.scrollHeight - scroller2.clientHeight;
+ scroller2.scrollTop = (maxScroll2 - 250) * 0.5;
+
+ const maxScroll3 = scroller3.scrollHeight - scroller3.clientHeight;
+ scroller3.scrollTop = (maxScroll3 - 250) * 0.5;
+
+ const maxScroll4 = scroller4.scrollHeight - scroller4.clientHeight;
+ scroller4.scrollTop = (maxScroll4 - 250) * 0.5;
+
+ waitForAnimationFrames(2).then(takeScreenshot);
+ });
+</script>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/word-spacing.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/word-spacing.html
new file mode 100644
index 00000000000..871426becff
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/word-spacing.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<style>CSS zoom applies to word-spacing when specified and inherited</style>
+<link rel="author" title="Stefan Zager" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/reference/word-spacing-ref.html">
+
+<style>
+.spacing {
+ word-spacing: 2rem;
+}
+.zoom {
+ zoom: 2;
+}
+</style>
+
+<div class="spacing">
+ <div>unzoomed lorem ipsum</div>
+</div>
+
+<div class="zoom">
+ <div class="spacing">zoomed lorem ipsum</div>
+</div>
+
+<div class="spacing">
+ <div class="zoom">zoomed inherited lorem ipsum</div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/zoom-precision.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/zoom-precision.html
new file mode 100644
index 00000000000..d967fcb4982
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-viewport/zoom/zoom-precision.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<link rel="match" href="../../../../../expected/wpt-import/css/css-viewport/zoom/zoom-precision-ref.html">
+<link rel="help" href="https://drafts.csswg.org/css-viewport/">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1973437">
+<link rel="author" href="mailto:[email protected]" title="Daniel Holbert">
+<link rel="author" href="mailto:[email protected]" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<style>
+ .s {
+ display: inline-block;
+ background: green;
+ width: 190px;
+ height: 100px;
+ }
+
+ .t {
+ font-size: 0;
+ width: 570px;
+ /* this is 3x the width of .s */
+ background: red;
+ zoom: 85%;
+ }
+</style>
+<div class="t">
+ <div class="s"></div>
+ <div class="s"></div>
+ <div class="s"></div>
+</div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/images/green.png b/Tests/LibWeb/Ref/input/wpt-import/images/green.png
new file mode 100644
index 00000000000..28a1faab377
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/images/green.png differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/images/pattern.png b/Tests/LibWeb/Ref/input/wpt-import/images/pattern.png
new file mode 100644
index 00000000000..65ce5b44a64
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/images/pattern.png differ
diff --git a/Tests/LibWeb/Text/expected/Editing/queryCommandValue-fontSize-zoom.txt b/Tests/LibWeb/Text/expected/Editing/queryCommandValue-fontSize-zoom.txt
new file mode 100644
index 00000000000..6946c5f72e7
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/Editing/queryCommandValue-fontSize-zoom.txt
@@ -0,0 +1,10 @@
+plain: 16px, selected=3, collapsed=3
+zoomed: 16px, selected=3, collapsed=3
+reduced: 16px, selected=3, collapsed=3
+nested zoom: 16px, selected=3, collapsed=3
+cancelled zoom: 16px, selected=3, collapsed=3
+large font: 24px, selected=5, collapsed=5
+changed zoom 1: 3
+changed zoom 2: 3
+changed zoom 0.5: 3
+changed zoom 1: 3
diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
index 3d7092f46b2..af2cfd5e386 100644
--- a/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
+++ b/Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt
@@ -385,7 +385,8 @@ All properties associated with getComputedStyle(document.body):
"will-change",
"x",
"y",
- "z-index"
+ "z-index",
+ "zoom"
]
All properties associated with document.body.style by default:
[]
diff --git a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
index 6fa6c7e96b7..5ce289970be 100644
--- a/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
+++ b/Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt
@@ -1074,4 +1074,5 @@ All supported properties and their default values exposed from CSSStylePropertie
'y': '0px'
'zIndex': 'auto'
'z-index': 'auto'
+'zoom': '1'
'constructor': 'function CSSStyleProperties() { [native code] }'
diff --git a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
index 077de1285d1..9e659bd15dd 100644
--- a/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
+++ b/Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt
@@ -384,3 +384,4 @@ will-change: auto
x: 0px
y: 0px
z-index: auto
+zoom: 1
diff --git a/Tests/LibWeb/Text/expected/css/zoom-single-application.txt b/Tests/LibWeb/Text/expected/css/zoom-single-application.txt
new file mode 100644
index 00000000000..6c94c400b67
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/zoom-single-application.txt
@@ -0,0 +1,45 @@
+layout margin shorthand: true
+layout padding shorthand: true
+layout border-width shorthand: true
+zoom stays a number: true
+typed style length: true
+no-layout margin shorthand: true
+calc sum: true
+calc mixed: true
+calc border: true
+computed product distribution: true
+textarea width once: true
+textarea height once: true
+text input width once: true
+text input height once: true
+range width once: true
+range height once: true
+canvas width once: true
+canvas height once: true
+contained canvas width once: true
+contained canvas height once: true
+monospace default font: true
+monospace default height: true
+monospace undeclared ancestor font: true
+monospace undeclared ancestor height: true
+monospace px font: true
+monospace px height: true
+monospace target zoom font: true
+monospace target zoom height: true
+monospace rem font: true
+monospace rem height: true
+monospace viewport font: true
+monospace viewport height: true
+monospace nested chain font: true
+monospace nested chain height: true
+monospace ex font: true
+monospace ex height: true
+monospace lh font: true
+monospace lh height: true
+SVG recascade matches inherited font: true
+SVG recascade matches inherited width: true
+client width unscaled: true
+offset width unscaled: true
+observer content width unscaled: true
+observer border width unscaled: true
+observer padding unscaled: true
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
index 770ccd394c9..34eff716334 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-cascade/all-prop-revert-layer.txt
@@ -1,8 +1,8 @@
Harness status: OK
-Found 346 tests
+Found 347 tests
-342 Pass
+343 Pass
4 Fail
Pass accent-color
Pass border-collapse
@@ -349,4 +349,5 @@ Fail width
Pass will-change
Pass x
Pass y
-Pass z-index
\ No newline at end of file
+Pass z-index
+Pass zoom
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/animations/zoom-interpolation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/animations/zoom-interpolation.txt
index ae4bd2a9a46..475215b7435 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/animations/zoom-interpolation.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/animations/zoom-interpolation.txt
@@ -2,206 +2,207 @@ Harness status: OK
Found 202 tests
-202 Fail
-Fail CSS Transitions: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions: property <zoom> from neutral to [2] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from neutral to [2] at (0.3) should be [1.3]
-Fail CSS Transitions: property <zoom> from neutral to [2] at (0.6) should be [1.6]
-Fail CSS Transitions: property <zoom> from neutral to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from neutral to [2] at (1.5) should be [2.5]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0.3) should be [1.3]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0.6) should be [1.6]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from neutral to [2] at (1.5) should be [2.5]
-Fail CSS Animations: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
-Fail CSS Animations: property <zoom> from neutral to [2] at (0) should be [1]
-Fail CSS Animations: property <zoom> from neutral to [2] at (0.3) should be [1.3]
-Fail CSS Animations: property <zoom> from neutral to [2] at (0.6) should be [1.6]
-Fail CSS Animations: property <zoom> from neutral to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from neutral to [2] at (1.5) should be [2.5]
-Fail Web Animations: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
-Fail Web Animations: property <zoom> from neutral to [2] at (0) should be [1]
-Fail Web Animations: property <zoom> from neutral to [2] at (0.3) should be [1.3]
-Fail Web Animations: property <zoom> from neutral to [2] at (0.6) should be [1.6]
-Fail Web Animations: property <zoom> from neutral to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from neutral to [2] at (1.5) should be [2.5]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
-Fail Web Animations: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
-Fail Web Animations: property <zoom> from [initial] to [2] at (0) should be [1]
-Fail Web Animations: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
-Fail Web Animations: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
-Fail Web Animations: property <zoom> from [initial] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (0) should be [3]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0) should be [3]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (0) should be [3]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (0) should be [3]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
-Fail Web Animations: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
-Fail Web Animations: property <zoom> from [unset] to [2] at (0) should be [1]
-Fail Web Animations: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
-Fail Web Animations: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
-Fail Web Animations: property <zoom> from [unset] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
+189 Pass
+13 Fail
+Pass CSS Transitions: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions: property <zoom> from neutral to [2] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from neutral to [2] at (0.3) should be [1.3]
+Pass CSS Transitions: property <zoom> from neutral to [2] at (0.6) should be [1.6]
+Pass CSS Transitions: property <zoom> from neutral to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from neutral to [2] at (1.5) should be [2.5]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0.3) should be [1.3]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (0.6) should be [1.6]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from neutral to [2] at (1.5) should be [2.5]
+Pass CSS Animations: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
+Pass CSS Animations: property <zoom> from neutral to [2] at (0) should be [1]
+Pass CSS Animations: property <zoom> from neutral to [2] at (0.3) should be [1.3]
+Pass CSS Animations: property <zoom> from neutral to [2] at (0.6) should be [1.6]
+Pass CSS Animations: property <zoom> from neutral to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from neutral to [2] at (1.5) should be [2.5]
+Pass Web Animations: property <zoom> from neutral to [2] at (-0.3) should be [0.7]
+Pass Web Animations: property <zoom> from neutral to [2] at (0) should be [1]
+Pass Web Animations: property <zoom> from neutral to [2] at (0.3) should be [1.3]
+Pass Web Animations: property <zoom> from neutral to [2] at (0.6) should be [1.6]
+Pass Web Animations: property <zoom> from neutral to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from neutral to [2] at (1.5) should be [2.5]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
+Pass Web Animations: property <zoom> from [initial] to [2] at (-0.3) should be [0.7]
+Pass Web Animations: property <zoom> from [initial] to [2] at (0) should be [1]
+Pass Web Animations: property <zoom> from [initial] to [2] at (0.3) should be [1.3]
+Pass Web Animations: property <zoom> from [initial] to [2] at (0.6) should be [1.6]
+Pass Web Animations: property <zoom> from [initial] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [initial] to [2] at (1.5) should be [2.5]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (0) should be [3]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0) should be [3]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (0) should be [3]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (-0.3) should be [3.3]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (0) should be [3]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (0.3) should be [2.7]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (0.6) should be [2.4]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [inherit] to [2] at (1.5) should be [1.5]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
+Pass Web Animations: property <zoom> from [unset] to [2] at (-0.3) should be [0.7]
+Pass Web Animations: property <zoom> from [unset] to [2] at (0) should be [1]
+Pass Web Animations: property <zoom> from [unset] to [2] at (0.3) should be [1.3]
+Pass Web Animations: property <zoom> from [unset] to [2] at (0.6) should be [1.6]
+Pass Web Animations: property <zoom> from [unset] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [unset] to [2] at (1.5) should be [2.5]
Fail CSS Transitions: property <zoom> from [1] to [2] at (-5) should be [1]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from [1] to [2] at (1.5) should be [2.5]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from [1] to [2] at (1.5) should be [2.5]
Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (-5) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0.3) should be [1.3]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0.6) should be [1.6]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [1] to [2] at (1.5) should be [2.5]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0.3) should be [1.3]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (0.6) should be [1.6]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [1] to [2] at (1.5) should be [2.5]
Fail CSS Animations: property <zoom> from [1] to [2] at (-5) should be [1]
-Fail CSS Animations: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
-Fail CSS Animations: property <zoom> from [1] to [2] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [1] to [2] at (0.3) should be [1.3]
-Fail CSS Animations: property <zoom> from [1] to [2] at (0.6) should be [1.6]
-Fail CSS Animations: property <zoom> from [1] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [1] to [2] at (1.5) should be [2.5]
+Pass CSS Animations: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
+Pass CSS Animations: property <zoom> from [1] to [2] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [1] to [2] at (0.3) should be [1.3]
+Pass CSS Animations: property <zoom> from [1] to [2] at (0.6) should be [1.6]
+Pass CSS Animations: property <zoom> from [1] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [1] to [2] at (1.5) should be [2.5]
Fail Web Animations: property <zoom> from [1] to [2] at (-5) should be [1]
-Fail Web Animations: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
-Fail Web Animations: property <zoom> from [1] to [2] at (0) should be [1]
-Fail Web Animations: property <zoom> from [1] to [2] at (0.3) should be [1.3]
-Fail Web Animations: property <zoom> from [1] to [2] at (0.6) should be [1.6]
-Fail Web Animations: property <zoom> from [1] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [1] to [2] at (1.5) should be [2.5]
+Pass Web Animations: property <zoom> from [1] to [2] at (-0.3) should be [0.7]
+Pass Web Animations: property <zoom> from [1] to [2] at (0) should be [1]
+Pass Web Animations: property <zoom> from [1] to [2] at (0.3) should be [1.3]
+Pass Web Animations: property <zoom> from [1] to [2] at (0.6) should be [1.6]
+Pass Web Animations: property <zoom> from [1] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [1] to [2] at (1.5) should be [2.5]
Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (-5) should be [1]
-Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
-Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
-Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
-Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
-Fail CSS Transitions: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
+Pass CSS Transitions: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
+Pass CSS Transitions: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
+Pass CSS Transitions: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
+Pass CSS Transitions: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
+Pass CSS Transitions: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (-5) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
-Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
-Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
-Fail CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
+Pass CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
+Pass CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
+Pass CSS Transitions with transition: all: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (-5) should be [1]
-Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
-Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
-Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
-Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
-Fail CSS Animations: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
+Pass CSS Animations: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
+Pass CSS Animations: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
+Pass CSS Animations: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
+Pass CSS Animations: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
+Pass CSS Animations: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
Fail Web Animations: property <zoom> from [0.5] to [1.5] at (-5) should be [1]
-Fail Web Animations: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
-Fail Web Animations: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
-Fail Web Animations: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
-Fail Web Animations: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
-Fail Web Animations: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
+Pass Web Animations: property <zoom> from [0.5] to [1.5] at (-0.3) should be [0.2]
+Pass Web Animations: property <zoom> from [0.5] to [1.5] at (0) should be [0.5]
+Pass Web Animations: property <zoom> from [0.5] to [1.5] at (0.5) should be [1]
+Pass Web Animations: property <zoom> from [0.5] to [1.5] at (1) should be [1.5]
+Pass Web Animations: property <zoom> from [0.5] to [1.5] at (1.5) should be [2]
Fail CSS Transitions: property <zoom> from [normal] to [3] at (-0.5) should be [1]
-Fail CSS Transitions: property <zoom> from [normal] to [3] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [normal] to [3] at (0.5) should be [2]
-Fail CSS Transitions: property <zoom> from [normal] to [3] at (1) should be [3]
+Pass CSS Transitions: property <zoom> from [normal] to [3] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [normal] to [3] at (0.5) should be [2]
+Pass CSS Transitions: property <zoom> from [normal] to [3] at (1) should be [3]
Fail CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (-0.5) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (0.5) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (1) should be [3]
+Pass CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (0.5) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [normal] to [3] at (1) should be [3]
Fail CSS Animations: property <zoom> from [normal] to [3] at (-0.5) should be [1]
-Fail CSS Animations: property <zoom> from [normal] to [3] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [normal] to [3] at (0.5) should be [2]
-Fail CSS Animations: property <zoom> from [normal] to [3] at (1) should be [3]
+Pass CSS Animations: property <zoom> from [normal] to [3] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [normal] to [3] at (0.5) should be [2]
+Pass CSS Animations: property <zoom> from [normal] to [3] at (1) should be [3]
Fail Web Animations: property <zoom> from [normal] to [3] at (-0.5) should be [1]
-Fail Web Animations: property <zoom> from [normal] to [3] at (0) should be [1]
-Fail Web Animations: property <zoom> from [normal] to [3] at (0.5) should be [2]
-Fail Web Animations: property <zoom> from [normal] to [3] at (1) should be [3]
-Fail CSS Transitions: property <zoom> from [100%] to [300%] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [100%] to [300%] at (0.5) should be [2]
-Fail CSS Transitions: property <zoom> from [100%] to [300%] at (1) should be [3]
-Fail CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (0.5) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (1) should be [3]
-Fail CSS Animations: property <zoom> from [100%] to [300%] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [100%] to [300%] at (0.5) should be [2]
-Fail CSS Animations: property <zoom> from [100%] to [300%] at (1) should be [3]
-Fail Web Animations: property <zoom> from [100%] to [300%] at (0) should be [1]
-Fail Web Animations: property <zoom> from [100%] to [300%] at (0.5) should be [2]
-Fail Web Animations: property <zoom> from [100%] to [300%] at (1) should be [3]
-Fail CSS Transitions: property <zoom> from [50%] to [2] at (0) should be [0.5]
-Fail CSS Transitions: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
-Fail CSS Transitions: property <zoom> from [50%] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (0) should be [0.5]
-Fail CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
-Fail CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [50%] to [2] at (0) should be [0.5]
-Fail CSS Animations: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
-Fail CSS Animations: property <zoom> from [50%] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [50%] to [2] at (0) should be [0.5]
-Fail Web Animations: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
-Fail Web Animations: property <zoom> from [50%] to [2] at (1) should be [2]
-Fail CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
-Fail CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
-Fail CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
-Fail CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
-Fail CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
-Fail CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
-Fail CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
-Fail CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
-Fail CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
-Fail Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
-Fail Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
-Fail Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [normal] to [3] at (0) should be [1]
+Pass Web Animations: property <zoom> from [normal] to [3] at (0.5) should be [2]
+Pass Web Animations: property <zoom> from [normal] to [3] at (1) should be [3]
+Pass CSS Transitions: property <zoom> from [100%] to [300%] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [100%] to [300%] at (0.5) should be [2]
+Pass CSS Transitions: property <zoom> from [100%] to [300%] at (1) should be [3]
+Pass CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (0.5) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [100%] to [300%] at (1) should be [3]
+Pass CSS Animations: property <zoom> from [100%] to [300%] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [100%] to [300%] at (0.5) should be [2]
+Pass CSS Animations: property <zoom> from [100%] to [300%] at (1) should be [3]
+Pass Web Animations: property <zoom> from [100%] to [300%] at (0) should be [1]
+Pass Web Animations: property <zoom> from [100%] to [300%] at (0.5) should be [2]
+Pass Web Animations: property <zoom> from [100%] to [300%] at (1) should be [3]
+Pass CSS Transitions: property <zoom> from [50%] to [2] at (0) should be [0.5]
+Pass CSS Transitions: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
+Pass CSS Transitions: property <zoom> from [50%] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (0) should be [0.5]
+Pass CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
+Pass CSS Transitions with transition: all: property <zoom> from [50%] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [50%] to [2] at (0) should be [0.5]
+Pass CSS Animations: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
+Pass CSS Animations: property <zoom> from [50%] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [50%] to [2] at (0) should be [0.5]
+Pass Web Animations: property <zoom> from [50%] to [2] at (0.5) should be [1.25]
+Pass Web Animations: property <zoom> from [50%] to [2] at (1) should be [2]
+Pass CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
+Pass CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
+Pass CSS Transitions: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
+Pass CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
+Pass CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
+Pass CSS Transitions with transition: all: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
+Pass CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
+Pass CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
+Pass CSS Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
+Pass Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0) should be [1]
+Pass Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (0.5) should be [1.5]
+Pass Web Animations: property <zoom> from [calc(sibling-index() * 100%)] to [2] at (1) should be [2]
Fail Animating zoom affects layout using the interpolated value
-Fail transition: all animates zoom changes from :hover
\ No newline at end of file
+Pass transition: all animates zoom changes from :hover
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/computedStyle-zoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/computedStyle-zoom.txt
index 6f4c3027a47..7c68a98d902 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/computedStyle-zoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/computedStyle-zoom.txt
@@ -2,11 +2,10 @@ Harness status: OK
Found 6 tests
-1 Pass
-5 Fail
+6 Pass
Pass getComputedStyle for elements with css zoom
-Fail getComputedStyle for elements with css zoom 1
-Fail getComputedStyle for elements with css zoom 2
-Fail getComputedStyle for elements with css zoom 3
-Fail getComputedStyle for elements with css zoom 4
-Fail getComputedStyle for elements with css zoom 5
\ No newline at end of file
+Pass getComputedStyle for elements with css zoom 1
+Pass getComputedStyle for elements with css zoom 2
+Pass getComputedStyle for elements with css zoom 3
+Pass getComputedStyle for elements with css zoom 4
+Pass getComputedStyle for elements with css zoom 5
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-system-font.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-system-font.txt
index c6549051468..8df4ac61556 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-system-font.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/font-size-keyword-system-font.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail zoom scales font-size set via system font keyword
\ No newline at end of file
+1 Pass
+Pass zoom scales font-size set via system font keyword
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed-with-sign-expression.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed-with-sign-expression.txt
index 40f5aa7bc15..02d1403587b 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed-with-sign-expression.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed-with-sign-expression.txt
@@ -2,15 +2,15 @@ Harness status: OK
Found 11 tests
-11 Fail
-Fail Property zoom value 'calc(1 + (sign(2cqw - 3cqw) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(5px - 10px) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(5 - 10) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(30deg - 40deg) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(3em - 5em) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(1cm - 1in) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(1deg - 1rad) * 0.5))'
-Fail Property zoom value 'calc(1 + (sign(2cqw - 10px) * 0.5))'
-Fail Property zoom value 'calc(100% + (sign(2cqw - 10px) * 50%))'
-Fail Property zoom value 'calc(100% + (sign(1em - 30px) * 50%))'
-Fail Property zoom value 'calc(100% + (sign(2cqw - 1em) * 50%))'
\ No newline at end of file
+11 Pass
+Pass Property zoom value 'calc(1 + (sign(2cqw - 3cqw) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(5px - 10px) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(5 - 10) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(30deg - 40deg) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(3em - 5em) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(1cm - 1in) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(1deg - 1rad) * 0.5))'
+Pass Property zoom value 'calc(1 + (sign(2cqw - 10px) * 0.5))'
+Pass Property zoom value 'calc(100% + (sign(2cqw - 10px) * 50%))'
+Pass Property zoom value 'calc(100% + (sign(1em - 30px) * 50%))'
+Pass Property zoom value 'calc(100% + (sign(2cqw - 1em) * 50%))'
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed.txt
index a8345b05a99..32ebb421d89 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-computed.txt
@@ -2,17 +2,17 @@ Harness status: OK
Found 13 tests
-13 Fail
-Fail Property zoom value 'normal'
-Fail Property zoom value '1'
-Fail Property zoom value '1.5'
-Fail Property zoom value '0.75'
-Fail Property zoom value 'calc(1 - 0.5)'
-Fail Property zoom value 'calc(1 * 0.5)'
-Fail Property zoom value '100%'
-Fail Property zoom value '150%'
-Fail Property zoom value '75%'
-Fail Property zoom value 'calc(100% - 50%)'
-Fail Property zoom value 'calc(100% * 0.5)'
-Fail Property zoom value '0'
-Fail Property zoom value '0%'
\ No newline at end of file
+13 Pass
+Pass Property zoom value 'normal'
+Pass Property zoom value '1'
+Pass Property zoom value '1.5'
+Pass Property zoom value '0.75'
+Pass Property zoom value 'calc(1 - 0.5)'
+Pass Property zoom value 'calc(1 * 0.5)'
+Pass Property zoom value '100%'
+Pass Property zoom value '150%'
+Pass Property zoom value '75%'
+Pass Property zoom value 'calc(100% - 50%)'
+Pass Property zoom value 'calc(100% * 0.5)'
+Pass Property zoom value '0'
+Pass Property zoom value '0%'
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-valid.txt
index 933d3add1e4..03ea52741ab 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-valid.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/parsing/zoom-valid.txt
@@ -2,17 +2,16 @@ Harness status: OK
Found 16 tests
-7 Pass
-9 Fail
-Fail e.style['zoom'] = "normal" should set the property value
-Fail e.style['zoom'] = "1" should set the property value
-Fail e.style['zoom'] = "100%" should set the property value
-Fail e.style['zoom'] = "0" should set the property value
-Fail e.style['zoom'] = "0%" should set the property value
-Fail e.style['zoom'] = "1.5" should set the property value
-Fail e.style['zoom'] = "150%" should set the property value
-Fail e.style['zoom'] = "75%" should set the property value
-Fail e.style['zoom'] = "0.5" should set the property value
+16 Pass
+Pass e.style['zoom'] = "normal" should set the property value
+Pass e.style['zoom'] = "1" should set the property value
+Pass e.style['zoom'] = "100%" should set the property value
+Pass e.style['zoom'] = "0" should set the property value
+Pass e.style['zoom'] = "0%" should set the property value
+Pass e.style['zoom'] = "1.5" should set the property value
+Pass e.style['zoom'] = "150%" should set the property value
+Pass e.style['zoom'] = "75%" should set the property value
+Pass e.style['zoom'] = "0.5" should set the property value
Pass e.style['zoom'] = "auto" should not set the property value
Pass e.style['zoom'] = "reset" should not set the property value
Pass e.style['zoom'] = "document" should not set the property value
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/relative-units.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/relative-units.txt
index 8889386cf49..cdb09260a49 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/relative-units.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/relative-units.txt
@@ -2,10 +2,10 @@ Harness status: OK
Found 6 tests
-6 Fail
-Fail relative-units
-Fail relative-units 1
-Fail relative-units 2
-Fail relative-units 3
-Fail relative-units 4
-Fail relative-units 5
\ No newline at end of file
+6 Pass
+Pass relative-units
+Pass relative-units 1
+Pass relative-units 2
+Pass relative-units 3
+Pass relative-units 4
+Pass relative-units 5
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/widget.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/widget.txt
index 82c682758d8..87b80b0e59e 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/widget.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/widget.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail checkbox
-Fail radio
\ No newline at end of file
+2 Pass
+Pass checkbox
+Pass radio
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/zoom-with-sign-function.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/zoom-with-sign-function.txt
index c9705c9673a..0460ea0a8a2 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/zoom-with-sign-function.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-viewport/zoom/zoom-with-sign-function.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail calc(sign(1em - 1px) * 2) should be used-value-equivalent to 2
-Fail calc(sign(1em - 1px) * 2%) should be used-value-equivalent to 2%
\ No newline at end of file
+2 Pass
+Pass calc(sign(1em - 1px) * 2) should be used-value-equivalent to 2
+Pass calc(sign(1em - 1px) * 2%) should be used-value-equivalent to 2%
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/Element-currentCSSZoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/Element-currentCSSZoom.txt
index a90c3127a3a..51a6a2e919a 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/Element-currentCSSZoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/Element-currentCSSZoom.txt
@@ -2,6 +2,6 @@ Harness status: OK
Found 2 tests
-2 Fail
-Fail Element.currentCSSZoom basic test
-Fail Element.currentCSSZoom reacts to style changes
\ No newline at end of file
+2 Pass
+Pass Element.currentCSSZoom basic test
+Pass Element.currentCSSZoom reacts to style changes
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getBoundingClientRect-zoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getBoundingClientRect-zoom.txt
index f9493849533..4f3da6912f8 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getBoundingClientRect-zoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getBoundingClientRect-zoom.txt
@@ -2,10 +2,9 @@ Harness status: OK
Found 5 tests
-2 Pass
-3 Fail
+5 Pass
Pass getBoundingClientRect for elements with css zoom
Pass getBoundingClientRect for elements with css zoom 1
-Fail getBoundingClientRect for elements with css zoom 2
-Fail getBoundingClientRect for elements with css zoom 3
-Fail getBoundingClientRect for elements with css zoom 4
\ No newline at end of file
+Pass getBoundingClientRect for elements with css zoom 2
+Pass getBoundingClientRect for elements with css zoom 3
+Pass getBoundingClientRect for elements with css zoom 4
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getClientRects-zoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getClientRects-zoom.txt
index f9493849533..4f3da6912f8 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getClientRects-zoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/getClientRects-zoom.txt
@@ -2,10 +2,9 @@ Harness status: OK
Found 5 tests
-2 Pass
-3 Fail
+5 Pass
Pass getBoundingClientRect for elements with css zoom
Pass getBoundingClientRect for elements with css zoom 1
-Fail getBoundingClientRect for elements with css zoom 2
-Fail getBoundingClientRect for elements with css zoom 3
-Fail getBoundingClientRect for elements with css zoom 4
\ No newline at end of file
+Pass getBoundingClientRect for elements with css zoom 2
+Pass getBoundingClientRect for elements with css zoom 3
+Pass getBoundingClientRect for elements with css zoom 4
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/image-x-y-zoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/image-x-y-zoom.txt
index 10dc4912077..17ed312052c 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/image-x-y-zoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/image-x-y-zoom.txt
@@ -2,7 +2,6 @@ Harness status: OK
Found 2 tests
-1 Pass
-1 Fail
+2 Pass
Pass x and y properties for image elements with css zoom
-Fail x and y properties for image elements with css zoom 1
\ No newline at end of file
+Pass x and y properties for image elements with css zoom 1
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/scroll-zoom.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/scroll-zoom.txt
index 3d9f88d3bbd..1b6518966e5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/scroll-zoom.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom-view/scroll-zoom.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 3 tests
-2 Pass
-1 Fail
+3 Pass
Pass scroll properties for elements with css zoom
-Fail scroll{Width, Height}
+Pass scroll{Width, Height}
Pass scroll{Top, Left}
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/resize-observer/observe.txt b/Tests/LibWeb/Text/expected/wpt-import/resize-observer/observe.txt
index b20d9bc11bb..a5ad974f7ef 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/resize-observer/observe.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/resize-observer/observe.txt
@@ -1,8 +1,8 @@
Harness status: OK
-Found 21 tests
+Found 22 tests
-20 Pass
+21 Pass
1 Fail
Pass ResizeObserver implemented
Pass guard
@@ -24,4 +24,5 @@ Pass test14: observe the same target but using a different box should override t
Pass test15: an observation is fired with box dimensions 0 when element's display property is set to inline
Pass test16: observations fire once with 0x0 size for non-replaced inline elements
Pass test17: Box sizing snd Resize Observer notifications
-Pass test18: an observation is fired when device-pixel-content-box is being observed
\ No newline at end of file
+Pass test18: an observation is fired when device-pixel-content-box is being observed
+Pass test19: an observation is fired when device-pixel-content-box is being observed and zoom change
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/Editing/queryCommandValue-fontSize-zoom.html b/Tests/LibWeb/Text/input/Editing/queryCommandValue-fontSize-zoom.html
new file mode 100644
index 00000000000..34b1341053c
--- /dev/null
+++ b/Tests/LibWeb/Text/input/Editing/queryCommandValue-fontSize-zoom.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ const selection = getSelection();
+ const check = (label, outerZoom, innerZoom, size) => {
+ const host = document.createElement("div");
+ host.contentEditable = "true";
+ host.style.zoom = outerZoom;
+ const span = document.createElement("span");
+ span.style.cssText = `zoom:${innerZoom};font-size:${size}px`;
+ span.textContent = "x";
+ host.append(span);
+ document.body.append(host);
+ host.focus();
+ selection.setBaseAndExtent(span.firstChild, 0, span.firstChild, 1);
+ const selected = document.queryCommandValue("fontSize");
+ selection.collapse(span.firstChild, 1);
+ const collapsed = document.queryCommandValue("fontSize");
+ println(`${label}: ${getComputedStyle(span).fontSize}, selected=${selected}, collapsed=${collapsed}`);
+ host.remove();
+ };
+ check("plain", 1, 1, 16);
+ check("zoomed", 2, 1, 16);
+ check("reduced", 0.5, 1, 16);
+ check("nested zoom", 2, 3, 16);
+ check("cancelled zoom", 2, 0.5, 16);
+ check("large font", 2, 1, 24);
+
+ const host = document.createElement("div");
+ host.contentEditable = "true";
+ host.style.fontSize = "16px";
+ host.textContent = "x";
+ document.body.append(host);
+ host.focus();
+ selection.setBaseAndExtent(host.firstChild, 0, host.firstChild, 1);
+ for (const zoom of [1, 2, 0.5, 1]) {
+ host.style.zoom = zoom;
+ println(`changed zoom ${zoom}: ${document.queryCommandValue("fontSize")}`);
+ }
+ host.remove();
+ selection.removeAllRanges();
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/css/zoom-single-application.html b/Tests/LibWeb/Text/input/css/zoom-single-application.html
new file mode 100644
index 00000000000..708e063226e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/zoom-single-application.html
@@ -0,0 +1,221 @@
+<!doctype html>
+<script src="../include.js"></script>
+<style>
+ @font-face {
+ font-family: ZoomAhem;
+ src: url("../wpt-import/fonts/Ahem.ttf");
+ }
+ .control {
+ appearance: none;
+ overflow: hidden;
+ border: 0;
+ padding: 0;
+ margin: 0;
+ font: 20px / 1 ZoomAhem;
+ }
+</style>
+<script>
+ promiseTest(async () => {
+ await document.fonts.load("20px ZoomAhem");
+ const show = (label, condition) => println(`${label}: ${condition}`);
+ const same = (a, b) => Math.abs(a - b) < 1 / 64;
+ const make = (markup, style = "") => {
+ const node = document.createElement("div");
+ node.style.cssText = style;
+ node.innerHTML = markup;
+ document.body.append(node);
+ return node;
+ };
+ const layout = make(
+ '<div id="box" style="margin:1px 2px 3px 4px;padding:5px 6px 7px 8px;border:9px solid"></div>',
+ "zoom:2"
+ );
+ const box = layout.querySelector("#box");
+ let style = getComputedStyle(box);
+ show("layout margin shorthand", style.margin === "1px 2px 3px 4px");
+ show("layout padding shorthand", style.padding === "5px 6px 7px 8px");
+ show("layout border-width shorthand", style.borderWidth === "9px");
+ show("zoom stays a number", getComputedStyle(layout).zoom === "2");
+ show("typed style length", box.computedStyleMap().get("padding-top").toString() === "5px");
+ box.style.display = "none";
+ show("no-layout margin shorthand", getComputedStyle(box).margin === "1px 2px 3px 4px");
+
+ const calc = make(
+ '<div id="sum" style="width:calc(10px + 5px)"></div><div id="sum-ref" style="width:15px"></div>' +
+ '<div id="mixed" style="width:calc(10px + 50%)"></div><div id="mixed-ref" style="width:60px"></div>' +
+ '<div id="border" style="width:10px;border:calc(2px + 3px) solid"></div><div id="border-ref" style="width:10px;border:5px solid"></div>',
+ "zoom:2;width:100px"
+ );
+ for (const id of ["sum", "mixed", "border"])
+ show(
+ `calc ${id}`,
+ same(
+ calc.querySelector(`#${id}`).getBoundingClientRect().width,
+ calc.querySelector(`#${id}-ref`).getBoundingClientRect().width
+ )
+ );
+ const product = make(
+ '<div></div><div id="product" style="width:calc((10px + 50%) * sibling-index())"></div><div id="reference" style="width:120px"></div>',
+ "zoom:2;width:100px"
+ );
+ show(
+ "computed product distribution",
+ same(
+ product.querySelector("#product").getBoundingClientRect().width,
+ product.querySelector("#reference").getBoundingClientRect().width
+ )
+ );
+
+ for (const [label, markup] of [
+ ["textarea", '<textarea class="control" cols="3" rows="2"></textarea>'],
+ ["text input", '<input class="control" type="text" size="3">'],
+ ["range", '<input class="control" type="range">'],
+ ["canvas", '<canvas width="13" height="17"></canvas>'],
+ ["contained canvas", '<canvas style="contain:size;contain-intrinsic-size:30px 40px"></canvas>'],
+ ]) {
+ const plain = make(markup).firstElementChild;
+ const zoomed = make(markup, "zoom:2").firstElementChild;
+ const a = plain.getBoundingClientRect();
+ const b = zoomed.getBoundingClientRect();
+ if (label === "textarea" || label === "text input") {
+ // Compare character-count increments so fixed native-control extras cancel out.
+ // Allow one pixel per added character for native font-metric rounding.
+ const wider = markup.replace('cols="3"', 'cols="7"').replace('size="3"', 'size="7"');
+ const widePlain = make(wider).firstElementChild.getBoundingClientRect();
+ const wideZoomed = make(wider, "zoom:2").firstElementChild.getBoundingClientRect();
+ show(
+ `${label} width once`,
+ Math.abs(wideZoomed.width - b.width - 2 * (widePlain.width - a.width)) <= 4
+ );
+ } else {
+ show(`${label} width once`, Math.abs(b.width - a.width * 2) <= 1);
+ }
+ show(`${label} height once`, same(b.height, a.height * 2));
+ }
+
+ const fontCase = (label, ancestorStyle, targetStyle = "", rootStyle = null) => {
+ const saved = document.documentElement.style.cssText;
+ if (rootStyle !== null) document.documentElement.style.cssText = rootStyle;
+ const outer = make(
+ `<span id="target" style="display:block;font-family:monospace;line-height:1;${targetStyle}">x</span><span id="reference" style="display:block;font-family:monospace;font-size:inherit;line-height:1;${targetStyle}">x</span>`,
+ ancestorStyle
+ );
+ const target = outer.querySelector("#target");
+ const reference = outer.querySelector("#reference");
+ // Both see the same ancestor sizes. Only the target takes the monospace recascade's inherited result.
+ show(`${label} font`, getComputedStyle(target).fontSize === getComputedStyle(reference).fontSize);
+ show(
+ `${label} height`,
+ same(target.getBoundingClientRect().height, reference.getBoundingClientRect().height)
+ );
+ outer.remove();
+ document.documentElement.style.cssText = saved;
+ };
+ const defaultPlain = make(
+ '<span style="display:block;font-family:monospace;line-height:1">x</span>'
+ ).firstElementChild;
+ const defaultZoomed = make(
+ '<span style="display:block;font-family:monospace;line-height:1">x</span>',
+ "zoom:2"
+ ).firstElementChild;
+ show(
+ "monospace default font",
+ getComputedStyle(defaultPlain).fontSize === getComputedStyle(defaultZoomed).fontSize
+ );
+ show(
+ "monospace default height",
+ same(defaultZoomed.getBoundingClientRect().height, defaultPlain.getBoundingClientRect().height * 2)
+ );
+ const undeclared = make(
+ '<div style="zoom:3"><span id="target" style="display:block;font-family:monospace;line-height:1">x</span><span id="reference" style="display:block;font-family:monospace;font-size:inherit;line-height:1">x</span></div>',
+ "zoom:2;font-size:10px"
+ );
+ show(
+ "monospace undeclared ancestor font",
+ getComputedStyle(undeclared.querySelector("#target")).fontSize ===
+ getComputedStyle(undeclared.querySelector("#reference")).fontSize
+ );
+ show(
+ "monospace undeclared ancestor height",
+ same(
+ undeclared.querySelector("#target").getBoundingClientRect().height,
+ undeclared.querySelector("#reference").getBoundingClientRect().height
+ )
+ );
+ // An explicit ancestor size avoids depending on a platform's default proportional/monospace size difference.
+ fontCase("monospace px", "zoom:2;font-size:10px");
+ fontCase("monospace target zoom", "font-size:10px", "zoom:2");
+ fontCase("monospace rem", "zoom:3;font-size:2rem", "", "zoom:2;font-size:20px");
+ fontCase("monospace viewport", "zoom:2;font-size:5vw");
+ const fontChain = make(
+ '<div style="zoom:3;font-size:200%"><div style="font-size:2em"><span id="target" style="display:block;font-family:monospace;line-height:1;zoom:.5">x</span><span id="reference" style="display:block;font-family:monospace;font-size:inherit;line-height:1;zoom:.5">x</span></div></div>',
+ "zoom:2;font-size:10px"
+ );
+ show(
+ "monospace nested chain font",
+ getComputedStyle(fontChain.querySelector("#target")).fontSize ===
+ getComputedStyle(fontChain.querySelector("#reference")).fontSize
+ );
+ show(
+ "monospace nested chain height",
+ same(
+ fontChain.querySelector("#target").getBoundingClientRect().height,
+ fontChain.querySelector("#reference").getBoundingClientRect().height
+ )
+ );
+ for (const [label, unit] of [
+ ["ex", "2ex"],
+ ["lh", "1lh"],
+ ]) {
+ const scope = make(
+ `<div style="zoom:2;font-size:${unit}"><span id="target" style="display:block;font-family:monospace;line-height:1">x</span><span id="reference" style="display:block;font-family:monospace;font-size:inherit;line-height:1">x</span></div>`,
+ "font-family:monospace;font-size:20px;line-height:1.5;zoom:2"
+ );
+ show(
+ `monospace ${label} font`,
+ getComputedStyle(scope.querySelector("#target")).fontSize ===
+ getComputedStyle(scope.querySelector("#reference")).fontSize
+ );
+ show(
+ `monospace ${label} height`,
+ same(
+ scope.querySelector("#target").getBoundingClientRect().height,
+ scope.querySelector("#reference").getBoundingClientRect().height
+ )
+ );
+ }
+
+ const svgScope = make(
+ '<svg style="zoom:2;font-size:10px"><text id="target" style="font-family:monospace">x</text><text id="reference" style="font-family:monospace;font-size:inherit">x</text></svg>'
+ );
+ show(
+ "SVG recascade matches inherited font",
+ getComputedStyle(svgScope.querySelector("#target")).fontSize ===
+ getComputedStyle(svgScope.querySelector("#reference")).fontSize
+ );
+ show(
+ "SVG recascade matches inherited width",
+ same(
+ svgScope.querySelector("#target").getBoundingClientRect().width,
+ svgScope.querySelector("#reference").getBoundingClientRect().width
+ )
+ );
+
+ const geometry = make(
+ "",
+ "zoom:2;width:15.5px;height:9.25px;padding:2px;border:1px solid;box-sizing:content-box"
+ );
+ show("client width unscaled", geometry.clientWidth === 20);
+ show("offset width unscaled", geometry.offsetWidth === 22);
+ const entry = await new Promise(resolve => {
+ const observer = new ResizeObserver(entries => {
+ observer.disconnect();
+ resolve(entries[0]);
+ });
+ observer.observe(geometry);
+ });
+ show("observer content width unscaled", entry.contentBoxSize[0].inlineSize === 15.5);
+ show("observer border width unscaled", entry.borderBoxSize[0].inlineSize === 21.5);
+ show("observer padding unscaled", entry.contentRect.x === 2 && entry.contentRect.y === 2);
+ });
+</script>