mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #16686 - aethanyc:bug1321754, r=heycam
stylo: Parse eSafeAgentSheetFeatures as agent sheet This was reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1321754 <!-- 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/16686) <!-- Reviewable:end -->
This commit is contained in:
commit
f284a15e4b
3 changed files with 22 additions and 0 deletions
|
@ -5293,18 +5293,28 @@ pub mod root {
|
||||||
* exposure on the public Web, but are very useful for expressing
|
* exposure on the public Web, but are very useful for expressing
|
||||||
* user style overrides, such as @-moz-document rules.
|
* user style overrides, such as @-moz-document rules.
|
||||||
*
|
*
|
||||||
|
* XXX: eUserSheetFeatures was added in bug 1035091, but some patches in
|
||||||
|
* that bug never landed to use this enum value. Currently, all the features
|
||||||
|
* in user sheet are also available in author sheet.
|
||||||
|
*
|
||||||
* Agent sheets have access to all author- and user-sheet features
|
* Agent sheets have access to all author- and user-sheet features
|
||||||
* plus more extensions that are necessary for internal use but,
|
* plus more extensions that are necessary for internal use but,
|
||||||
* again, not yet suitable for exposure on the public Web. Some of
|
* again, not yet suitable for exposure on the public Web. Some of
|
||||||
* these are outright unsafe to expose; in particular, incorrect
|
* these are outright unsafe to expose; in particular, incorrect
|
||||||
* styling of anonymous box pseudo-elements can violate layout
|
* styling of anonymous box pseudo-elements can violate layout
|
||||||
* invariants.
|
* invariants.
|
||||||
|
*
|
||||||
|
* Agent sheets that do not use any unsafe rules could use
|
||||||
|
* eSafeAgentSheetFeatures when creating the sheet. This enum value allows
|
||||||
|
* Servo backend to recognize the sheets as the agent level, but Gecko
|
||||||
|
* backend will parse it under _author_ level.
|
||||||
*/
|
*/
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum SheetParsingMode {
|
pub enum SheetParsingMode {
|
||||||
eAuthorSheetFeatures = 0,
|
eAuthorSheetFeatures = 0,
|
||||||
eUserSheetFeatures = 1,
|
eUserSheetFeatures = 1,
|
||||||
eAgentSheetFeatures = 2,
|
eAgentSheetFeatures = 2,
|
||||||
|
eSafeAgentSheetFeatures = 3,
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -5222,18 +5222,28 @@ pub mod root {
|
||||||
* exposure on the public Web, but are very useful for expressing
|
* exposure on the public Web, but are very useful for expressing
|
||||||
* user style overrides, such as @-moz-document rules.
|
* user style overrides, such as @-moz-document rules.
|
||||||
*
|
*
|
||||||
|
* XXX: eUserSheetFeatures was added in bug 1035091, but some patches in
|
||||||
|
* that bug never landed to use this enum value. Currently, all the features
|
||||||
|
* in user sheet are also available in author sheet.
|
||||||
|
*
|
||||||
* Agent sheets have access to all author- and user-sheet features
|
* Agent sheets have access to all author- and user-sheet features
|
||||||
* plus more extensions that are necessary for internal use but,
|
* plus more extensions that are necessary for internal use but,
|
||||||
* again, not yet suitable for exposure on the public Web. Some of
|
* again, not yet suitable for exposure on the public Web. Some of
|
||||||
* these are outright unsafe to expose; in particular, incorrect
|
* these are outright unsafe to expose; in particular, incorrect
|
||||||
* styling of anonymous box pseudo-elements can violate layout
|
* styling of anonymous box pseudo-elements can violate layout
|
||||||
* invariants.
|
* invariants.
|
||||||
|
*
|
||||||
|
* Agent sheets that do not use any unsafe rules could use
|
||||||
|
* eSafeAgentSheetFeatures when creating the sheet. This enum value allows
|
||||||
|
* Servo backend to recognize the sheets as the agent level, but Gecko
|
||||||
|
* backend will parse it under _author_ level.
|
||||||
*/
|
*/
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum SheetParsingMode {
|
pub enum SheetParsingMode {
|
||||||
eAuthorSheetFeatures = 0,
|
eAuthorSheetFeatures = 0,
|
||||||
eUserSheetFeatures = 1,
|
eUserSheetFeatures = 1,
|
||||||
eAgentSheetFeatures = 2,
|
eAgentSheetFeatures = 2,
|
||||||
|
eSafeAgentSheetFeatures = 3,
|
||||||
}
|
}
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -509,6 +509,7 @@ pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyl
|
||||||
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
||||||
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
||||||
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
||||||
|
SheetParsingMode::eSafeAgentSheetFeatures => Origin::UserAgent,
|
||||||
};
|
};
|
||||||
let shared_lock = global_style_data.shared_lock.clone();
|
let shared_lock = global_style_data.shared_lock.clone();
|
||||||
Arc::new(Stylesheet::from_str(
|
Arc::new(Stylesheet::from_str(
|
||||||
|
@ -533,6 +534,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader,
|
||||||
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
|
||||||
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
SheetParsingMode::eUserSheetFeatures => Origin::User,
|
||||||
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
|
||||||
|
SheetParsingMode::eSafeAgentSheetFeatures => Origin::UserAgent,
|
||||||
};
|
};
|
||||||
|
|
||||||
let url_data = unsafe { RefPtr::from_ptr_ref(&extra_data) };
|
let url_data = unsafe { RefPtr::from_ptr_ref(&extra_data) };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue