forked from mirrors/gecko-dev
Bug 1865810 - [css-properties-values-api] Recompute initial values when viewport changes r=firefox-style-system-reviewers,emilio
If the initial values of custom property registrations contain viewport units, changing the viewport will result in recomputing the initial values. Differential Revision: https://phabricator.services.mozilla.com/D194668
This commit is contained in:
parent
9981d3702b
commit
a55f8a22aa
3 changed files with 21 additions and 6 deletions
|
|
@ -864,9 +864,17 @@ pub struct CustomPropertiesBuilder<'a, 'b: 'a> {
|
|||
impl<'a, 'b: 'a> CustomPropertiesBuilder<'a, 'b> {
|
||||
/// Create a new builder, inheriting from a given custom properties map.
|
||||
pub fn new(stylist: &'a Stylist, computed_context: &'a computed::Context<'b>) -> Self {
|
||||
let is_root_element = computed_context.is_root_element();
|
||||
|
||||
let inherited = computed_context.inherited_custom_properties();
|
||||
let initial_values = stylist.get_custom_property_initial_values();
|
||||
let is_root_element = computed_context.is_root_element();
|
||||
|
||||
// Reuse flags from computing registered custom properties initial values, such as whether
|
||||
// they depend on viewport units.
|
||||
computed_context
|
||||
.style()
|
||||
.add_flags(stylist.get_custom_property_initial_values_flags());
|
||||
|
||||
Self {
|
||||
seen: PrecomputedHashSet::default(),
|
||||
reverted: Default::default(),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use std::os::raw::c_void;
|
|||
use std::ptr;
|
||||
use style::color::mix::ColorInterpolationMethod;
|
||||
use style::color::{AbsoluteColor, ColorSpace};
|
||||
use style::computed_value_flags::ComputedValueFlags;
|
||||
use style::context::ThreadLocalStyleContext;
|
||||
use style::context::{CascadeInputs, QuirksMode, SharedStyleContext, StyleContext};
|
||||
use style::counter_style;
|
||||
|
|
@ -8547,8 +8548,9 @@ pub unsafe extern "C" fn Servo_InvalidateForViewportUnits(
|
|||
root: &RawGeckoElement,
|
||||
dynamic_only: bool,
|
||||
) {
|
||||
let document_data = document_style.borrow();
|
||||
let device = document_data.stylist.device();
|
||||
let mut document_data = document_style.borrow_mut();
|
||||
let ref mut stylist = document_data.stylist;
|
||||
let device = stylist.device();
|
||||
|
||||
if !device.used_viewport_size() {
|
||||
return;
|
||||
|
|
@ -8558,6 +8560,14 @@ pub unsafe extern "C" fn Servo_InvalidateForViewportUnits(
|
|||
return;
|
||||
}
|
||||
|
||||
// If the viewport changed, then initial values containing viewport units need to be recomputed.
|
||||
if stylist
|
||||
.get_custom_property_initial_values_flags()
|
||||
.intersects(ComputedValueFlags::USES_VIEWPORT_UNITS)
|
||||
{
|
||||
stylist.rebuild_initial_values_for_custom_properties();
|
||||
}
|
||||
|
||||
if style::invalidation::viewport_units::invalidate(GeckoElement(root)) {
|
||||
// The invalidation machinery propagates the bits up, but we still need
|
||||
// to tell the Gecko restyle root machinery about it.
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
[at-property-viewport-units-dynamic.html]
|
||||
[@property: viewport units in initial value (dynamic)]
|
||||
expected: FAIL
|
||||
Loading…
Reference in a new issue