mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1897756. Implement parsing of CSS 'position-visibility' property. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D210910
This commit is contained in:
parent
430bafb552
commit
7b0b5f40c7
@ -144,6 +144,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [
|
||||
"pointer-events",
|
||||
"position",
|
||||
"position-anchor",
|
||||
"position-visibility",
|
||||
"print-color-adjust",
|
||||
"quotes",
|
||||
"resize",
|
||||
|
@ -107,7 +107,7 @@ use.counter:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 2307 use counter metrics (excludes denominators).
|
||||
# Total of 2309 use counter metrics (excludes denominators).
|
||||
# Total of 354 'page' use counters.
|
||||
use.counter.page:
|
||||
svgsvgelement_getelementbyid:
|
||||
@ -15541,7 +15541,7 @@ use.counter.deprecated_ops.doc:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 700 'CSS (page)' use counters.
|
||||
# Total of 701 'CSS (page)' use counters.
|
||||
use.counter.css.page:
|
||||
css_align_content:
|
||||
type: counter
|
||||
@ -17039,6 +17039,23 @@ use.counter.css.page:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
css_position_visibility:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a page used the CSS property position-visibility.
|
||||
Compare against `use.counter.top_level_content_documents_destroyed`
|
||||
to calculate the rate.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
|
||||
notification_emails:
|
||||
- dom-core@mozilla.com
|
||||
- emilio@mozilla.com
|
||||
expires: never
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
css_print_color_adjust:
|
||||
type: counter
|
||||
description: >
|
||||
@ -27443,7 +27460,7 @@ use.counter.css.page:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
# Total of 700 'CSS (document)' use counters.
|
||||
# Total of 701 'CSS (document)' use counters.
|
||||
use.counter.css.doc:
|
||||
css_align_content:
|
||||
type: counter
|
||||
@ -28941,6 +28958,23 @@ use.counter.css.doc:
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
css_position_visibility:
|
||||
type: counter
|
||||
description: >
|
||||
Whether a document used the CSS property position-visibility.
|
||||
Compare against `use.counter.content_documents_destroyed`
|
||||
to calculate the rate.
|
||||
bugs:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
|
||||
data_reviews:
|
||||
- https://bugzilla.mozilla.org/show_bug.cgi?id=1852098
|
||||
notification_emails:
|
||||
- dom-core@mozilla.com
|
||||
- emilio@mozilla.com
|
||||
expires: never
|
||||
send_in_pings:
|
||||
- use-counters
|
||||
|
||||
css_print_color_adjust:
|
||||
type: counter
|
||||
description: >
|
||||
|
@ -623,6 +623,7 @@ cbindgen-types = [
|
||||
{ gecko = "StyleAnchorName", servo = "crate::values::computed::position::AnchorName" },
|
||||
{ gecko = "StyleAnchorScope", servo = "crate::values::computed::position::AnchorScope" },
|
||||
{ gecko = "StylePositionAnchor", servo = "crate::values::computed::position::PositionAnchor" },
|
||||
{ gecko = "StylePositionVisibility", servo = "crate::values::computed::position::PositionVisibility" },
|
||||
]
|
||||
|
||||
mapped-generic-types = [
|
||||
|
@ -1052,6 +1052,7 @@ nsStylePosition::nsStylePosition()
|
||||
mMinHeight(StyleSize::Auto()),
|
||||
mMaxHeight(StyleMaxSize::None()),
|
||||
mPositionAnchor(StylePositionAnchor::Auto()),
|
||||
mPositionVisibility(StylePositionVisibility::ALWAYS),
|
||||
mFlexBasis(StyleFlexBasis::Size(StyleSize::Auto())),
|
||||
mAspectRatio(StyleAspectRatio::Auto()),
|
||||
mGridAutoFlow(StyleGridAutoFlow::ROW),
|
||||
@ -1101,6 +1102,7 @@ nsStylePosition::nsStylePosition(const nsStylePosition& aSource)
|
||||
mMinHeight(aSource.mMinHeight),
|
||||
mMaxHeight(aSource.mMaxHeight),
|
||||
mPositionAnchor(aSource.mPositionAnchor),
|
||||
mPositionVisibility(aSource.mPositionVisibility),
|
||||
mFlexBasis(aSource.mFlexBasis),
|
||||
mGridAutoColumns(aSource.mGridAutoColumns),
|
||||
mGridAutoRows(aSource.mGridAutoRows),
|
||||
@ -1285,6 +1287,10 @@ nsChangeHint nsStylePosition::CalcDifference(
|
||||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
if (mPositionVisibility != aNewData.mPositionVisibility) {
|
||||
hint |= nsChangeHint_NeutralChange;
|
||||
}
|
||||
|
||||
if (mAspectRatio != aNewData.mAspectRatio) {
|
||||
hint |= nsChangeHint_ReflowHintsForISizeChange |
|
||||
nsChangeHint_ReflowHintsForBSizeChange;
|
||||
|
@ -748,6 +748,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition {
|
||||
// 'auto' or a `<dashed-ident>` referencing an anchor positioning anchor
|
||||
// element.
|
||||
mozilla::StylePositionAnchor mPositionAnchor;
|
||||
mozilla::StylePositionVisibility mPositionVisibility;
|
||||
|
||||
mozilla::StyleFlexBasis mFlexBasis;
|
||||
StyleImplicitGridTracks mGridAutoColumns;
|
||||
|
@ -13346,6 +13346,20 @@ if (IsCSSPropertyPrefEnabled("layout.css.anchor-positioning.enabled")) {
|
||||
other_values: ["--foo"],
|
||||
invalid_values: ["none", "--foo, auto", "auto, --bar", "foo"],
|
||||
};
|
||||
|
||||
gCSSProperties["position-visibility"] = {
|
||||
domProp: "positionVisibility",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: ["always"],
|
||||
other_values: ["anchors-valid", "anchors-visible", "no-overflow"],
|
||||
invalid_values: [
|
||||
"none",
|
||||
"auto",
|
||||
"always anchors-valid",
|
||||
"anchors-visible always",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
if (false) {
|
||||
|
@ -591,6 +591,7 @@ class Longhand(Property):
|
||||
"OverscrollBehavior",
|
||||
"PageOrientation",
|
||||
"Percentage",
|
||||
"PositionVisibility",
|
||||
"PrintColorAdjust",
|
||||
"ForcedColorAdjust",
|
||||
"Resize",
|
||||
|
@ -342,6 +342,18 @@ ${helpers.predefined_type(
|
||||
affects="layout",
|
||||
)}
|
||||
|
||||
${helpers.predefined_type(
|
||||
"position-visibility",
|
||||
"PositionVisibility",
|
||||
"computed::PositionVisibility::ALWAYS",
|
||||
engines="gecko",
|
||||
initial_specified_value="specified::PositionVisibility::ALWAYS",
|
||||
animation_value_type="discrete",
|
||||
gecko_pref="layout.css.anchor-positioning.enabled",
|
||||
spec="https://drafts.csswg.org/css-anchor-position-1/#propdef-position-visibility",
|
||||
affects="layout",
|
||||
)}
|
||||
|
||||
${helpers.single_keyword(
|
||||
"box-sizing",
|
||||
"content-box border-box",
|
||||
|
@ -91,6 +91,7 @@ pub use self::percentage::{NonNegativePercentage, Percentage};
|
||||
pub use self::position::AnchorName;
|
||||
pub use self::position::AnchorScope;
|
||||
pub use self::position::PositionAnchor;
|
||||
pub use self::position::PositionVisibility;
|
||||
pub use self::position::AspectRatio;
|
||||
pub use self::position::{
|
||||
GridAutoFlow, GridTemplateAreas, MasonryAutoFlow, Position, PositionOrAuto, ZIndex,
|
||||
|
@ -14,7 +14,7 @@ use crate::values::generics::position::PositionComponent as GenericPositionCompo
|
||||
use crate::values::generics::position::PositionOrAuto as GenericPositionOrAuto;
|
||||
use crate::values::generics::position::ZIndex as GenericZIndex;
|
||||
pub use crate::values::specified::position::{GridAutoFlow, GridTemplateAreas, MasonryAutoFlow};
|
||||
pub use crate::values::specified::position::{AnchorName, AnchorScope, PositionAnchor};
|
||||
pub use crate::values::specified::position::{AnchorName, AnchorScope, PositionAnchor, PositionVisibility};
|
||||
use crate::Zero;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
|
@ -84,6 +84,7 @@ pub use self::position::AspectRatio;
|
||||
pub use self::position::AnchorName;
|
||||
pub use self::position::AnchorScope;
|
||||
pub use self::position::PositionAnchor;
|
||||
pub use self::position::PositionVisibility;
|
||||
pub use self::position::{GridAutoFlow, GridTemplateAreas, Position, PositionOrAuto};
|
||||
pub use self::position::{MasonryAutoFlow, MasonryItemOrder, MasonryPlacement};
|
||||
pub use self::position::{PositionComponent, ZIndex};
|
||||
|
@ -489,6 +489,52 @@ impl PositionAnchor {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Eq,
|
||||
MallocSizeOf,
|
||||
Parse,
|
||||
PartialEq,
|
||||
Serialize,
|
||||
SpecifiedValueInfo,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[css(bitflags(single = "always", mixed = "anchors-valid,anchors-visible,no-overflow"))]
|
||||
#[repr(C)]
|
||||
/// Specified keyword values for the position-visibility property.
|
||||
pub struct PositionVisibility(u8);
|
||||
bitflags! {
|
||||
impl PositionVisibility: u8 {
|
||||
/// Element is displayed without regard for its anchors or its overflowing status.
|
||||
const ALWAYS = 0;
|
||||
/// anchors-valid
|
||||
const ANCHORS_VALID = 1 << 0;
|
||||
/// anchors-visible
|
||||
const ANCHORS_VISIBLE = 1 << 1;
|
||||
/// no-overflow
|
||||
const NO_OVERFLOW = 1 << 2;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for PositionVisibility {
|
||||
fn default() -> Self {
|
||||
Self::ALWAYS
|
||||
}
|
||||
}
|
||||
|
||||
impl PositionVisibility {
|
||||
#[inline]
|
||||
/// Returns the initial value of position-visibility
|
||||
pub fn always() -> Self {
|
||||
Self::ALWAYS
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a side, either horizontal or vertical, of a CSS position.
|
||||
pub trait Side {
|
||||
/// Returns the start side.
|
||||
|
@ -112,6 +112,7 @@ include = [
|
||||
"DisplayMode",
|
||||
"Platform",
|
||||
"PositionAnchor",
|
||||
"PositionVisibility",
|
||||
"GtkThemeFamily",
|
||||
"PrefersColorScheme",
|
||||
"PrefersContrast",
|
||||
|
Loading…
Reference in New Issue
Block a user