mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #19197 - emilio:source-size-list-integration, r=Manishearth
stylo: Integrate Servo SourceSizeList in ResponsiveImageSelector. Bug: 1408308 Reviewed-by: Manishearth <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19197) <!-- Reviewable:end -->
This commit is contained in:
commit
5d3a90ecce
6 changed files with 229 additions and 36 deletions
|
@ -4398,6 +4398,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms23swipe_animation_enabledE"]
|
#[link_name = "_ZN9nsGkAtoms23swipe_animation_enabledE"]
|
||||||
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms17gtk_csd_availableE"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms23gtk_csd_minimize_buttonE"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms23gtk_csd_maximize_buttonE"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms20gtk_csd_close_buttonE"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms15windows_classicE"]
|
#[link_name = "_ZN9nsGkAtoms15windows_classicE"]
|
||||||
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms18windows_theme_aeroE"]
|
#[link_name = "_ZN9nsGkAtoms18windows_theme_aeroE"]
|
||||||
|
@ -4458,6 +4466,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms28_moz_swipe_animation_enabledE"]
|
#[link_name = "_ZN9nsGkAtoms28_moz_swipe_animation_enabledE"]
|
||||||
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms22_moz_gtk_csd_availableE"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms28_moz_gtk_csd_minimize_buttonE"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms28_moz_gtk_csd_maximize_buttonE"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "_ZN9nsGkAtoms25_moz_gtk_csd_close_buttonE"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms4BackE"]
|
#[link_name = "_ZN9nsGkAtoms4BackE"]
|
||||||
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
||||||
#[link_name = "_ZN9nsGkAtoms7ForwardE"]
|
#[link_name = "_ZN9nsGkAtoms7ForwardE"]
|
||||||
|
@ -9561,6 +9577,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
||||||
#[link_name = "?swipe_animation_enabled@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?swipe_animation_enabled@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?gtk_csd_available@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?gtk_csd_minimize_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?gtk_csd_maximize_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?gtk_csd_close_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "?windows_classic@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?windows_classic@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
||||||
#[link_name = "?windows_theme_aero@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?windows_theme_aero@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
@ -9621,6 +9645,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
||||||
#[link_name = "?_moz_swipe_animation_enabled@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?_moz_swipe_animation_enabled@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?_moz_gtk_csd_available@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?_moz_gtk_csd_minimize_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?_moz_gtk_csd_maximize_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "?_moz_gtk_csd_close_button@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "?Back@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?Back@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
||||||
#[link_name = "?Forward@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
#[link_name = "?Forward@nsGkAtoms@@2PEAVnsStaticAtom@@EA"]
|
||||||
|
@ -14724,6 +14756,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
pub static nsGkAtoms_menubar_drag: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?swipe_animation_enabled@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?swipe_animation_enabled@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?gtk_csd_available@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?gtk_csd_minimize_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?gtk_csd_maximize_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?gtk_csd_close_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?windows_classic@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?windows_classic@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
pub static nsGkAtoms_windows_classic: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?windows_theme_aero@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?windows_theme_aero@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
@ -14784,6 +14824,14 @@ cfg_if! {
|
||||||
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_is_resource_document: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?_moz_swipe_animation_enabled@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?_moz_swipe_animation_enabled@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
pub static nsGkAtoms__moz_swipe_animation_enabled: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?_moz_gtk_csd_available@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_available: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?_moz_gtk_csd_minimize_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_minimize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?_moz_gtk_csd_maximize_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_maximize_button: *mut nsStaticAtom;
|
||||||
|
#[link_name = "\x01?_moz_gtk_csd_close_button@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
pub static nsGkAtoms__moz_gtk_csd_close_button: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?Back@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?Back@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
pub static nsGkAtoms_Back: *mut nsStaticAtom;
|
||||||
#[link_name = "\x01?Forward@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
#[link_name = "\x01?Forward@nsGkAtoms@@2PAVnsStaticAtom@@A"]
|
||||||
|
@ -19890,6 +19938,14 @@ macro_rules! atom {
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_menubar_drag as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_menubar_drag as *mut _) } };
|
||||||
("swipe-animation-enabled") =>
|
("swipe-animation-enabled") =>
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_swipe_animation_enabled as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_swipe_animation_enabled as *mut _) } };
|
||||||
|
("gtk-csd-available") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_gtk_csd_available as *mut _) } };
|
||||||
|
("gtk-csd-minimize-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_gtk_csd_minimize_button as *mut _) } };
|
||||||
|
("gtk-csd-maximize-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_gtk_csd_maximize_button as *mut _) } };
|
||||||
|
("gtk-csd-close-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_gtk_csd_close_button as *mut _) } };
|
||||||
("windows-classic") =>
|
("windows-classic") =>
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_windows_classic as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_windows_classic as *mut _) } };
|
||||||
("windows-theme-aero") =>
|
("windows-theme-aero") =>
|
||||||
|
@ -19950,6 +20006,14 @@ macro_rules! atom {
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_is_resource_document as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_is_resource_document as *mut _) } };
|
||||||
("-moz-swipe-animation-enabled") =>
|
("-moz-swipe-animation-enabled") =>
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_swipe_animation_enabled as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_swipe_animation_enabled as *mut _) } };
|
||||||
|
("-moz-gtk-csd-available") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_gtk_csd_available as *mut _) } };
|
||||||
|
("-moz-gtk-csd-minimize-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_gtk_csd_minimize_button as *mut _) } };
|
||||||
|
("-moz-gtk-csd-maximize-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_gtk_csd_maximize_button as *mut _) } };
|
||||||
|
("-moz-gtk-csd-close-button") =>
|
||||||
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms__moz_gtk_csd_close_button as *mut _) } };
|
||||||
("Back") =>
|
("Back") =>
|
||||||
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_Back as *mut _) } };
|
{ unsafe { $crate::string_cache::atom_macro::atom_from_static($crate::string_cache::atom_macro::nsGkAtoms_Back as *mut _) } };
|
||||||
("Forward") =>
|
("Forward") =>
|
||||||
|
|
|
@ -50,6 +50,7 @@ use gecko_bindings::structs::RawGeckoServoStyleRuleList;
|
||||||
use gecko_bindings::structs::RawGeckoURLExtraData;
|
use gecko_bindings::structs::RawGeckoURLExtraData;
|
||||||
use gecko_bindings::structs::RawGeckoXBLBinding;
|
use gecko_bindings::structs::RawGeckoXBLBinding;
|
||||||
use gecko_bindings::structs::RawServoSelectorList;
|
use gecko_bindings::structs::RawServoSelectorList;
|
||||||
|
use gecko_bindings::structs::RawServoSourceSizeList;
|
||||||
use gecko_bindings::structs::RefPtr;
|
use gecko_bindings::structs::RefPtr;
|
||||||
use gecko_bindings::structs::RustString;
|
use gecko_bindings::structs::RustString;
|
||||||
use gecko_bindings::structs::CSSPseudoClassType;
|
use gecko_bindings::structs::CSSPseudoClassType;
|
||||||
|
@ -263,6 +264,12 @@ pub type RawServoSelectorListBorrowed<'a> = &'a RawServoSelectorList;
|
||||||
pub type RawServoSelectorListBorrowedOrNull<'a> = Option<&'a RawServoSelectorList>;
|
pub type RawServoSelectorListBorrowedOrNull<'a> = Option<&'a RawServoSelectorList>;
|
||||||
pub type RawServoSelectorListBorrowedMut<'a> = &'a mut RawServoSelectorList;
|
pub type RawServoSelectorListBorrowedMut<'a> = &'a mut RawServoSelectorList;
|
||||||
pub type RawServoSelectorListBorrowedMutOrNull<'a> = Option<&'a mut RawServoSelectorList>;
|
pub type RawServoSelectorListBorrowedMutOrNull<'a> = Option<&'a mut RawServoSelectorList>;
|
||||||
|
pub type RawServoSourceSizeListOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoSourceSizeList>;
|
||||||
|
pub type RawServoSourceSizeListOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoSourceSizeList>;
|
||||||
|
pub type RawServoSourceSizeListBorrowed<'a> = &'a RawServoSourceSizeList;
|
||||||
|
pub type RawServoSourceSizeListBorrowedOrNull<'a> = Option<&'a RawServoSourceSizeList>;
|
||||||
|
pub type RawServoSourceSizeListBorrowedMut<'a> = &'a mut RawServoSourceSizeList;
|
||||||
|
pub type RawServoSourceSizeListBorrowedMutOrNull<'a> = Option<&'a mut RawServoSourceSizeList>;
|
||||||
pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<ServoElementSnapshot>;
|
pub type ServoElementSnapshotOwned = ::gecko_bindings::sugar::ownership::Owned<ServoElementSnapshot>;
|
||||||
pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>;
|
pub type ServoElementSnapshotOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<ServoElementSnapshot>;
|
||||||
pub type ServoElementSnapshotBorrowed<'a> = &'a ServoElementSnapshot;
|
pub type ServoElementSnapshotBorrowed<'a> = &'a ServoElementSnapshot;
|
||||||
|
@ -488,6 +495,8 @@ extern "C" {
|
||||||
pub fn Servo_StyleSet_Drop ( ptr : RawServoStyleSetOwned , ) ;
|
pub fn Servo_StyleSet_Drop ( ptr : RawServoStyleSetOwned , ) ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
pub fn Servo_SelectorList_Drop ( ptr : RawServoSelectorListOwned , ) ;
|
pub fn Servo_SelectorList_Drop ( ptr : RawServoSelectorListOwned , ) ;
|
||||||
|
} extern "C" {
|
||||||
|
pub fn Servo_SourceSizeList_Drop ( ptr : RawServoSourceSizeListOwned , ) ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
pub fn Gecko_IsInDocument ( node : RawGeckoNodeBorrowed , ) -> bool ;
|
pub fn Gecko_IsInDocument ( node : RawGeckoNodeBorrowed , ) -> bool ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
|
@ -1206,6 +1215,10 @@ extern "C" {
|
||||||
pub fn Servo_StyleSet_ResolveForDeclarations ( set : RawServoStyleSetBorrowed , parent_style : ServoStyleContextBorrowedOrNull , declarations : RawServoDeclarationBlockBorrowed , ) -> ServoStyleContextStrong ;
|
pub fn Servo_StyleSet_ResolveForDeclarations ( set : RawServoStyleSetBorrowed , parent_style : ServoStyleContextBorrowedOrNull , declarations : RawServoDeclarationBlockBorrowed , ) -> ServoStyleContextStrong ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
pub fn Servo_SelectorList_Parse ( selector_list : * const nsACString , ) -> * mut RawServoSelectorList ;
|
pub fn Servo_SelectorList_Parse ( selector_list : * const nsACString , ) -> * mut RawServoSelectorList ;
|
||||||
|
} extern "C" {
|
||||||
|
pub fn Servo_SourceSizeList_Parse ( value : * const nsACString , ) -> * mut RawServoSourceSizeList ;
|
||||||
|
} extern "C" {
|
||||||
|
pub fn Servo_SourceSizeList_Evaluate ( set : RawServoStyleSetBorrowed , arg1 : RawServoSourceSizeListBorrowedOrNull , ) -> i32 ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
pub fn Servo_SelectorList_Matches ( arg1 : RawGeckoElementBorrowed , arg2 : RawServoSelectorListBorrowed , ) -> bool ;
|
pub fn Servo_SelectorList_Matches ( arg1 : RawGeckoElementBorrowed , arg2 : RawServoSelectorListBorrowed , ) -> bool ;
|
||||||
} extern "C" {
|
} extern "C" {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -23,7 +23,7 @@
|
||||||
//! [cssparser]: ../cssparser/index.html
|
//! [cssparser]: ../cssparser/index.html
|
||||||
//! [selectors]: ../selectors/index.html
|
//! [selectors]: ../selectors/index.html
|
||||||
|
|
||||||
#![deny(warnings)]
|
// #![deny(warnings)]
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
// FIXME(bholley): We need to blanket-allow unsafe code in order to make the
|
// FIXME(bholley): We need to blanket-allow unsafe code in order to make the
|
||||||
|
|
|
@ -5,18 +5,22 @@
|
||||||
//! https://html.spec.whatwg.org/multipage/#source-size-list
|
//! https://html.spec.whatwg.org/multipage/#source-size-list
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use cssparser::Parser;
|
use cssparser::{Delimiter, Parser, Token};
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||||
use media_queries::{Device, Expression as MediaExpression};
|
use media_queries::{Device, Expression as MediaExpression};
|
||||||
use parser::{Parse, ParserContext};
|
use parser::{Parse, ParserContext};
|
||||||
use selectors::context::QuirksMode;
|
use selectors::context::QuirksMode;
|
||||||
use style_traits::ParseError;
|
use style_traits::ParseError;
|
||||||
use values::computed::{self, ToComputedValue};
|
use values::computed::{self, ToComputedValue};
|
||||||
use values::specified::Length;
|
use values::specified::{Length, NoCalcLength, ViewportPercentageLength};
|
||||||
|
|
||||||
/// A value for a `<source-size>`:
|
/// A value for a `<source-size>`:
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#source-size
|
/// https://html.spec.whatwg.org/multipage/#source-size
|
||||||
pub struct SourceSize {
|
pub struct SourceSize {
|
||||||
|
// FIXME(emilio): This should be a `MediaCondition`, and support `and` and
|
||||||
|
// `or`.
|
||||||
condition: MediaExpression,
|
condition: MediaExpression,
|
||||||
value: Length,
|
value: Length,
|
||||||
}
|
}
|
||||||
|
@ -38,10 +42,18 @@ impl Parse for SourceSize {
|
||||||
/// https://html.spec.whatwg.org/multipage/#source-size-list
|
/// https://html.spec.whatwg.org/multipage/#source-size-list
|
||||||
pub struct SourceSizeList {
|
pub struct SourceSizeList {
|
||||||
source_sizes: Vec<SourceSize>,
|
source_sizes: Vec<SourceSize>,
|
||||||
value: Length,
|
value: Option<Length>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SourceSizeList {
|
impl SourceSizeList {
|
||||||
|
/// Create an empty `SourceSizeList`, which can be used as a fall-back.
|
||||||
|
pub fn empty() -> Self {
|
||||||
|
Self {
|
||||||
|
source_sizes: vec![],
|
||||||
|
value: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Evaluate this <source-size-list> to get the final viewport length.
|
/// Evaluate this <source-size-list> to get the final viewport length.
|
||||||
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au {
|
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> Au {
|
||||||
let matching_source_size = self.source_sizes.iter().find(|source_size| {
|
let matching_source_size = self.source_sizes.iter().find(|source_size| {
|
||||||
|
@ -54,26 +66,80 @@ impl SourceSizeList {
|
||||||
source_size.value.to_computed_value(context)
|
source_size.value.to_computed_value(context)
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
self.value.to_computed_value(context)
|
match self.value {
|
||||||
|
Some(ref v) => v.to_computed_value(context),
|
||||||
|
None => {
|
||||||
|
Length::NoCalc(NoCalcLength::ViewportPercentage(
|
||||||
|
ViewportPercentageLength::Vw(100.)
|
||||||
|
)).to_computed_value(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).into()
|
}).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for SourceSizeList {
|
enum SourceSizeOrLength {
|
||||||
|
SourceSize(SourceSize),
|
||||||
|
Length(Length),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Parse for SourceSizeOrLength {
|
||||||
fn parse<'i, 't>(
|
fn parse<'i, 't>(
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
let source_sizes = input.try(|input| {
|
if let Ok(size) = input.try(|input| SourceSize::parse(context, input)) {
|
||||||
input.parse_comma_separated(|input| {
|
return Ok(SourceSizeOrLength::SourceSize(size));
|
||||||
SourceSize::parse(context, input)
|
}
|
||||||
})
|
|
||||||
}).unwrap_or(vec![]);
|
|
||||||
|
|
||||||
let value = Length::parse_non_negative(context, input)?;
|
let length = Length::parse_non_negative(context, input)?;
|
||||||
|
Ok(SourceSizeOrLength::Length(length))
|
||||||
Ok(Self { source_sizes, value })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SourceSizeList {
|
||||||
|
/// NOTE(emilio): This doesn't match the grammar in the spec, see:
|
||||||
|
///
|
||||||
|
/// https://html.spec.whatwg.org/multipage/#parsing-a-sizes-attribute
|
||||||
|
pub fn parse<'i, 't>(
|
||||||
|
context: &ParserContext,
|
||||||
|
input: &mut Parser<'i, 't>,
|
||||||
|
) -> Self {
|
||||||
|
let mut source_sizes = vec![];
|
||||||
|
|
||||||
|
loop {
|
||||||
|
let result = input.parse_until_before(Delimiter::Comma, |input| {
|
||||||
|
SourceSizeOrLength::parse(context, input)
|
||||||
|
});
|
||||||
|
|
||||||
|
match result {
|
||||||
|
Ok(SourceSizeOrLength::Length(value)) => {
|
||||||
|
return Self { source_sizes, value: Some(value) }
|
||||||
|
}
|
||||||
|
Ok(SourceSizeOrLength::SourceSize(source_size)) => {
|
||||||
|
source_sizes.push(source_size);
|
||||||
|
}
|
||||||
|
Err(..) => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
match input.next() {
|
||||||
|
Ok(&Token::Comma) => {},
|
||||||
|
Err(..) => break,
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceSizeList { source_sizes, value: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
unsafe impl HasFFI for SourceSizeList {
|
||||||
|
type FFIType = ::gecko_bindings::structs::RawServoSourceSizeList;
|
||||||
|
}
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
unsafe impl HasSimpleFFI for SourceSizeList {}
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
unsafe impl HasBoxFFI for SourceSizeList {}
|
||||||
|
|
|
@ -44,6 +44,7 @@ use style::gecko_bindings::bindings::{RawServoMediaRule, RawServoMediaRuleBorrow
|
||||||
use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed};
|
use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed};
|
||||||
use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed};
|
use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed};
|
||||||
use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSelectorListOwned};
|
use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSelectorListOwned};
|
||||||
|
use style::gecko_bindings::bindings::{RawServoSourceSizeListBorrowedOrNull, RawServoSourceSizeListOwned};
|
||||||
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned};
|
use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned};
|
||||||
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
|
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
|
||||||
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ServoStyleContextBorrowed};
|
use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ServoStyleContextBorrowed};
|
||||||
|
@ -95,6 +96,7 @@ use style::gecko_bindings::structs::OriginFlags_UserAgent;
|
||||||
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
|
||||||
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
use style::gecko_bindings::structs::RawGeckoPresContextOwned;
|
||||||
use style::gecko_bindings::structs::RawServoSelectorList;
|
use style::gecko_bindings::structs::RawServoSelectorList;
|
||||||
|
use style::gecko_bindings::structs::RawServoSourceSizeList;
|
||||||
use style::gecko_bindings::structs::SeenPtrs;
|
use style::gecko_bindings::structs::SeenPtrs;
|
||||||
use style::gecko_bindings::structs::ServoElementSnapshotTable;
|
use style::gecko_bindings::structs::ServoElementSnapshotTable;
|
||||||
use style::gecko_bindings::structs::ServoStyleSetSizes;
|
use style::gecko_bindings::structs::ServoStyleSetSizes;
|
||||||
|
@ -147,6 +149,7 @@ use style::values::computed::{Context, ToComputedValue};
|
||||||
use style::values::distance::ComputeSquaredDistance;
|
use style::values::distance::ComputeSquaredDistance;
|
||||||
use style::values::specified;
|
use style::values::specified;
|
||||||
use style::values::specified::gecko::IntersectionObserverRootMargin;
|
use style::values::specified::gecko::IntersectionObserverRootMargin;
|
||||||
|
use style::values::specified::source_size_list::SourceSizeList;
|
||||||
use style_traits::{ParsingMode, ToCss};
|
use style_traits::{ParsingMode, ToCss};
|
||||||
use super::error_reporter::ErrorReporter;
|
use super::error_reporter::ErrorReporter;
|
||||||
use super::stylesheet_loader::StylesheetLoader;
|
use super::stylesheet_loader::StylesheetLoader;
|
||||||
|
@ -4515,7 +4518,7 @@ pub unsafe extern "C" fn Servo_SelectorList_Parse(
|
||||||
|
|
||||||
debug_assert!(!selector_list.is_null());
|
debug_assert!(!selector_list.is_null());
|
||||||
|
|
||||||
let input = ::std::str::from_utf8_unchecked(&**selector_list);
|
let input = (*selector_list).as_str_unchecked();
|
||||||
let selector_list = match SelectorParser::parse_author_origin_no_namespace(&input) {
|
let selector_list = match SelectorParser::parse_author_origin_no_namespace(&input) {
|
||||||
Ok(selector_list) => selector_list,
|
Ok(selector_list) => selector_list,
|
||||||
Err(..) => return ptr::null_mut(),
|
Err(..) => return ptr::null_mut(),
|
||||||
|
@ -4627,3 +4630,50 @@ pub extern "C" fn Servo_ParseIntersectionObserverRootMargin(
|
||||||
Err(..) => false,
|
Err(..) => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn Servo_SourceSizeList_Parse(
|
||||||
|
value: *const nsACString,
|
||||||
|
) -> *mut RawServoSourceSizeList {
|
||||||
|
let value = (*value).as_str_unchecked();
|
||||||
|
let mut input = ParserInput::new(value);
|
||||||
|
let mut parser = Parser::new(&mut input);
|
||||||
|
|
||||||
|
let context = ParserContext::new(
|
||||||
|
Origin::Author,
|
||||||
|
dummy_url_data(),
|
||||||
|
Some(CssRuleType::Style),
|
||||||
|
ParsingMode::DEFAULT,
|
||||||
|
QuirksMode::NoQuirks,
|
||||||
|
);
|
||||||
|
|
||||||
|
// NB: Intentionally not calling parse_entirely.
|
||||||
|
let list = SourceSizeList::parse(&context, &mut parser);
|
||||||
|
Box::into_raw(Box::new(list)) as *mut _
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn Servo_SourceSizeList_Evaluate(
|
||||||
|
raw_data: RawServoStyleSetBorrowed,
|
||||||
|
list: RawServoSourceSizeListBorrowedOrNull,
|
||||||
|
) -> i32 {
|
||||||
|
let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||||
|
let device = doc_data.stylist.device();
|
||||||
|
let quirks_mode = doc_data.stylist.quirks_mode();
|
||||||
|
|
||||||
|
let result = match list {
|
||||||
|
Some(list) => {
|
||||||
|
SourceSizeList::from_ffi(list).evaluate(device, quirks_mode)
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
SourceSizeList::empty().evaluate(device, quirks_mode)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
result.0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub unsafe extern "C" fn Servo_SourceSizeList_Drop(list: RawServoSourceSizeListOwned) {
|
||||||
|
let _ = list.into_box::<SourceSizeList>();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue