mirror of
https://github.com/servo/servo.git
synced 2025-07-05 14:33:38 +01:00
Auto merge of #18924 - mbrubeck:doc, r=Manishearth
Fix commonmark Markdown warnings in docs, part 1 Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is passed to rustdoc. This is mostly a global find-and-replace for bare URIs on lines by themselves in doc comments. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they are doc formatting changes only <!-- 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/18924) <!-- Reviewable:end -->
This commit is contained in:
commit
0e62a5829b
137 changed files with 572 additions and 565 deletions
|
@ -865,7 +865,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://w3c.github.io/touch-events/#mouse-events
|
/// <http://w3c.github.io/touch-events/#mouse-events>
|
||||||
fn simulate_mouse_click(&mut self, p: TypedPoint2D<f32, DevicePixel>) {
|
fn simulate_mouse_click(&mut self, p: TypedPoint2D<f32, DevicePixel>) {
|
||||||
let button = MouseButton::Left;
|
let button = MouseButton::Left;
|
||||||
self.dispatch_mouse_window_move_event_class(p);
|
self.dispatch_mouse_window_move_event_class(p);
|
||||||
|
|
|
@ -40,6 +40,7 @@ pub struct Opts {
|
||||||
pub device_pixels_per_px: Option<f32>,
|
pub device_pixels_per_px: Option<f32>,
|
||||||
|
|
||||||
/// `None` to disable the time profiler or `Some` to enable it with:
|
/// `None` to disable the time profiler or `Some` to enable it with:
|
||||||
|
///
|
||||||
/// - an interval in seconds to cause it to produce output on that interval.
|
/// - an interval in seconds to cause it to produce output on that interval.
|
||||||
/// (`i.e. -p 5`).
|
/// (`i.e. -p 5`).
|
||||||
/// - a file path to write profiling info to a TSV file upon Servo's termination.
|
/// - a file path to write profiling info to a TSV file upon Servo's termination.
|
||||||
|
@ -68,7 +69,7 @@ pub struct Opts {
|
||||||
pub output_file: Option<String>,
|
pub output_file: Option<String>,
|
||||||
|
|
||||||
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
||||||
/// See https://github.com/servo/servo/issues/6564
|
/// See <https://github.com/servo/servo/issues/6564>
|
||||||
pub replace_surrogates: bool,
|
pub replace_surrogates: bool,
|
||||||
|
|
||||||
/// Log GC passes and their durations.
|
/// Log GC passes and their durations.
|
||||||
|
@ -296,7 +297,7 @@ pub struct DebugOptions {
|
||||||
pub convert_mouse_to_touch: bool,
|
pub convert_mouse_to_touch: bool,
|
||||||
|
|
||||||
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
/// Replace unpaires surrogates in DOM strings with U+FFFD.
|
||||||
/// See https://github.com/servo/servo/issues/6564
|
/// See <https://github.com/servo/servo/issues/6564>
|
||||||
pub replace_surrogates: bool,
|
pub replace_surrogates: bool,
|
||||||
|
|
||||||
/// Log GC passes and their durations.
|
/// Log GC passes and their durations.
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl BrowsingContext {
|
||||||
/// When we operate on the joint session history, entries are sorted chronologically,
|
/// When we operate on the joint session history, entries are sorted chronologically,
|
||||||
/// so we timestamp the entries by when the entry was added to the session history.
|
/// so we timestamp the entries by when the entry was added to the session history.
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#session-history-entry
|
/// <https://html.spec.whatwg.org/multipage/#session-history-entry>
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SessionHistoryEntry {
|
pub struct SessionHistoryEntry {
|
||||||
/// The timestamp for when the session history entry was created
|
/// The timestamp for when the session history entry was created
|
||||||
|
|
|
@ -12,7 +12,7 @@ use script_traits::ConstellationControlMsg;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#event-loop
|
/// <https://html.spec.whatwg.org/multipage/#event-loop>
|
||||||
pub struct EventLoop {
|
pub struct EventLoop {
|
||||||
script_chan: IpcSender<ConstellationControlMsg>,
|
script_chan: IpcSender<ConstellationControlMsg>,
|
||||||
dont_send_or_sync: PhantomData<Rc<()>>,
|
dont_send_or_sync: PhantomData<Rc<()>>,
|
||||||
|
|
|
@ -858,7 +858,7 @@ fn get_ellipse_radius<F>(size: &Size2D<Au>, center: &Point2D<Au>, cmp: F) -> Siz
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines the radius of a circle if it was not explictly provided.
|
/// Determines the radius of a circle if it was not explictly provided.
|
||||||
/// https://drafts.csswg.org/css-images-3/#typedef-size
|
/// <https://drafts.csswg.org/css-images-3/#typedef-size>
|
||||||
fn convert_circle_size_keyword(keyword: ShapeExtent,
|
fn convert_circle_size_keyword(keyword: ShapeExtent,
|
||||||
size: &Size2D<Au>,
|
size: &Size2D<Au>,
|
||||||
center: &Point2D<Au>) -> Size2D<Au> {
|
center: &Point2D<Au>) -> Size2D<Au> {
|
||||||
|
@ -882,7 +882,7 @@ fn convert_circle_size_keyword(keyword: ShapeExtent,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Determines the radius of an ellipse if it was not explictly provided.
|
/// Determines the radius of an ellipse if it was not explictly provided.
|
||||||
/// https://drafts.csswg.org/css-images-3/#typedef-size
|
/// <https://drafts.csswg.org/css-images-3/#typedef-size>
|
||||||
fn convert_ellipse_size_keyword(keyword: ShapeExtent,
|
fn convert_ellipse_size_keyword(keyword: ShapeExtent,
|
||||||
size: &Size2D<Au>,
|
size: &Size2D<Au>,
|
||||||
center: &Point2D<Au>) -> Size2D<Au> {
|
center: &Point2D<Au>) -> Size2D<Au> {
|
||||||
|
|
|
@ -264,7 +264,7 @@ impl FlexLine {
|
||||||
/// This method implements the flexible lengths resolving algorithm.
|
/// This method implements the flexible lengths resolving algorithm.
|
||||||
/// The 'collapse' parameter is used to indicate whether items with 'visibility: collapse'
|
/// The 'collapse' parameter is used to indicate whether items with 'visibility: collapse'
|
||||||
/// is included in length resolving. The result main size is stored in 'item.main_size'.
|
/// is included in length resolving. The result main size is stored in 'item.main_size'.
|
||||||
/// https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths
|
/// <https://drafts.csswg.org/css-flexbox/#resolve-flexible-lengths>
|
||||||
pub fn flex_resolve(&mut self, items: &mut [FlexItem], collapse: bool) {
|
pub fn flex_resolve(&mut self, items: &mut [FlexItem], collapse: bool) {
|
||||||
let mut total_grow = 0.0;
|
let mut total_grow = 0.0;
|
||||||
let mut total_shrink = 0.0;
|
let mut total_shrink = 0.0;
|
||||||
|
|
|
@ -679,7 +679,7 @@ pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layou
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the resolved value of property for a given (pseudo)element.
|
/// Return the resolved value of property for a given (pseudo)element.
|
||||||
/// https://drafts.csswg.org/cssom/#resolved-value
|
/// <https://drafts.csswg.org/cssom/#resolved-value>
|
||||||
pub fn process_resolved_style_request<'a, N>(context: &LayoutContext,
|
pub fn process_resolved_style_request<'a, N>(context: &LayoutContext,
|
||||||
node: N,
|
node: N,
|
||||||
pseudo: &Option<PseudoElement>,
|
pseudo: &Option<PseudoElement>,
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl Cookie {
|
||||||
.unwrap_or(None)
|
.unwrap_or(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://tools.ietf.org/html/rfc6265#section-5.3
|
/// <http://tools.ietf.org/html/rfc6265#section-5.3>
|
||||||
pub fn new_wrapped(mut cookie: cookie_rs::Cookie<'static>, request: &ServoUrl, source: CookieSource)
|
pub fn new_wrapped(mut cookie: cookie_rs::Cookie<'static>, request: &ServoUrl, source: CookieSource)
|
||||||
-> Option<Cookie> {
|
-> Option<Cookie> {
|
||||||
// Step 3
|
// Step 3
|
||||||
|
|
|
@ -494,7 +494,7 @@ fn scheme_fetch(request: &mut Request,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#cors-safelisted-request-header
|
/// <https://fetch.spec.whatwg.org/#cors-safelisted-request-header>
|
||||||
pub fn is_cors_safelisted_request_header(h: &HeaderView) -> bool {
|
pub fn is_cors_safelisted_request_header(h: &HeaderView) -> bool {
|
||||||
if h.is::<ContentType>() {
|
if h.is::<ContentType>() {
|
||||||
match h.value() {
|
match h.value() {
|
||||||
|
@ -509,7 +509,7 @@ pub fn is_cors_safelisted_request_header(h: &HeaderView) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#cors-safelisted-method
|
/// <https://fetch.spec.whatwg.org/#cors-safelisted-method>
|
||||||
pub fn is_cors_safelisted_method(m: &Method) -> bool {
|
pub fn is_cors_safelisted_method(m: &Method) -> bool {
|
||||||
match *m {
|
match *m {
|
||||||
Method::Get | Method::Head | Method::Post => true,
|
Method::Get | Method::Head | Method::Post => true,
|
||||||
|
@ -528,9 +528,9 @@ fn is_null_body_status(status: &Option<StatusCode>) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?
|
/// <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-nosniff?>
|
||||||
pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &Headers) -> bool {
|
pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &Headers) -> bool {
|
||||||
/// https://fetch.spec.whatwg.org/#x-content-type-options-header
|
/// <https://fetch.spec.whatwg.org/#x-content-type-options-header>
|
||||||
/// This is needed to parse `X-Content-Type-Options` according to spec,
|
/// This is needed to parse `X-Content-Type-Options` according to spec,
|
||||||
/// which requires that we inspect only the first value.
|
/// which requires that we inspect only the first value.
|
||||||
///
|
///
|
||||||
|
@ -572,7 +572,7 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
|
||||||
// Note: an invalid MIME type will produce a `None`.
|
// Note: an invalid MIME type will produce a `None`.
|
||||||
let content_type_header = response_headers.get::<ContentType>();
|
let content_type_header = response_headers.get::<ContentType>();
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#scriptingLanguages
|
/// <https://html.spec.whatwg.org/multipage/#scriptingLanguages>
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_javascript_mime_type(mime_type: &Mime) -> bool {
|
fn is_javascript_mime_type(mime_type: &Mime) -> bool {
|
||||||
let javascript_mime_types: [Mime; 16] = [
|
let javascript_mime_types: [Mime; 16] = [
|
||||||
|
@ -619,7 +619,7 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?
|
/// <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?>
|
||||||
fn should_be_blocked_due_to_mime_type(request_type: Type, response_headers: &Headers) -> bool {
|
fn should_be_blocked_due_to_mime_type(request_type: Type, response_headers: &Headers) -> bool {
|
||||||
let mime_type = match response_headers.get::<ContentType>() {
|
let mime_type = match response_headers.get::<ContentType>() {
|
||||||
Some(header) => header,
|
Some(header) => header,
|
||||||
|
@ -634,7 +634,7 @@ fn should_be_blocked_due_to_mime_type(request_type: Type, response_headers: &Hea
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#block-bad-port
|
/// <https://fetch.spec.whatwg.org/#block-bad-port>
|
||||||
pub fn should_be_blocked_due_to_bad_port(url: &ServoUrl) -> bool {
|
pub fn should_be_blocked_due_to_bad_port(url: &ServoUrl) -> bool {
|
||||||
// Step 1 is not applicable, this function just takes the URL directly.
|
// Step 1 is not applicable, this function just takes the URL directly.
|
||||||
|
|
||||||
|
@ -662,12 +662,12 @@ pub fn should_be_blocked_due_to_bad_port(url: &ServoUrl) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#network-scheme
|
/// <https://fetch.spec.whatwg.org/#network-scheme>
|
||||||
fn is_network_scheme(scheme: &str) -> bool {
|
fn is_network_scheme(scheme: &str) -> bool {
|
||||||
scheme == "ftp" || scheme == "http" || scheme == "https"
|
scheme == "ftp" || scheme == "http" || scheme == "https"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#bad-port
|
/// <https://fetch.spec.whatwg.org/#bad-port>
|
||||||
fn is_bad_port(port: u16) -> bool {
|
fn is_bad_port(port: u16) -> bool {
|
||||||
static BAD_PORTS: [u16; 64] = [
|
static BAD_PORTS: [u16; 64] = [
|
||||||
1, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 25, 37, 42,
|
1, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 25, 37, 42,
|
||||||
|
|
|
@ -193,7 +193,7 @@ pub fn set_default_accept_language(headers: &mut Headers) {
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-state-no-referrer-when-downgrade
|
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-state-no-referrer-when-downgrade>
|
||||||
fn no_referrer_when_downgrade_header(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
fn no_referrer_when_downgrade_header(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
||||||
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
||||||
return None;
|
return None;
|
||||||
|
@ -201,7 +201,7 @@ fn no_referrer_when_downgrade_header(referrer_url: ServoUrl, url: ServoUrl) -> O
|
||||||
return strip_url(referrer_url, false);
|
return strip_url(referrer_url, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin
|
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin>
|
||||||
fn strict_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
fn strict_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
||||||
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
||||||
return None;
|
return None;
|
||||||
|
@ -209,7 +209,7 @@ fn strict_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
||||||
strip_url(referrer_url, true)
|
strip_url(referrer_url, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin
|
/// <https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin>
|
||||||
fn strict_origin_when_cross_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
fn strict_origin_when_cross_origin(referrer_url: ServoUrl, url: ServoUrl) -> Option<ServoUrl> {
|
||||||
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
if referrer_url.scheme() == "https" && url.scheme() != "https" {
|
||||||
return None;
|
return None;
|
||||||
|
@ -218,7 +218,7 @@ fn strict_origin_when_cross_origin(referrer_url: ServoUrl, url: ServoUrl) -> Opt
|
||||||
strip_url(referrer_url, cross_origin)
|
strip_url(referrer_url, cross_origin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#strip-url
|
/// <https://w3c.github.io/webappsec-referrer-policy/#strip-url>
|
||||||
fn strip_url(mut referrer_url: ServoUrl, origin_only: bool) -> Option<ServoUrl> {
|
fn strip_url(mut referrer_url: ServoUrl, origin_only: bool) -> Option<ServoUrl> {
|
||||||
if referrer_url.scheme() == "https" || referrer_url.scheme() == "http" {
|
if referrer_url.scheme() == "https" || referrer_url.scheme() == "http" {
|
||||||
{
|
{
|
||||||
|
@ -236,7 +236,7 @@ fn strip_url(mut referrer_url: ServoUrl, origin_only: bool) -> Option<ServoUrl>
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
|
/// <https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer>
|
||||||
/// Steps 4-6.
|
/// Steps 4-6.
|
||||||
pub fn determine_request_referrer(headers: &mut Headers,
|
pub fn determine_request_referrer(headers: &mut Headers,
|
||||||
referrer_policy: ReferrerPolicy,
|
referrer_policy: ReferrerPolicy,
|
||||||
|
@ -1376,7 +1376,7 @@ fn response_needs_revalidation(_response: &Response) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#redirect-status
|
/// <https://fetch.spec.whatwg.org/#redirect-status>
|
||||||
pub fn is_redirect_status(status: StatusCode) -> bool {
|
pub fn is_redirect_status(status: StatusCode) -> bool {
|
||||||
match status {
|
match status {
|
||||||
StatusCode::MovedPermanently |
|
StatusCode::MovedPermanently |
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub enum ApacheBugFlag {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ApacheBugFlag {
|
impl ApacheBugFlag {
|
||||||
/// https://mimesniff.spec.whatwg.org/#supplied-mime-type-detection-algorithm
|
/// <https://mimesniff.spec.whatwg.org/#supplied-mime-type-detection-algorithm>
|
||||||
pub fn from_content_type(last_raw_content_type: &[u8]) -> ApacheBugFlag {
|
pub fn from_content_type(last_raw_content_type: &[u8]) -> ApacheBugFlag {
|
||||||
if last_raw_content_type == b"text/plain"
|
if last_raw_content_type == b"text/plain"
|
||||||
|| last_raw_content_type == b"text/plain; charset=ISO-8859-1"
|
|| last_raw_content_type == b"text/plain; charset=ISO-8859-1"
|
||||||
|
|
|
@ -16,7 +16,7 @@ const SUPPORTED_ALGORITHM: &'static [&'static str] = &[
|
||||||
pub type StaticCharVec = &'static [char];
|
pub type StaticCharVec = &'static [char];
|
||||||
/// A "space character" according to:
|
/// A "space character" according to:
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#space-character
|
/// <https://html.spec.whatwg.org/multipage/#space-character>
|
||||||
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
||||||
'\u{0020}',
|
'\u{0020}',
|
||||||
'\u{0009}',
|
'\u{0009}',
|
||||||
|
@ -44,7 +44,7 @@ impl SriEntry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#parse-metadata>
|
||||||
pub fn parsed_metadata(integrity_metadata: &str) -> Vec<SriEntry> {
|
pub fn parsed_metadata(integrity_metadata: &str) -> Vec<SriEntry> {
|
||||||
// Step 1
|
// Step 1
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
|
@ -77,7 +77,7 @@ pub fn parsed_metadata(integrity_metadata: &str) -> Vec<SriEntry> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#getprioritizedhashfunction
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#getprioritizedhashfunction>
|
||||||
pub fn get_prioritized_hash_function(hash_func_left: &str, hash_func_right: &str) -> Option<String> {
|
pub fn get_prioritized_hash_function(hash_func_left: &str, hash_func_right: &str) -> Option<String> {
|
||||||
let left_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_left).unwrap();
|
let left_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_left).unwrap();
|
||||||
let right_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_right).unwrap();
|
let right_priority = SUPPORTED_ALGORITHM.iter().position(|s| s.to_owned() == hash_func_right).unwrap();
|
||||||
|
@ -93,7 +93,7 @@ pub fn get_prioritized_hash_function(hash_func_left: &str, hash_func_right: &str
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#get-the-strongest-metadata
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#get-the-strongest-metadata>
|
||||||
pub fn get_strongest_metadata(integrity_metadata_list: Vec<SriEntry>) -> Vec<SriEntry> {
|
pub fn get_strongest_metadata(integrity_metadata_list: Vec<SriEntry>) -> Vec<SriEntry> {
|
||||||
let mut result: Vec<SriEntry> = vec![integrity_metadata_list[0].clone()];
|
let mut result: Vec<SriEntry> = vec![integrity_metadata_list[0].clone()];
|
||||||
let mut current_algorithm = result[0].alg.clone();
|
let mut current_algorithm = result[0].alg.clone();
|
||||||
|
@ -114,7 +114,7 @@ pub fn get_strongest_metadata(integrity_metadata_list: Vec<SriEntry>) -> Vec<Sri
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#apply-algorithm-to-response
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#apply-algorithm-to-response>
|
||||||
fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
|
fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
|
||||||
message_digest: MessageDigest)
|
message_digest: MessageDigest)
|
||||||
-> String {
|
-> String {
|
||||||
|
@ -126,7 +126,7 @@ fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#is-response-eligible
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#is-response-eligible>
|
||||||
fn is_eligible_for_integrity_validation(response: &Response) -> bool {
|
fn is_eligible_for_integrity_validation(response: &Response) -> bool {
|
||||||
match response.response_type {
|
match response.response_type {
|
||||||
ResponseType::Basic | ResponseType::Default | ResponseType::Cors => true,
|
ResponseType::Basic | ResponseType::Default | ResponseType::Cors => true,
|
||||||
|
@ -134,7 +134,7 @@ fn is_eligible_for_integrity_validation(response: &Response) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist
|
/// <https://w3c.github.io/webappsec-subresource-integrity/#does-response-match-metadatalist>
|
||||||
pub fn is_response_integrity_valid(integrity_metadata: &str, response: &Response) -> bool {
|
pub fn is_response_integrity_valid(integrity_metadata: &str, response: &Response) -> bool {
|
||||||
let parsed_metadata_list: Vec<SriEntry> = parsed_metadata(integrity_metadata);
|
let parsed_metadata_list: Vec<SriEntry> = parsed_metadata(integrity_metadata);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ pub struct BlobBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse URL as Blob URL scheme's definition
|
/// Parse URL as Blob URL scheme's definition
|
||||||
/// https://w3c.github.io/FileAPI/#DefinitionOfScheme
|
///
|
||||||
|
/// <https://w3c.github.io/FileAPI/#DefinitionOfScheme>
|
||||||
pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {
|
pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {
|
||||||
let url_inner = Url::parse(url.path()).map_err(|_| ())?;
|
let url_inner = Url::parse(url.path()).map_err(|_| ())?;
|
||||||
let id = {
|
let id = {
|
||||||
|
@ -47,6 +48,7 @@ pub fn parse_blob_url(url: &ServoUrl) -> Result<(Uuid, FileOrigin), ()> {
|
||||||
|
|
||||||
/// Given an URL, returning the Origin that a Blob created under this
|
/// Given an URL, returning the Origin that a Blob created under this
|
||||||
/// URL should have.
|
/// URL should have.
|
||||||
|
///
|
||||||
/// HACK(izgzhen): Not well-specified on spec, and it is a bit a hack
|
/// HACK(izgzhen): Not well-specified on spec, and it is a bit a hack
|
||||||
/// both due to ambiguity of spec and that we have to serialization the
|
/// both due to ambiguity of spec and that we have to serialization the
|
||||||
/// Origin here.
|
/// Origin here.
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub type FileOrigin = String;
|
||||||
|
|
||||||
/// Relative slice positions of a sequence,
|
/// Relative slice positions of a sequence,
|
||||||
/// whose semantic should be consistent with (start, end) parameters in
|
/// whose semantic should be consistent with (start, end) parameters in
|
||||||
/// https://w3c.github.io/FileAPI/#dfn-slice
|
/// <https://w3c.github.io/FileAPI/#dfn-slice>
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
pub struct RelativePos {
|
pub struct RelativePos {
|
||||||
/// Relative to first byte if non-negative,
|
/// Relative to first byte if non-negative,
|
||||||
|
@ -59,7 +59,7 @@ impl RelativePos {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute absolute range by giving the total size
|
/// Compute absolute range by giving the total size
|
||||||
/// https://w3c.github.io/FileAPI/#slice-method-algo
|
/// <https://w3c.github.io/FileAPI/#slice-method-algo>
|
||||||
pub fn to_abs_range(&self, size: usize) -> Range<usize> {
|
pub fn to_abs_range(&self, size: usize) -> Range<usize> {
|
||||||
let size = size as i64;
|
let size = size as i64;
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub mod image {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A loading context, for context-specific sniffing, as defined in
|
/// A loading context, for context-specific sniffing, as defined in
|
||||||
/// https://mimesniff.spec.whatwg.org/#context-specific-sniffing
|
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
|
||||||
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub enum LoadContext {
|
pub enum LoadContext {
|
||||||
Browsing,
|
Browsing,
|
||||||
|
@ -159,17 +159,17 @@ pub enum FetchResponseMsg {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FetchTaskTarget {
|
pub trait FetchTaskTarget {
|
||||||
/// https://fetch.spec.whatwg.org/#process-request-body
|
/// <https://fetch.spec.whatwg.org/#process-request-body>
|
||||||
///
|
///
|
||||||
/// Fired when a chunk of the request body is transmitted
|
/// Fired when a chunk of the request body is transmitted
|
||||||
fn process_request_body(&mut self, request: &Request);
|
fn process_request_body(&mut self, request: &Request);
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#process-request-end-of-file
|
/// <https://fetch.spec.whatwg.org/#process-request-end-of-file>
|
||||||
///
|
///
|
||||||
/// Fired when the entire request finishes being transmitted
|
/// Fired when the entire request finishes being transmitted
|
||||||
fn process_request_eof(&mut self, request: &Request);
|
fn process_request_eof(&mut self, request: &Request);
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#process-response
|
/// <https://fetch.spec.whatwg.org/#process-response>
|
||||||
///
|
///
|
||||||
/// Fired when headers are received
|
/// Fired when headers are received
|
||||||
fn process_response(&mut self, response: &Response);
|
fn process_response(&mut self, response: &Response);
|
||||||
|
@ -177,7 +177,7 @@ pub trait FetchTaskTarget {
|
||||||
/// Fired when a chunk of response content is received
|
/// Fired when a chunk of response content is received
|
||||||
fn process_response_chunk(&mut self, chunk: Vec<u8>);
|
fn process_response_chunk(&mut self, chunk: Vec<u8>);
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#process-response-end-of-file
|
/// <https://fetch.spec.whatwg.org/#process-response-end-of-file>
|
||||||
///
|
///
|
||||||
/// Fired when the response is fully fetched
|
/// Fired when the response is fully fetched
|
||||||
fn process_response_eof(&mut self, response: &Response);
|
fn process_response_eof(&mut self, response: &Response);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//! The list is a file located on the `resources` folder and loaded once on first need.
|
//! The list is a file located on the `resources` folder and loaded once on first need.
|
||||||
//!
|
//!
|
||||||
//! The list can be updated with `./mach update-pub-domains` from this source:
|
//! The list can be updated with `./mach update-pub-domains` from this source:
|
||||||
//! https://publicsuffix.org/list/
|
//! <https://publicsuffix.org/list/>
|
||||||
//!
|
//!
|
||||||
//! This implementation is not strictly following the specification of the list. Wildcards are not
|
//! This implementation is not strictly following the specification of the list. Wildcards are not
|
||||||
//! restricted to appear only in the leftmost position, but the current list has no such cases so
|
//! restricted to appear only in the leftmost position, but the current list has no such cases so
|
||||||
|
|
|
@ -201,64 +201,64 @@ impl Default for RequestInit {
|
||||||
/// the Fetch spec.
|
/// the Fetch spec.
|
||||||
#[derive(Clone, HeapSizeOf)]
|
#[derive(Clone, HeapSizeOf)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-method
|
/// <https://fetch.spec.whatwg.org/#concept-request-method>
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_heap_size_of = "Defined in hyper"]
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
/// https://fetch.spec.whatwg.org/#local-urls-only-flag
|
/// <https://fetch.spec.whatwg.org/#local-urls-only-flag>
|
||||||
pub local_urls_only: bool,
|
pub local_urls_only: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag
|
/// <https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag>
|
||||||
pub sandboxed_storage_area_urls: bool,
|
pub sandboxed_storage_area_urls: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-header-list
|
/// <https://fetch.spec.whatwg.org/#concept-request-header-list>
|
||||||
#[ignore_heap_size_of = "Defined in hyper"]
|
#[ignore_heap_size_of = "Defined in hyper"]
|
||||||
pub headers: Headers,
|
pub headers: Headers,
|
||||||
/// https://fetch.spec.whatwg.org/#unsafe-request-flag
|
/// <https://fetch.spec.whatwg.org/#unsafe-request-flag>
|
||||||
pub unsafe_request: bool,
|
pub unsafe_request: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-body
|
/// <https://fetch.spec.whatwg.org/#concept-request-body>
|
||||||
pub body: Option<Vec<u8>>,
|
pub body: Option<Vec<u8>>,
|
||||||
// TODO: client object
|
// TODO: client object
|
||||||
pub window: Window,
|
pub window: Window,
|
||||||
// TODO: target browsing context
|
// TODO: target browsing context
|
||||||
/// https://fetch.spec.whatwg.org/#request-keepalive-flag
|
/// <https://fetch.spec.whatwg.org/#request-keepalive-flag>
|
||||||
pub keep_alive: bool,
|
pub keep_alive: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#request-service-workers-mode
|
/// <https://fetch.spec.whatwg.org/#request-service-workers-mode>
|
||||||
pub service_workers_mode: ServiceWorkersMode,
|
pub service_workers_mode: ServiceWorkersMode,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-initiator
|
/// <https://fetch.spec.whatwg.org/#concept-request-initiator>
|
||||||
pub initiator: Initiator,
|
pub initiator: Initiator,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-type
|
/// <https://fetch.spec.whatwg.org/#concept-request-type>
|
||||||
pub type_: Type,
|
pub type_: Type,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-destination
|
/// <https://fetch.spec.whatwg.org/#concept-request-destination>
|
||||||
pub destination: Destination,
|
pub destination: Destination,
|
||||||
// TODO: priority object
|
// TODO: priority object
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-origin
|
/// <https://fetch.spec.whatwg.org/#concept-request-origin>
|
||||||
pub origin: Origin,
|
pub origin: Origin,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-referrer
|
/// <https://fetch.spec.whatwg.org/#concept-request-referrer>
|
||||||
pub referrer: Referrer,
|
pub referrer: Referrer,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
|
/// <https://fetch.spec.whatwg.org/#concept-request-referrer-policy>
|
||||||
pub referrer_policy: Option<ReferrerPolicy>,
|
pub referrer_policy: Option<ReferrerPolicy>,
|
||||||
pub pipeline_id: Option<PipelineId>,
|
pub pipeline_id: Option<PipelineId>,
|
||||||
/// https://fetch.spec.whatwg.org/#synchronous-flag
|
/// <https://fetch.spec.whatwg.org/#synchronous-flag>
|
||||||
pub synchronous: bool,
|
pub synchronous: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-mode
|
/// <https://fetch.spec.whatwg.org/#concept-request-mode>
|
||||||
pub mode: RequestMode,
|
pub mode: RequestMode,
|
||||||
/// https://fetch.spec.whatwg.org/#use-cors-preflight-flag
|
/// <https://fetch.spec.whatwg.org/#use-cors-preflight-flag>
|
||||||
pub use_cors_preflight: bool,
|
pub use_cors_preflight: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-credentials-mode
|
/// <https://fetch.spec.whatwg.org/#concept-request-credentials-mode>
|
||||||
pub credentials_mode: CredentialsMode,
|
pub credentials_mode: CredentialsMode,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag
|
/// <https://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag>
|
||||||
pub use_url_credentials: bool,
|
pub use_url_credentials: bool,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-cache-mode
|
/// <https://fetch.spec.whatwg.org/#concept-request-cache-mode>
|
||||||
pub cache_mode: CacheMode,
|
pub cache_mode: CacheMode,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-redirect-mode
|
/// <https://fetch.spec.whatwg.org/#concept-request-redirect-mode>
|
||||||
pub redirect_mode: RedirectMode,
|
pub redirect_mode: RedirectMode,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-integrity-metadata
|
/// <https://fetch.spec.whatwg.org/#concept-request-integrity-metadata>
|
||||||
pub integrity_metadata: String,
|
pub integrity_metadata: String,
|
||||||
// Use the last method on url_list to act as spec current url field, and
|
// Use the last method on url_list to act as spec current url field, and
|
||||||
// first method to act as spec url field
|
// first method to act as spec url field
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-url-list
|
/// <https://fetch.spec.whatwg.org/#concept-request-url-list>
|
||||||
pub url_list: Vec<ServoUrl>,
|
pub url_list: Vec<ServoUrl>,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-redirect-count
|
/// <https://fetch.spec.whatwg.org/#concept-request-redirect-count>
|
||||||
pub redirect_count: u32,
|
pub redirect_count: u32,
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-response-tainting
|
/// <https://fetch.spec.whatwg.org/#concept-request-response-tainting>
|
||||||
pub response_tainting: ResponseTainting,
|
pub response_tainting: ResponseTainting,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,27 +333,27 @@ impl Request {
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-url
|
/// <https://fetch.spec.whatwg.org/#concept-request-url>
|
||||||
pub fn url(&self) -> ServoUrl {
|
pub fn url(&self) -> ServoUrl {
|
||||||
self.url_list.first().unwrap().clone()
|
self.url_list.first().unwrap().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-current-url
|
/// <https://fetch.spec.whatwg.org/#concept-request-current-url>
|
||||||
pub fn current_url(&self) -> ServoUrl {
|
pub fn current_url(&self) -> ServoUrl {
|
||||||
self.url_list.last().unwrap().clone()
|
self.url_list.last().unwrap().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#concept-request-current-url
|
/// <https://fetch.spec.whatwg.org/#concept-request-current-url>
|
||||||
pub fn current_url_mut(&mut self) -> &mut ServoUrl {
|
pub fn current_url_mut(&mut self) -> &mut ServoUrl {
|
||||||
self.url_list.last_mut().unwrap()
|
self.url_list.last_mut().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#navigation-request
|
/// <https://fetch.spec.whatwg.org/#navigation-request>
|
||||||
pub fn is_navigation_request(&self) -> bool {
|
pub fn is_navigation_request(&self) -> bool {
|
||||||
self.destination == Destination::Document
|
self.destination == Destination::Document
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fetch.spec.whatwg.org/#subresource-request
|
/// <https://fetch.spec.whatwg.org/#subresource-request>
|
||||||
pub fn is_subresource_request(&self) -> bool {
|
pub fn is_subresource_request(&self) -> bool {
|
||||||
match self.destination {
|
match self.destination {
|
||||||
Destination::Font | Destination::Image | Destination::Manifest | Destination::Media |
|
Destination::Font | Destination::Image | Destination::Manifest | Destination::Media |
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
//! Tracking of pending loads in a document.
|
//! Tracking of pending loads in a document.
|
||||||
//! https://html.spec.whatwg.org/multipage/#the-end
|
//!
|
||||||
|
//! <https://html.spec.whatwg.org/multipage/#the-end>
|
||||||
|
|
||||||
use dom::bindings::root::Dom;
|
use dom::bindings::root::Dom;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
|
|
|
@ -230,10 +230,10 @@ pub struct CallSetup {
|
||||||
old_compartment: *mut JSCompartment,
|
old_compartment: *mut JSCompartment,
|
||||||
/// The exception handling used for the call.
|
/// The exception handling used for the call.
|
||||||
handling: ExceptionHandling,
|
handling: ExceptionHandling,
|
||||||
/// https://heycam.github.io/webidl/#es-invoking-callback-functions
|
/// <https://heycam.github.io/webidl/#es-invoking-callback-functions>
|
||||||
/// steps 8 and 18.2.
|
/// steps 8 and 18.2.
|
||||||
entry_script: Option<AutoEntryScript>,
|
entry_script: Option<AutoEntryScript>,
|
||||||
/// https://heycam.github.io/webidl/#es-invoking-callback-functions
|
/// <https://heycam.github.io/webidl/#es-invoking-callback-functions>
|
||||||
/// steps 9 and 18.1.
|
/// steps 9 and 18.1.
|
||||||
incumbent_script: Option<AutoIncumbentScript>,
|
incumbent_script: Option<AutoIncumbentScript>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,31 +6,31 @@
|
||||||
//!
|
//!
|
||||||
//! | IDL type | Argument type | Return type |
|
//! | IDL type | Argument type | Return type |
|
||||||
//! |-------------------------|-----------------|----------------|
|
//! |-------------------------|-----------------|----------------|
|
||||||
//! | any | `JSVal` |
|
//! | any | `JSVal` | |
|
||||||
//! | boolean | `bool` |
|
//! | boolean | `bool` | |
|
||||||
//! | byte | `i8` |
|
//! | byte | `i8` | |
|
||||||
//! | octet | `u8` |
|
//! | octet | `u8` | |
|
||||||
//! | short | `i16` |
|
//! | short | `i16` | |
|
||||||
//! | unsigned short | `u16` |
|
//! | unsigned short | `u16` | |
|
||||||
//! | long | `i32` |
|
//! | long | `i32` | |
|
||||||
//! | unsigned long | `u32` |
|
//! | unsigned long | `u32` | |
|
||||||
//! | long long | `i64` |
|
//! | long long | `i64` | |
|
||||||
//! | unsigned long long | `u64` |
|
//! | unsigned long long | `u64` | |
|
||||||
//! | unrestricted float | `f32` |
|
//! | unrestricted float | `f32` | |
|
||||||
//! | float | `Finite<f32>` |
|
//! | float | `Finite<f32>` | |
|
||||||
//! | unrestricted double | `f64` |
|
//! | unrestricted double | `f64` | |
|
||||||
//! | double | `Finite<f64>` |
|
//! | double | `Finite<f64>` | |
|
||||||
//! | DOMString | `DOMString` |
|
//! | DOMString | `DOMString` | |
|
||||||
//! | USVString | `USVString` |
|
//! | USVString | `USVString` | |
|
||||||
//! | ByteString | `ByteString` |
|
//! | ByteString | `ByteString` | |
|
||||||
//! | object | `*mut JSObject` |
|
//! | object | `*mut JSObject` | |
|
||||||
//! | interface types | `&T` | `DomRoot<T>` |
|
//! | interface types | `&T` | `DomRoot<T>` |
|
||||||
//! | dictionary types | `&T` | *unsupported* |
|
//! | dictionary types | `&T` | *unsupported* |
|
||||||
//! | enumeration types | `T` |
|
//! | enumeration types | `T` | |
|
||||||
//! | callback function types | `Rc<T>` |
|
//! | callback function types | `Rc<T>` | |
|
||||||
//! | nullable types | `Option<T>` |
|
//! | nullable types | `Option<T>` | |
|
||||||
//! | sequences | `Vec<T>` |
|
//! | sequences | `Vec<T>` | |
|
||||||
//! | union types | `T` |
|
//! | union types | `T` | |
|
||||||
|
|
||||||
use dom::bindings::error::{Error, Fallible};
|
use dom::bindings::error::{Error, Fallible};
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
|
|
|
@ -548,7 +548,7 @@ unsafe extern "C" fn has_instance_hook(cx: *mut JSContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return whether a value is an instance of a given prototype.
|
/// Return whether a value is an instance of a given prototype.
|
||||||
/// http://heycam.github.io/webidl/#es-interface-hasinstance
|
/// <http://heycam.github.io/webidl/#es-interface-hasinstance>
|
||||||
unsafe fn has_instance(
|
unsafe fn has_instance(
|
||||||
cx: *mut JSContext,
|
cx: *mut JSContext,
|
||||||
interface_object: HandleObject,
|
interface_object: HandleObject,
|
||||||
|
|
|
@ -712,7 +712,7 @@ impl<T: DomObject> LayoutDom<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper trait for safer manipulations of Option<Heap<T>> values.
|
/// Helper trait for safer manipulations of `Option<Heap<T>>` values.
|
||||||
pub trait OptionalHeapSetter {
|
pub trait OptionalHeapSetter {
|
||||||
type Value;
|
type Value;
|
||||||
/// Update this optional heap value with a new value.
|
/// Update this optional heap value with a new value.
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub struct AutoEntryScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AutoEntryScript {
|
impl AutoEntryScript {
|
||||||
/// https://html.spec.whatwg.org/multipage/#prepare-to-run-script
|
/// <https://html.spec.whatwg.org/multipage/#prepare-to-run-script>
|
||||||
pub fn new(global: &GlobalScope) -> Self {
|
pub fn new(global: &GlobalScope) -> Self {
|
||||||
STACK.with(|stack| {
|
STACK.with(|stack| {
|
||||||
trace!("Prepare to run script with {:p}", global);
|
trace!("Prepare to run script with {:p}", global);
|
||||||
|
@ -58,7 +58,7 @@ impl AutoEntryScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for AutoEntryScript {
|
impl Drop for AutoEntryScript {
|
||||||
/// https://html.spec.whatwg.org/multipage/#clean-up-after-running-script
|
/// <https://html.spec.whatwg.org/multipage/#clean-up-after-running-script>
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
STACK.with(|stack| {
|
STACK.with(|stack| {
|
||||||
let mut stack = stack.borrow_mut();
|
let mut stack = stack.borrow_mut();
|
||||||
|
@ -96,7 +96,7 @@ pub struct AutoIncumbentScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AutoIncumbentScript {
|
impl AutoIncumbentScript {
|
||||||
/// https://html.spec.whatwg.org/multipage/#prepare-to-run-a-callback
|
/// <https://html.spec.whatwg.org/multipage/#prepare-to-run-a-callback>
|
||||||
pub fn new(global: &GlobalScope) -> Self {
|
pub fn new(global: &GlobalScope) -> Self {
|
||||||
// Step 2-3.
|
// Step 2-3.
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -120,7 +120,7 @@ impl AutoIncumbentScript {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for AutoIncumbentScript {
|
impl Drop for AutoIncumbentScript {
|
||||||
/// https://html.spec.whatwg.org/multipage/#clean-up-after-running-a-callback
|
/// <https://html.spec.whatwg.org/multipage/#clean-up-after-running-a-callback>
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
STACK.with(|stack| {
|
STACK.with(|stack| {
|
||||||
// Step 4.
|
// Step 4.
|
||||||
|
|
|
@ -194,7 +194,7 @@ pub unsafe fn find_enum_value<'a, T>(cx: *mut JSContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns wether `obj` is a platform object
|
/// Returns wether `obj` is a platform object
|
||||||
/// https://heycam.github.io/webidl/#dfn-platform-object
|
/// <https://heycam.github.io/webidl/#dfn-platform-object>
|
||||||
pub fn is_platform_object(obj: *mut JSObject) -> bool {
|
pub fn is_platform_object(obj: *mut JSObject) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Fast-path the common case
|
// Fast-path the common case
|
||||||
|
|
|
@ -329,7 +329,7 @@ fn read_file(global: &GlobalScope, id: Uuid) -> Result<Vec<u8>, ()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract bytes from BlobParts, used by Blob and File constructor
|
/// Extract bytes from BlobParts, used by Blob and File constructor
|
||||||
/// https://w3c.github.io/FileAPI/#constructorBlob
|
/// <https://w3c.github.io/FileAPI/#constructorBlob>
|
||||||
pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()> {
|
pub fn blob_parts_to_bytes(blobparts: Vec<BlobOrString>) -> Result<Vec<u8>, ()> {
|
||||||
let mut ret = vec![];
|
let mut ret = vec![];
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ impl BlobMethods for Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the normalized, MIME-parsable type string
|
/// Get the normalized, MIME-parsable type string
|
||||||
/// https://w3c.github.io/FileAPI/#dfn-type
|
/// <https://w3c.github.io/FileAPI/#dfn-type>
|
||||||
/// XXX: We will relax the restriction here,
|
/// XXX: We will relax the restriction here,
|
||||||
/// since the spec has some problem over this part.
|
/// since the spec has some problem over this part.
|
||||||
/// see https://github.com/w3c/FileAPI/issues/43
|
/// see https://github.com/w3c/FileAPI/issues/43
|
||||||
|
|
|
@ -21,14 +21,14 @@ pub struct CSS {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CSS {
|
impl CSS {
|
||||||
/// http://dev.w3.org/csswg/cssom/#serialize-an-identifier
|
/// <http://dev.w3.org/csswg/cssom/#serialize-an-identifier>
|
||||||
pub fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> {
|
pub fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> {
|
||||||
let mut escaped = String::new();
|
let mut escaped = String::new();
|
||||||
serialize_identifier(&ident, &mut escaped).unwrap();
|
serialize_identifier(&ident, &mut escaped).unwrap();
|
||||||
Ok(DOMString::from(escaped))
|
Ok(DOMString::from(escaped))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional/#dom-css-supports
|
/// <https://drafts.csswg.org/css-conditional/#dom-css-supports>
|
||||||
pub fn Supports(win: &Window, property: DOMString, value: DOMString) -> bool {
|
pub fn Supports(win: &Window, property: DOMString, value: DOMString) -> bool {
|
||||||
let mut decl = String::new();
|
let mut decl = String::new();
|
||||||
serialize_identifier(&property, &mut decl).unwrap();
|
serialize_identifier(&property, &mut decl).unwrap();
|
||||||
|
@ -45,7 +45,7 @@ impl CSS {
|
||||||
decl.eval(&context)
|
decl.eval(&context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional/#dom-css-supports
|
/// <https://drafts.csswg.org/css-conditional/#dom-css-supports>
|
||||||
pub fn Supports_(win: &Window, condition: DOMString) -> bool {
|
pub fn Supports_(win: &Window, condition: DOMString) -> bool {
|
||||||
let mut input = ParserInput::new(&condition);
|
let mut input = ParserInput::new(&condition);
|
||||||
let mut input = Parser::new(&mut input);
|
let mut input = Parser::new(&mut input);
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl CSSConditionRule {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CSSConditionRuleMethods for CSSConditionRule {
|
impl CSSConditionRuleMethods for CSSConditionRule {
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext
|
/// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext>
|
||||||
fn ConditionText(&self) -> DOMString {
|
fn ConditionText(&self) -> DOMString {
|
||||||
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
||||||
rule.get_condition_text()
|
rule.get_condition_text()
|
||||||
|
@ -48,7 +48,7 @@ impl CSSConditionRuleMethods for CSSConditionRule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext
|
/// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext>
|
||||||
fn SetConditionText(&self, text: DOMString) {
|
fn SetConditionText(&self, text: DOMString) {
|
||||||
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
||||||
rule.set_condition_text(text)
|
rule.set_condition_text(text)
|
||||||
|
|
|
@ -59,7 +59,7 @@ impl CSSMediaRule {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface
|
/// <https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface>
|
||||||
pub fn get_condition_text(&self) -> DOMString {
|
pub fn get_condition_text(&self) -> DOMString {
|
||||||
let guard = self.cssconditionrule.shared_lock().read();
|
let guard = self.cssconditionrule.shared_lock().read();
|
||||||
let rule = self.mediarule.read_with(&guard);
|
let rule = self.mediarule.read_with(&guard);
|
||||||
|
@ -67,7 +67,7 @@ impl CSSMediaRule {
|
||||||
list.to_css_string().into()
|
list.to_css_string().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface
|
/// <https://drafts.csswg.org/css-conditional-3/#the-cssmediarule-interface>
|
||||||
pub fn set_condition_text(&self, text: DOMString) {
|
pub fn set_condition_text(&self, text: DOMString) {
|
||||||
let mut input = ParserInput::new(&text);
|
let mut input = ParserInput::new(&text);
|
||||||
let mut input = Parser::new(&mut input);
|
let mut input = Parser::new(&mut input);
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl CSSStyleValue {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CSSStyleValueMethods for CSSStyleValue {
|
impl CSSStyleValueMethods for CSSStyleValue {
|
||||||
/// https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior
|
/// <https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior>
|
||||||
fn Stringifier(&self) -> DOMString {
|
fn Stringifier(&self) -> DOMString {
|
||||||
DOMString::from(&*self.value)
|
DOMString::from(&*self.value)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ impl CSSStyleValue {
|
||||||
/// Parse the value as a `url()`.
|
/// Parse the value as a `url()`.
|
||||||
/// TODO: This should really always be an absolute URL, but we currently
|
/// TODO: This should really always be an absolute URL, but we currently
|
||||||
/// return relative URLs for computed values, so we pass in a base.
|
/// return relative URLs for computed values, so we pass in a base.
|
||||||
/// https://github.com/servo/servo/issues/17625
|
/// <https://github.com/servo/servo/issues/17625>
|
||||||
pub fn get_url(&self, base_url: ServoUrl) -> Option<ServoUrl> {
|
pub fn get_url(&self, base_url: ServoUrl) -> Option<ServoUrl> {
|
||||||
let mut input = ParserInput::new(&*self.value);
|
let mut input = ParserInput::new(&*self.value);
|
||||||
let mut parser = Parser::new(&mut input);
|
let mut parser = Parser::new(&mut input);
|
||||||
|
|
|
@ -46,14 +46,14 @@ impl CSSSupportsRule {
|
||||||
CSSSupportsRuleBinding::Wrap)
|
CSSSupportsRuleBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
/// <https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface>
|
||||||
pub fn get_condition_text(&self) -> DOMString {
|
pub fn get_condition_text(&self) -> DOMString {
|
||||||
let guard = self.cssconditionrule.shared_lock().read();
|
let guard = self.cssconditionrule.shared_lock().read();
|
||||||
let rule = self.supportsrule.read_with(&guard);
|
let rule = self.supportsrule.read_with(&guard);
|
||||||
rule.condition.to_css_string().into()
|
rule.condition.to_css_string().into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface
|
/// <https://drafts.csswg.org/css-conditional-3/#the-csssupportsrule-interface>
|
||||||
pub fn set_condition_text(&self, text: DOMString) {
|
pub fn set_condition_text(&self, text: DOMString) {
|
||||||
let mut input = ParserInput::new(&text);
|
let mut input = ParserInput::new(&text);
|
||||||
let mut input = Parser::new(&mut input);
|
let mut input = Parser::new(&mut input);
|
||||||
|
|
|
@ -40,7 +40,7 @@ use std::ops::Deref;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#customelementregistry
|
/// <https://html.spec.whatwg.org/multipage/#customelementregistry>
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CustomElementRegistry {
|
pub struct CustomElementRegistry {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
|
@ -74,12 +74,12 @@ impl CustomElementRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cleans up any active promises
|
/// Cleans up any active promises
|
||||||
/// https://github.com/servo/servo/issues/15318
|
/// <https://github.com/servo/servo/issues/15318>
|
||||||
pub fn teardown(&self) {
|
pub fn teardown(&self) {
|
||||||
self.when_defined.borrow_mut().clear()
|
self.when_defined.borrow_mut().clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
|
/// <https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition>
|
||||||
pub fn lookup_definition(&self,
|
pub fn lookup_definition(&self,
|
||||||
local_name: &LocalName,
|
local_name: &LocalName,
|
||||||
is: Option<&LocalName>)
|
is: Option<&LocalName>)
|
||||||
|
@ -97,7 +97,7 @@ impl CustomElementRegistry {
|
||||||
}).cloned()
|
}).cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||||
/// Steps 10.1, 10.2
|
/// Steps 10.1, 10.2
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn check_prototype(&self, constructor: HandleObject, prototype: MutableHandleValue) -> ErrorResult {
|
fn check_prototype(&self, constructor: HandleObject, prototype: MutableHandleValue) -> ErrorResult {
|
||||||
|
@ -119,7 +119,7 @@ impl CustomElementRegistry {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||||
/// Steps 10.3, 10.4
|
/// Steps 10.3, 10.4
|
||||||
fn get_callbacks(&self, prototype: HandleObject) -> Fallible<LifecycleCallbacks> {
|
fn get_callbacks(&self, prototype: HandleObject) -> Fallible<LifecycleCallbacks> {
|
||||||
let cx = self.window.get_cx();
|
let cx = self.window.get_cx();
|
||||||
|
@ -133,7 +133,7 @@ impl CustomElementRegistry {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||||
/// Step 10.6
|
/// Step 10.6
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_observed_attributes(&self, constructor: HandleObject) -> Fallible<Vec<DOMString>> {
|
fn get_observed_attributes(&self, constructor: HandleObject) -> Fallible<Vec<DOMString>> {
|
||||||
|
@ -161,7 +161,7 @@ impl CustomElementRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||||
/// Step 10.4
|
/// Step 10.4
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fallible<Option<Rc<Function>>> {
|
fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fallible<Option<Rc<Function>>> {
|
||||||
|
@ -188,7 +188,7 @@ fn get_callback(cx: *mut JSContext, prototype: HandleObject, name: &[u8]) -> Fal
|
||||||
|
|
||||||
impl CustomElementRegistryMethods for CustomElementRegistry {
|
impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||||
#[allow(unsafe_code, unrooted_must_root)]
|
#[allow(unsafe_code, unrooted_must_root)]
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||||
fn Define(&self, name: DOMString, constructor_: Rc<Function>, options: &ElementDefinitionOptions) -> ErrorResult {
|
fn Define(&self, name: DOMString, constructor_: Rc<Function>, options: &ElementDefinitionOptions) -> ErrorResult {
|
||||||
let cx = self.window.get_cx();
|
let cx = self.window.get_cx();
|
||||||
rooted!(in(cx) let constructor = constructor_.callback());
|
rooted!(in(cx) let constructor = constructor_.callback());
|
||||||
|
@ -321,7 +321,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-get
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-get>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe fn Get(&self, cx: *mut JSContext, name: DOMString) -> JSVal {
|
unsafe fn Get(&self, cx: *mut JSContext, name: DOMString) -> JSVal {
|
||||||
match self.definitions.borrow().get(&LocalName::from(&*name)) {
|
match self.definitions.borrow().get(&LocalName::from(&*name)) {
|
||||||
|
@ -334,7 +334,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined
|
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-whendefined>
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
fn WhenDefined(&self, name: DOMString) -> Rc<Promise> {
|
fn WhenDefined(&self, name: DOMString) -> Rc<Promise> {
|
||||||
let global_scope = self.window.upcast::<GlobalScope>();
|
let global_scope = self.window.upcast::<GlobalScope>();
|
||||||
|
@ -390,7 +390,7 @@ pub enum ConstructionStackEntry {
|
||||||
AlreadyConstructedMarker,
|
AlreadyConstructedMarker,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#custom-element-definition
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-definition>
|
||||||
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, HeapSizeOf, JSTraceable)]
|
||||||
pub struct CustomElementDefinition {
|
pub struct CustomElementDefinition {
|
||||||
pub name: LocalName,
|
pub name: LocalName,
|
||||||
|
@ -424,7 +424,7 @@ impl CustomElementDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#autonomous-custom-element
|
/// <https://html.spec.whatwg.org/multipage/#autonomous-custom-element>
|
||||||
pub fn is_autonomous(&self) -> bool {
|
pub fn is_autonomous(&self) -> bool {
|
||||||
self.name == self.local_name
|
self.name == self.local_name
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,7 @@ impl CustomElementDefinition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element
|
/// <https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn upgrade_element(definition: Rc<CustomElementDefinition>, element: &Element) {
|
pub fn upgrade_element(definition: Rc<CustomElementDefinition>, element: &Element) {
|
||||||
// Steps 1-2
|
// Steps 1-2
|
||||||
|
@ -536,7 +536,7 @@ pub fn upgrade_element(definition: Rc<CustomElementDefinition>, element: &Elemen
|
||||||
element.set_custom_element_definition(definition);
|
element.set_custom_element_definition(definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element
|
/// <https://html.spec.whatwg.org/multipage/#concept-upgrade-an-element>
|
||||||
/// Steps 7.1-7.2
|
/// Steps 7.1-7.2
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> ErrorResult {
|
fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> ErrorResult {
|
||||||
|
@ -567,7 +567,7 @@ fn run_upgrade_constructor(constructor: &Rc<Function>, element: &Element) -> Err
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-try-upgrade
|
/// <https://html.spec.whatwg.org/multipage/#concept-try-upgrade>
|
||||||
pub fn try_upgrade_element(element: &Element) {
|
pub fn try_upgrade_element(element: &Element) {
|
||||||
// Step 1
|
// Step 1
|
||||||
let document = document_from_node(element);
|
let document = document_from_node(element);
|
||||||
|
@ -595,7 +595,7 @@ pub enum CustomElementReaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CustomElementReaction {
|
impl CustomElementReaction {
|
||||||
/// https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions
|
/// <https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn invoke(&self, element: &Element) {
|
pub fn invoke(&self, element: &Element) {
|
||||||
// Step 2.1
|
// Step 2.1
|
||||||
|
@ -616,14 +616,14 @@ pub enum CallbackReaction {
|
||||||
AttributeChanged(LocalName, Option<DOMString>, Option<DOMString>, Namespace),
|
AttributeChanged(LocalName, Option<DOMString>, Option<DOMString>, Namespace),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue
|
/// <https://html.spec.whatwg.org/multipage/#processing-the-backup-element-queue>
|
||||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||||
enum BackupElementQueueFlag {
|
enum BackupElementQueueFlag {
|
||||||
Processing,
|
Processing,
|
||||||
NotProcessing,
|
NotProcessing,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(HeapSizeOf, JSTraceable)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
pub struct CustomElementReactionStack {
|
pub struct CustomElementReactionStack {
|
||||||
|
@ -658,7 +658,7 @@ impl CustomElementReactionStack {
|
||||||
self.stack.borrow_mut().append(&mut *stack);
|
self.stack.borrow_mut().append(&mut *stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue
|
/// <https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue>
|
||||||
/// Step 4
|
/// Step 4
|
||||||
pub fn invoke_backup_element_queue(&self) {
|
pub fn invoke_backup_element_queue(&self) {
|
||||||
// Step 4.1
|
// Step 4.1
|
||||||
|
@ -668,7 +668,7 @@ impl CustomElementReactionStack {
|
||||||
self.processing_backup_element_queue.set(BackupElementQueueFlag::NotProcessing);
|
self.processing_backup_element_queue.set(BackupElementQueueFlag::NotProcessing);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue
|
/// <https://html.spec.whatwg.org/multipage/#enqueue-an-element-on-the-appropriate-element-queue>
|
||||||
pub fn enqueue_element(&self, element: &Element) {
|
pub fn enqueue_element(&self, element: &Element) {
|
||||||
if let Some(current_queue) = self.stack.borrow().last() {
|
if let Some(current_queue) = self.stack.borrow().last() {
|
||||||
// Step 2
|
// Step 2
|
||||||
|
@ -690,7 +690,7 @@ impl CustomElementReactionStack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-callback-reaction
|
/// <https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-callback-reaction>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
pub fn enqueue_callback_reaction(&self,
|
pub fn enqueue_callback_reaction(&self,
|
||||||
element: &Element,
|
element: &Element,
|
||||||
|
@ -763,7 +763,7 @@ impl CustomElementReactionStack {
|
||||||
self.enqueue_element(element);
|
self.enqueue_element(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-upgrade-reaction
|
/// <https://html.spec.whatwg.org/multipage/#enqueue-a-custom-element-upgrade-reaction>
|
||||||
pub fn enqueue_upgrade_reaction(&self, element: &Element, definition: Rc<CustomElementDefinition>) {
|
pub fn enqueue_upgrade_reaction(&self, element: &Element, definition: Rc<CustomElementDefinition>) {
|
||||||
// Step 1
|
// Step 1
|
||||||
element.push_upgrade_reaction(definition);
|
element.push_upgrade_reaction(definition);
|
||||||
|
@ -772,7 +772,7 @@ impl CustomElementReactionStack {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#element-queue
|
/// <https://html.spec.whatwg.org/multipage/#element-queue>
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(HeapSizeOf, JSTraceable)]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
struct ElementQueue {
|
struct ElementQueue {
|
||||||
|
@ -786,7 +786,7 @@ impl ElementQueue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions
|
/// <https://html.spec.whatwg.org/multipage/#invoke-custom-element-reactions>
|
||||||
fn invoke_reactions(&self) {
|
fn invoke_reactions(&self) {
|
||||||
// Steps 1-2
|
// Steps 1-2
|
||||||
while let Some(element) = self.next_element() {
|
while let Some(element) = self.next_element() {
|
||||||
|
@ -804,7 +804,7 @@ impl ElementQueue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#valid-custom-element-name
|
/// <https://html.spec.whatwg.org/multipage/#valid-custom-element-name>
|
||||||
pub fn is_valid_custom_element_name(name: &str) -> bool {
|
pub fn is_valid_custom_element_name(name: &str) -> bool {
|
||||||
// Custom elment names must match:
|
// Custom elment names must match:
|
||||||
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
||||||
|
@ -847,7 +847,7 @@ pub fn is_valid_custom_element_name(name: &str) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if this character is a PCENChar
|
/// Check if this character is a PCENChar
|
||||||
/// https://html.spec.whatwg.org/multipage/#prod-pcenchar
|
/// <https://html.spec.whatwg.org/multipage/#prod-pcenchar>
|
||||||
fn is_potential_custom_element_char(c: char) -> bool {
|
fn is_potential_custom_element_char(c: char) -> bool {
|
||||||
c == '-' || c == '.' || c == '_' || c == '\u{B7}' ||
|
c == '-' || c == '.' || c == '_' || c == '\u{B7}' ||
|
||||||
(c >= '0' && c <= '9') ||
|
(c >= '0' && c <= '9') ||
|
||||||
|
|
|
@ -219,7 +219,7 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#document
|
/// <https://dom.spec.whatwg.org/#document>
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct Document {
|
pub struct Document {
|
||||||
node: Node,
|
node: Node,
|
||||||
|
@ -261,23 +261,23 @@ pub struct Document {
|
||||||
focused: MutNullableDom<Element>,
|
focused: MutNullableDom<Element>,
|
||||||
/// The script element that is currently executing.
|
/// The script element that is currently executing.
|
||||||
current_script: MutNullableDom<HTMLScriptElement>,
|
current_script: MutNullableDom<HTMLScriptElement>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script
|
/// <https://html.spec.whatwg.org/multipage/#pending-parsing-blocking-script>
|
||||||
pending_parsing_blocking_script: DomRefCell<Option<PendingScript>>,
|
pending_parsing_blocking_script: DomRefCell<Option<PendingScript>>,
|
||||||
/// Number of stylesheets that block executing the next parser-inserted script
|
/// Number of stylesheets that block executing the next parser-inserted script
|
||||||
script_blocking_stylesheets_count: Cell<u32>,
|
script_blocking_stylesheets_count: Cell<u32>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing
|
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing
|
||||||
deferred_scripts: PendingInOrderScriptVec,
|
deferred_scripts: PendingInOrderScriptVec,
|
||||||
/// https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible
|
/// <https://html.spec.whatwg.org/multipage/#list-of-scripts-that-will-execute-in-order-as-soon-as-possible>
|
||||||
asap_in_order_scripts_list: PendingInOrderScriptVec,
|
asap_in_order_scripts_list: PendingInOrderScriptVec,
|
||||||
/// https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible
|
/// <https://html.spec.whatwg.org/multipage/#set-of-scripts-that-will-execute-as-soon-as-possible>
|
||||||
asap_scripts_set: DomRefCell<Vec<Dom<HTMLScriptElement>>>,
|
asap_scripts_set: DomRefCell<Vec<Dom<HTMLScriptElement>>>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-n-noscript
|
/// <https://html.spec.whatwg.org/multipage/#concept-n-noscript>
|
||||||
/// True if scripting is enabled for all scripts in this document
|
/// True if scripting is enabled for all scripts in this document
|
||||||
scripting_enabled: bool,
|
scripting_enabled: bool,
|
||||||
/// https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier
|
/// <https://html.spec.whatwg.org/multipage/#animation-frame-callback-identifier>
|
||||||
/// Current identifier of animation frame callback
|
/// Current identifier of animation frame callback
|
||||||
animation_frame_ident: Cell<u32>,
|
animation_frame_ident: Cell<u32>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks
|
/// <https://html.spec.whatwg.org/multipage/#list-of-animation-frame-callbacks>
|
||||||
/// List of animation frame callbacks
|
/// List of animation frame callbacks
|
||||||
animation_frame_list: DomRefCell<Vec<(u32, Option<AnimationFrameCallback>)>>,
|
animation_frame_list: DomRefCell<Vec<(u32, Option<AnimationFrameCallback>)>>,
|
||||||
/// Whether we're in the process of running animation callbacks.
|
/// Whether we're in the process of running animation callbacks.
|
||||||
|
@ -294,7 +294,7 @@ pub struct Document {
|
||||||
/// The cached first `base` element with an `href` attribute.
|
/// The cached first `base` element with an `href` attribute.
|
||||||
base_element: MutNullableDom<HTMLBaseElement>,
|
base_element: MutNullableDom<HTMLBaseElement>,
|
||||||
/// This field is set to the document itself for inert documents.
|
/// This field is set to the document itself for inert documents.
|
||||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
/// <https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document>
|
||||||
appropriate_template_contents_owner_document: MutNullableDom<Document>,
|
appropriate_template_contents_owner_document: MutNullableDom<Document>,
|
||||||
/// Information on elements needing restyle to ship over to the layout thread when the
|
/// Information on elements needing restyle to ship over to the layout thread when the
|
||||||
/// time comes.
|
/// time comes.
|
||||||
|
@ -302,10 +302,10 @@ pub struct Document {
|
||||||
/// This flag will be true if layout suppressed a reflow attempt that was
|
/// This flag will be true if layout suppressed a reflow attempt that was
|
||||||
/// needed in order for the page to be painted.
|
/// needed in order for the page to be painted.
|
||||||
needs_paint: Cell<bool>,
|
needs_paint: Cell<bool>,
|
||||||
/// http://w3c.github.io/touch-events/#dfn-active-touch-point
|
/// <http://w3c.github.io/touch-events/#dfn-active-touch-point>
|
||||||
active_touch_points: DomRefCell<Vec<Dom<Touch>>>,
|
active_touch_points: DomRefCell<Vec<Dom<Touch>>>,
|
||||||
/// Navigation Timing properties:
|
/// Navigation Timing properties:
|
||||||
/// https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming
|
/// <https://w3c.github.io/navigation-timing/#sec-PerformanceNavigationTiming>
|
||||||
dom_loading: Cell<u64>,
|
dom_loading: Cell<u64>,
|
||||||
dom_interactive: Cell<u64>,
|
dom_interactive: Cell<u64>,
|
||||||
dom_content_loaded_event_start: Cell<u64>,
|
dom_content_loaded_event_start: Cell<u64>,
|
||||||
|
@ -313,21 +313,21 @@ pub struct Document {
|
||||||
dom_complete: Cell<u64>,
|
dom_complete: Cell<u64>,
|
||||||
load_event_start: Cell<u64>,
|
load_event_start: Cell<u64>,
|
||||||
load_event_end: Cell<u64>,
|
load_event_end: Cell<u64>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-document-https-state
|
/// <https://html.spec.whatwg.org/multipage/#concept-document-https-state>
|
||||||
https_state: Cell<HttpsState>,
|
https_state: Cell<HttpsState>,
|
||||||
touchpad_pressure_phase: Cell<TouchpadPressurePhase>,
|
touchpad_pressure_phase: Cell<TouchpadPressurePhase>,
|
||||||
/// The document's origin.
|
/// The document's origin.
|
||||||
origin: MutableOrigin,
|
origin: MutableOrigin,
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states
|
/// https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-states
|
||||||
referrer_policy: Cell<Option<ReferrerPolicy>>,
|
referrer_policy: Cell<Option<ReferrerPolicy>>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-document-referrer
|
/// <https://html.spec.whatwg.org/multipage/#dom-document-referrer>
|
||||||
referrer: Option<String>,
|
referrer: Option<String>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#target-element
|
/// <https://html.spec.whatwg.org/multipage/#target-element>
|
||||||
target_element: MutNullableDom<Element>,
|
target_element: MutNullableDom<Element>,
|
||||||
/// https://w3c.github.io/uievents/#event-type-dblclick
|
/// <https://w3c.github.io/uievents/#event-type-dblclick>
|
||||||
#[ignore_heap_size_of = "Defined in std"]
|
#[ignore_heap_size_of = "Defined in std"]
|
||||||
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
|
last_click_info: DomRefCell<Option<(Instant, Point2D<f32>)>>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter
|
/// <https://html.spec.whatwg.org/multipage/#ignore-destructive-writes-counter>
|
||||||
ignore_destructive_writes_counter: Cell<u32>,
|
ignore_destructive_writes_counter: Cell<u32>,
|
||||||
/// The number of spurious `requestAnimationFrame()` requests we've received.
|
/// The number of spurious `requestAnimationFrame()` requests we've received.
|
||||||
///
|
///
|
||||||
|
@ -421,7 +421,7 @@ impl Document {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn has_browsing_context(&self) -> bool { self.has_browsing_context }
|
pub fn has_browsing_context(&self) -> bool { self.has_browsing_context }
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-document-bc
|
/// <https://html.spec.whatwg.org/multipage/#concept-document-bc>
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn browsing_context(&self) -> Option<DomRoot<WindowProxy>> {
|
pub fn browsing_context(&self) -> Option<DomRoot<WindowProxy>> {
|
||||||
if self.has_browsing_context {
|
if self.has_browsing_context {
|
||||||
|
@ -524,7 +524,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refresh the cached first base element in the DOM.
|
/// Refresh the cached first base element in the DOM.
|
||||||
/// https://github.com/w3c/web-platform-tests/issues/2122
|
/// <https://github.com/w3c/web-platform-tests/issues/2122>
|
||||||
pub fn refresh_base_element(&self) {
|
pub fn refresh_base_element(&self) {
|
||||||
let base = self.upcast::<Node>()
|
let base = self.upcast::<Node>()
|
||||||
.traverse_preorder()
|
.traverse_preorder()
|
||||||
|
@ -667,7 +667,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempt to find a named element in this page's document.
|
/// Attempt to find a named element in this page's document.
|
||||||
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
|
/// <https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document>
|
||||||
pub fn find_fragment_node(&self, fragid: &str) -> Option<DomRoot<Element>> {
|
pub fn find_fragment_node(&self, fragid: &str) -> Option<DomRoot<Element>> {
|
||||||
// Step 1 is not handled here; the fragid is already obtained by the calling function
|
// Step 1 is not handled here; the fragid is already obtained by the calling function
|
||||||
// Step 2: Simply use None to indicate the top of the document.
|
// Step 2: Simply use None to indicate the top of the document.
|
||||||
|
@ -682,7 +682,7 @@ impl Document {
|
||||||
|
|
||||||
/// Scroll to the target element, and when we do not find a target
|
/// Scroll to the target element, and when we do not find a target
|
||||||
/// and the fragment is empty or "top", scroll to the top.
|
/// and the fragment is empty or "top", scroll to the top.
|
||||||
/// https://html.spec.whatwg.org/multipage/#scroll-to-the-fragment-identifier
|
/// <https://html.spec.whatwg.org/multipage/#scroll-to-the-fragment-identifier>
|
||||||
pub fn check_and_scroll_fragment(&self, fragment: &str) {
|
pub fn check_and_scroll_fragment(&self, fragment: &str) {
|
||||||
let target = self.find_fragment_node(fragment);
|
let target = self.find_fragment_node(fragment);
|
||||||
|
|
||||||
|
@ -1522,7 +1522,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe
|
/// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe>
|
||||||
pub fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32 {
|
pub fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32 {
|
||||||
let ident = self.animation_frame_ident.get() + 1;
|
let ident = self.animation_frame_ident.get() + 1;
|
||||||
|
|
||||||
|
@ -1554,7 +1554,7 @@ impl Document {
|
||||||
ident
|
ident
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
|
/// <https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe>
|
||||||
pub fn cancel_animation_frame(&self, ident: u32) {
|
pub fn cancel_animation_frame(&self, ident: u32) {
|
||||||
let mut list = self.animation_frame_list.borrow_mut();
|
let mut list = self.animation_frame_list.borrow_mut();
|
||||||
if let Some(pair) = list.iter_mut().find(|pair| pair.0 == ident) {
|
if let Some(pair) = list.iter_mut().find(|pair| pair.0 == ident) {
|
||||||
|
@ -1562,7 +1562,7 @@ impl Document {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks
|
/// <https://html.spec.whatwg.org/multipage/#run-the-animation-frame-callbacks>
|
||||||
pub fn run_the_animation_frame_callbacks(&self) {
|
pub fn run_the_animation_frame_callbacks(&self) {
|
||||||
rooted_vec!(let mut animation_frame_list);
|
rooted_vec!(let mut animation_frame_list);
|
||||||
mem::swap(
|
mem::swap(
|
||||||
|
@ -2000,7 +2000,7 @@ impl Document {
|
||||||
event.fire(target);
|
event.fire(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#cookie-averse-document-object
|
/// <https://html.spec.whatwg.org/multipage/#cookie-averse-document-object>
|
||||||
pub fn is_cookie_averse(&self) -> bool {
|
pub fn is_cookie_averse(&self) -> bool {
|
||||||
!self.has_browsing_context || !url_has_network_scheme(&self.url())
|
!self.has_browsing_context || !url_has_network_scheme(&self.url())
|
||||||
}
|
}
|
||||||
|
@ -2013,7 +2013,7 @@ impl Document {
|
||||||
self.window.layout().nodes_from_point_response()
|
self.window.layout().nodes_from_point_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
|
/// <https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition>
|
||||||
pub fn lookup_custom_element_definition(&self,
|
pub fn lookup_custom_element_definition(&self,
|
||||||
namespace: &Namespace,
|
namespace: &Namespace,
|
||||||
local_name: &LocalName,
|
local_name: &LocalName,
|
||||||
|
@ -2151,7 +2151,7 @@ fn get_registrable_domain_suffix_of_or_is_equal_to(host_suffix_string: &str, ori
|
||||||
Some(host)
|
Some(host)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://url.spec.whatwg.org/#network-scheme
|
/// <https://url.spec.whatwg.org/#network-scheme>
|
||||||
fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
fn url_has_network_scheme(url: &ServoUrl) -> bool {
|
||||||
match url.scheme() {
|
match url.scheme() {
|
||||||
"ftp" | "http" | "https" => true,
|
"ftp" | "http" | "https" => true,
|
||||||
|
@ -2225,7 +2225,7 @@ impl Document {
|
||||||
/// Per-process shared lock for author-origin stylesheets
|
/// Per-process shared lock for author-origin stylesheets
|
||||||
///
|
///
|
||||||
/// FIXME: make it per-document or per-pipeline instead:
|
/// FIXME: make it per-document or per-pipeline instead:
|
||||||
/// https://github.com/servo/servo/issues/16027
|
/// <https://github.com/servo/servo/issues/16027>
|
||||||
/// (Need to figure out what to do with the style attribute
|
/// (Need to figure out what to do with the style attribute
|
||||||
/// of elements adopted into another document.)
|
/// of elements adopted into another document.)
|
||||||
static ref PER_PROCESS_AUTHOR_SHARED_LOCK: StyleSharedRwLock = {
|
static ref PER_PROCESS_AUTHOR_SHARED_LOCK: StyleSharedRwLock = {
|
||||||
|
@ -2466,7 +2466,7 @@ impl Document {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document
|
/// <https://html.spec.whatwg.org/multipage/#appropriate-template-contents-owner-document>
|
||||||
pub fn appropriate_template_contents_owner_document(&self) -> DomRoot<Document> {
|
pub fn appropriate_template_contents_owner_document(&self) -> DomRoot<Document> {
|
||||||
self.appropriate_template_contents_owner_document.or_init(|| {
|
self.appropriate_template_contents_owner_document.or_init(|| {
|
||||||
let doctype = if self.is_html_document {
|
let doctype = if self.is_html_document {
|
||||||
|
@ -3977,7 +3977,7 @@ fn update_with_current_time_ms(marker: &Cell<u64>) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/webappsec-referrer-policy/#determine-policy-for-token
|
/// <https://w3c.github.io/webappsec-referrer-policy/#determine-policy-for-token>
|
||||||
pub fn determine_policy_for_token(token: &str) -> Option<ReferrerPolicy> {
|
pub fn determine_policy_for_token(token: &str) -> Option<ReferrerPolicy> {
|
||||||
match_ignore_ascii_case! { token,
|
match_ignore_ascii_case! { token,
|
||||||
"never" | "no-referrer" => Some(ReferrerPolicy::NoReferrer),
|
"never" | "no-referrer" => Some(ReferrerPolicy::NoReferrer),
|
||||||
|
|
|
@ -151,12 +151,12 @@ pub struct Element {
|
||||||
/// when it has exclusive access to the element.
|
/// when it has exclusive access to the element.
|
||||||
#[ignore_heap_size_of = "bitflags defined in rust-selectors"]
|
#[ignore_heap_size_of = "bitflags defined in rust-selectors"]
|
||||||
selector_flags: Cell<ElementSelectorFlags>,
|
selector_flags: Cell<ElementSelectorFlags>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-reaction-queue>
|
||||||
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
custom_element_reaction_queue: DomRefCell<Vec<CustomElementReaction>>,
|
||||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-definition
|
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-definition>
|
||||||
#[ignore_heap_size_of = "Rc"]
|
#[ignore_heap_size_of = "Rc"]
|
||||||
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>,
|
||||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||||
custom_element_state: Cell<CustomElementState>,
|
custom_element_state: Cell<CustomElementState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ pub enum CustomElementCreationMode {
|
||||||
Asynchronous,
|
Asynchronous,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#concept-element-custom-element-state
|
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||||
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Eq, HeapSizeOf, JSTraceable, PartialEq)]
|
||||||
pub enum CustomElementState {
|
pub enum CustomElementState {
|
||||||
Undefined,
|
Undefined,
|
||||||
|
@ -2063,7 +2063,7 @@ impl ElementMethods for Element {
|
||||||
self.upcast::<Node>().client_rect().size.height
|
self.upcast::<Node>().client_rect().size.height
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
/// <https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML>
|
||||||
fn GetInnerHTML(&self) -> Fallible<DOMString> {
|
fn GetInnerHTML(&self) -> Fallible<DOMString> {
|
||||||
let qname = QualName::new(self.prefix().clone(),
|
let qname = QualName::new(self.prefix().clone(),
|
||||||
self.namespace().clone(),
|
self.namespace().clone(),
|
||||||
|
@ -2075,7 +2075,7 @@ impl ElementMethods for Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML
|
/// <https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML>
|
||||||
fn SetInnerHTML(&self, value: DOMString) -> ErrorResult {
|
fn SetInnerHTML(&self, value: DOMString) -> ErrorResult {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let frag = self.parse_fragment(value)?;
|
let frag = self.parse_fragment(value)?;
|
||||||
|
@ -2779,7 +2779,7 @@ impl Element {
|
||||||
|
|
||||||
/// Please call this method *only* for real click events
|
/// Please call this method *only* for real click events
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps
|
/// <https://html.spec.whatwg.org/multipage/#run-authentic-click-activation-steps>
|
||||||
///
|
///
|
||||||
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
|
/// Use an element's synthetic click activation (or handle_event) for any script-triggered clicks.
|
||||||
/// If the spec says otherwise, check with Manishearth first
|
/// If the spec says otherwise, check with Manishearth first
|
||||||
|
@ -2859,7 +2859,7 @@ impl Element {
|
||||||
self.state.get().contains(IN_ACTIVE_STATE)
|
self.state.get().contains(IN_ACTIVE_STATE)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-selector-active
|
/// <https://html.spec.whatwg.org/multipage/#concept-selector-active>
|
||||||
pub fn set_active_state(&self, value: bool) {
|
pub fn set_active_state(&self, value: bool) {
|
||||||
self.set_state(IN_ACTIVE_STATE, value);
|
self.set_state(IN_ACTIVE_STATE, value);
|
||||||
|
|
||||||
|
@ -2936,7 +2936,7 @@ impl Element {
|
||||||
self.set_state(IN_FULLSCREEN_STATE, value)
|
self.set_state(IN_FULLSCREEN_STATE, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#connected
|
/// <https://dom.spec.whatwg.org/#connected>
|
||||||
pub fn is_connected(&self) -> bool {
|
pub fn is_connected(&self) -> bool {
|
||||||
let node = self.upcast::<Node>();
|
let node = self.upcast::<Node>();
|
||||||
let root = node.GetRootNode();
|
let root = node.GetRootNode();
|
||||||
|
@ -2998,11 +2998,11 @@ impl Element {
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum AttributeMutation<'a> {
|
pub enum AttributeMutation<'a> {
|
||||||
/// The attribute is set, keep track of old value.
|
/// The attribute is set, keep track of old value.
|
||||||
/// https://dom.spec.whatwg.org/#attribute-is-set
|
/// <https://dom.spec.whatwg.org/#attribute-is-set>
|
||||||
Set(Option<&'a AttrValue>),
|
Set(Option<&'a AttrValue>),
|
||||||
|
|
||||||
/// The attribute is removed.
|
/// The attribute is removed.
|
||||||
/// https://dom.spec.whatwg.org/#attribute-is-removed
|
/// <https://dom.spec.whatwg.org/#attribute-is-removed>
|
||||||
Removed,
|
Removed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ const DEFAULT_RECONNECTION_TIME: u64 = 5000;
|
||||||
struct GenerationId(u32);
|
struct GenerationId(u32);
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable, PartialEq)]
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate
|
/// <https://html.spec.whatwg.org/multipage/#dom-eventsource-readystate>
|
||||||
enum ReadyState {
|
enum ReadyState {
|
||||||
Connecting = 0,
|
Connecting = 0,
|
||||||
Open = 1,
|
Open = 1,
|
||||||
|
@ -90,7 +90,7 @@ struct EventSourceContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EventSourceContext {
|
impl EventSourceContext {
|
||||||
/// https://html.spec.whatwg.org/multipage/#announce-the-connection
|
/// <https://html.spec.whatwg.org/multipage/#announce-the-connection>
|
||||||
fn announce_the_connection(&self) {
|
fn announce_the_connection(&self) {
|
||||||
let event_source = self.event_source.root();
|
let event_source = self.event_source.root();
|
||||||
if self.gen_id != event_source.generation_id.get() {
|
if self.gen_id != event_source.generation_id.get() {
|
||||||
|
@ -111,7 +111,7 @@ impl EventSourceContext {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#fail-the-connection
|
/// <https://html.spec.whatwg.org/multipage/#fail-the-connection>
|
||||||
fn fail_the_connection(&self) {
|
fn fail_the_connection(&self) {
|
||||||
let event_source = self.event_source.root();
|
let event_source = self.event_source.root();
|
||||||
if self.gen_id != event_source.generation_id.get() {
|
if self.gen_id != event_source.generation_id.get() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub enum ListenerPhase {
|
||||||
Bubbling,
|
Bubbling,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler
|
/// <https://html.spec.whatwg.org/multipage/#internal-raw-uncompiled-handler>
|
||||||
#[derive(Clone, JSTraceable, PartialEq)]
|
#[derive(Clone, JSTraceable, PartialEq)]
|
||||||
struct InternalRawUncompiledHandler {
|
struct InternalRawUncompiledHandler {
|
||||||
source: DOMString,
|
source: DOMString,
|
||||||
|
@ -90,7 +90,7 @@ enum InlineEventListener {
|
||||||
impl InlineEventListener {
|
impl InlineEventListener {
|
||||||
/// Get a compiled representation of this event handler, compiling it from its
|
/// Get a compiled representation of this event handler, compiling it from its
|
||||||
/// raw source if necessary.
|
/// raw source if necessary.
|
||||||
/// https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler
|
/// <https://html.spec.whatwg.org/multipage/#getting-the-current-value-of-the-event-handler>
|
||||||
fn get_compiled_handler(&mut self, owner: &EventTarget, ty: &Atom)
|
fn get_compiled_handler(&mut self, owner: &EventTarget, ty: &Atom)
|
||||||
-> Option<CommonEventHandler> {
|
-> Option<CommonEventHandler> {
|
||||||
match mem::replace(self, InlineEventListener::Null) {
|
match mem::replace(self, InlineEventListener::Null) {
|
||||||
|
@ -314,7 +314,7 @@ impl EventTarget {
|
||||||
*self.handlers.borrow_mut() = Default::default();
|
*self.handlers.borrow_mut() = Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11
|
/// <https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handlers-11>
|
||||||
fn set_inline_event_listener(&self,
|
fn set_inline_event_listener(&self,
|
||||||
ty: Atom,
|
ty: Atom,
|
||||||
listener: Option<InlineEventListener>) {
|
listener: Option<InlineEventListener>) {
|
||||||
|
@ -353,7 +353,7 @@ impl EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Store the raw uncompiled event handler for on-demand compilation later.
|
/// Store the raw uncompiled event handler for on-demand compilation later.
|
||||||
/// https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handler-content-attributes-3
|
/// <https://html.spec.whatwg.org/multipage/#event-handler-attributes:event-handler-content-attributes-3>
|
||||||
pub fn set_event_handler_uncompiled(&self,
|
pub fn set_event_handler_uncompiled(&self,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
line: usize,
|
line: usize,
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub struct GlobalScope {
|
||||||
#[ignore_heap_size_of = "channels are hard"]
|
#[ignore_heap_size_of = "channels are hard"]
|
||||||
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
scheduler_chan: IpcSender<TimerSchedulerMsg>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#in-error-reporting-mode
|
/// <https://html.spec.whatwg.org/multipage/#in-error-reporting-mode>
|
||||||
in_error_reporting_mode: Cell<bool>,
|
in_error_reporting_mode: Cell<bool>,
|
||||||
|
|
||||||
/// Associated resource threads for use by DOM objects like XMLHttpRequest,
|
/// Associated resource threads for use by DOM objects like XMLHttpRequest,
|
||||||
|
@ -107,7 +107,7 @@ pub struct GlobalScope {
|
||||||
/// It is refcounted because windows in the same script thread share the
|
/// It is refcounted because windows in the same script thread share the
|
||||||
/// same microtask queue.
|
/// same microtask queue.
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#microtask-queue
|
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
|
||||||
#[ignore_heap_size_of = "Rc<T> is hard"]
|
#[ignore_heap_size_of = "Rc<T> is hard"]
|
||||||
microtask_queue: Rc<MicrotaskQueue>,
|
microtask_queue: Rc<MicrotaskQueue>,
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ impl GlobalScope {
|
||||||
self.downcast::<Window>().expect("expected a Window scope")
|
self.downcast::<Window>().expect("expected a Window scope")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#report-the-error
|
/// <https://html.spec.whatwg.org/multipage/#report-the-error>
|
||||||
pub fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue) {
|
pub fn report_an_error(&self, error_info: ErrorInfo, value: HandleValue) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if self.in_error_reporting_mode.get() {
|
if self.in_error_reporting_mode.get() {
|
||||||
|
|
|
@ -576,12 +576,12 @@ impl Activatable for HTMLAnchorElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name
|
/// <https://html.spec.whatwg.org/multipage/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>
|
||||||
fn is_current_browsing_context(target: DOMString) -> bool {
|
fn is_current_browsing_context(target: DOMString) -> bool {
|
||||||
target.is_empty() || target == "_self"
|
target.is_empty() || target == "_self"
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#following-hyperlinks-2
|
/// <https://html.spec.whatwg.org/multipage/#following-hyperlinks-2>
|
||||||
pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, referrer_policy: Option<ReferrerPolicy>) {
|
pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>, referrer_policy: Option<ReferrerPolicy>) {
|
||||||
// Step 1: replace.
|
// Step 1: replace.
|
||||||
// Step 2: source browsing context.
|
// Step 2: source browsing context.
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl HTMLBaseElement {
|
||||||
HTMLBaseElementBinding::Wrap)
|
HTMLBaseElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#frozen-base-url
|
/// <https://html.spec.whatwg.org/multipage/#frozen-base-url>
|
||||||
pub fn frozen_base_url(&self) -> ServoUrl {
|
pub fn frozen_base_url(&self) -> ServoUrl {
|
||||||
let href = self.upcast::<Element>().get_attribute(&ns!(), &local_name!("href"))
|
let href = self.upcast::<Element>().get_attribute(&ns!(), &local_name!("href"))
|
||||||
.expect("The frozen base url is only defined for base elements \
|
.expect("The frozen base url is only defined for base elements \
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl HTMLBodyElement {
|
||||||
HTMLBodyElementBinding::Wrap)
|
HTMLBodyElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/cssom-view/#the-html-body-element
|
/// <https://drafts.csswg.org/cssom-view/#the-html-body-element>
|
||||||
pub fn is_the_html_body_element(&self) -> bool {
|
pub fn is_the_html_body_element(&self) -> bool {
|
||||||
let self_node = self.upcast::<Node>();
|
let self_node = self.upcast::<Node>();
|
||||||
let root_elem = self.upcast::<Element>().root_element();
|
let root_elem = self.upcast::<Element>().root_element();
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLButtonElement {
|
impl HTMLButtonElement {
|
||||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||||
/// Steps range from 3.1 to 3.7 (specific to HTMLButtonElement)
|
/// Steps range from 3.1 to 3.7 (specific to HTMLButtonElement)
|
||||||
pub fn form_datum(&self, submitter: Option<FormSubmitter>) -> Option<FormDatum> {
|
pub fn form_datum(&self, submitter: Option<FormSubmitter>) -> Option<FormDatum> {
|
||||||
// Step 3.1: disabled state check is in get_unclean_dataset
|
// Step 3.1: disabled state check is in get_unclean_dataset
|
||||||
|
|
|
@ -130,7 +130,7 @@ impl HTMLFontElementLayoutHelpers for LayoutDom<HTMLFontElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size>
|
||||||
fn parse_size(mut input: &str) -> AttrValue {
|
fn parse_size(mut input: &str) -> AttrValue {
|
||||||
let original_input = input;
|
let original_input = input;
|
||||||
// Steps 1 & 2 are not relevant
|
// Steps 1 & 2 are not relevant
|
||||||
|
|
|
@ -452,7 +452,7 @@ impl HTMLFormElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Interactively validate the constraints of form elements
|
/// Interactively validate the constraints of form elements
|
||||||
/// https://html.spec.whatwg.org/multipage/#interactively-validate-the-constraints
|
/// <https://html.spec.whatwg.org/multipage/#interactively-validate-the-constraints>
|
||||||
fn interactive_validation(&self) -> Result<(), ()> {
|
fn interactive_validation(&self) -> Result<(), ()> {
|
||||||
// Step 1-3
|
// Step 1-3
|
||||||
let _unhandled_invalid_controls = match self.static_validation() {
|
let _unhandled_invalid_controls = match self.static_validation() {
|
||||||
|
@ -466,7 +466,7 @@ impl HTMLFormElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Statitically validate the constraints of form elements
|
/// Statitically validate the constraints of form elements
|
||||||
/// https://html.spec.whatwg.org/multipage/#statically-validate-the-constraints
|
/// <https://html.spec.whatwg.org/multipage/#statically-validate-the-constraints>
|
||||||
fn static_validation(&self) -> Result<(), Vec<FormSubmittableElement>> {
|
fn static_validation(&self) -> Result<(), Vec<FormSubmittableElement>> {
|
||||||
let node = self.upcast::<Node>();
|
let node = self.upcast::<Node>();
|
||||||
// FIXME(#3553): This is an incorrect way of getting controls owned by the
|
// FIXME(#3553): This is an incorrect way of getting controls owned by the
|
||||||
|
@ -506,7 +506,7 @@ impl HTMLFormElement {
|
||||||
Err(unhandled_invalid_controls)
|
Err(unhandled_invalid_controls)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||||
/// Steps range from 1 to 3
|
/// Steps range from 1 to 3
|
||||||
fn get_unclean_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
fn get_unclean_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||||
let controls = self.controls.borrow();
|
let controls = self.controls.borrow();
|
||||||
|
@ -564,7 +564,7 @@ impl HTMLFormElement {
|
||||||
// https://html.spec.whatwg.org/multipage/#the-directionality
|
// https://html.spec.whatwg.org/multipage/#the-directionality
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||||
pub fn get_form_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
pub fn get_form_dataset(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||||
fn clean_crlf(s: &str) -> DOMString {
|
fn clean_crlf(s: &str) -> DOMString {
|
||||||
// Step 4
|
// Step 4
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl HTMLHeadElement {
|
||||||
HTMLHeadElementBinding::Wrap)
|
HTMLHeadElementBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#meta-referrer
|
/// <https://html.spec.whatwg.org/multipage/#meta-referrer>
|
||||||
pub fn set_document_referrer(&self) {
|
pub fn set_document_referrer(&self) {
|
||||||
let doc = document_from_node(self);
|
let doc = document_from_node(self);
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ impl HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes
|
/// <https://html.spec.whatwg.org/multipage/#process-the-iframe-attributes>
|
||||||
fn process_the_iframe_attributes(&self, mode: ProcessingMode) {
|
fn process_the_iframe_attributes(&self, mode: ProcessingMode) {
|
||||||
// TODO: srcdoc
|
// TODO: srcdoc
|
||||||
|
|
||||||
|
|
|
@ -357,7 +357,7 @@ impl HTMLImageElement {
|
||||||
window.add_pending_reflow();
|
window.add_pending_reflow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#abort-the-image-request
|
/// <https://html.spec.whatwg.org/multipage/#abort-the-image-request>
|
||||||
fn abort_request(&self, state: State, request: ImageRequestPhase) {
|
fn abort_request(&self, state: State, request: ImageRequestPhase) {
|
||||||
let mut request = match request {
|
let mut request = match request {
|
||||||
ImageRequestPhase::Current => self.current_request.borrow_mut(),
|
ImageRequestPhase::Current => self.current_request.borrow_mut(),
|
||||||
|
@ -369,7 +369,7 @@ impl HTMLImageElement {
|
||||||
request.metadata = None;
|
request.metadata = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#update-the-source-set
|
/// <https://html.spec.whatwg.org/multipage/#update-the-source-set>
|
||||||
fn update_source_set(&self) -> Vec<DOMString> {
|
fn update_source_set(&self) -> Vec<DOMString> {
|
||||||
let elem = self.upcast::<Element>();
|
let elem = self.upcast::<Element>();
|
||||||
// TODO: follow the algorithm
|
// TODO: follow the algorithm
|
||||||
|
@ -380,7 +380,7 @@ impl HTMLImageElement {
|
||||||
vec![src]
|
vec![src]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#select-an-image-source
|
/// <https://html.spec.whatwg.org/multipage/#select-an-image-source>
|
||||||
fn select_image_source(&self) -> Option<DOMString> {
|
fn select_image_source(&self) -> Option<DOMString> {
|
||||||
// TODO: select an image source from source set
|
// TODO: select an image source from source set
|
||||||
self.update_source_set().first().cloned()
|
self.update_source_set().first().cloned()
|
||||||
|
@ -536,7 +536,7 @@ impl HTMLImageElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#update-the-image-data
|
/// <https://html.spec.whatwg.org/multipage/#update-the-image-data>
|
||||||
fn update_the_image_data(&self) {
|
fn update_the_image_data(&self) {
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
let window = document.window();
|
let window = document.window();
|
||||||
|
|
|
@ -669,7 +669,7 @@ impl HTMLInputElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set
|
/// <https://html.spec.whatwg.org/multipage/#constructing-the-form-data-set>
|
||||||
/// Steps range from 3.1 to 3.7 (specific to HTMLInputElement)
|
/// Steps range from 3.1 to 3.7 (specific to HTMLInputElement)
|
||||||
pub fn form_datums(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
pub fn form_datums(&self, submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
||||||
// 3.1: disabled state check is in get_unclean_dataset
|
// 3.1: disabled state check is in get_unclean_dataset
|
||||||
|
|
|
@ -55,7 +55,7 @@ pub struct HTMLLinkElement {
|
||||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
|
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
|
||||||
parser_inserted: Cell<bool>,
|
parser_inserted: Cell<bool>,
|
||||||
/// The number of loads that this link element has triggered (could be more
|
/// The number of loads that this link element has triggered (could be more
|
||||||
/// than one because of imports) and have not yet finished.
|
/// than one because of imports) and have not yet finished.
|
||||||
|
@ -156,7 +156,7 @@ fn string_is_stylesheet(value: &Option<String>) -> bool {
|
||||||
|
|
||||||
/// Favicon spec usage in accordance with CEF implementation:
|
/// Favicon spec usage in accordance with CEF implementation:
|
||||||
/// only url of icon is required/used
|
/// only url of icon is required/used
|
||||||
/// https://html.spec.whatwg.org/multipage/#rel-icon
|
/// <https://html.spec.whatwg.org/multipage/#rel-icon>
|
||||||
fn is_favicon(value: &Option<String>) -> bool {
|
fn is_favicon(value: &Option<String>) -> bool {
|
||||||
match *value {
|
match *value {
|
||||||
Some(ref value) => {
|
Some(ref value) => {
|
||||||
|
@ -250,7 +250,7 @@ impl VirtualMethods for HTMLLinkElement {
|
||||||
|
|
||||||
|
|
||||||
impl HTMLLinkElement {
|
impl HTMLLinkElement {
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-link-obtain
|
/// <https://html.spec.whatwg.org/multipage/#concept-link-obtain>
|
||||||
fn handle_stylesheet_url(&self, href: &str) {
|
fn handle_stylesheet_url(&self, href: &str) {
|
||||||
let document = document_from_node(self);
|
let document = document_from_node(self);
|
||||||
if document.browsing_context().is_none() {
|
if document.browsing_context().is_none() {
|
||||||
|
|
|
@ -54,29 +54,29 @@ use time::{self, Timespec, Duration};
|
||||||
// media element event task source.
|
// media element event task source.
|
||||||
pub struct HTMLMediaElement {
|
pub struct HTMLMediaElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-networkstate
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||||
network_state: Cell<NetworkState>,
|
network_state: Cell<NetworkState>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-readystate
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
|
||||||
ready_state: Cell<ReadyState>,
|
ready_state: Cell<ReadyState>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-srcobject
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-srcobject>
|
||||||
src_object: MutNullableDom<Blob>,
|
src_object: MutNullableDom<Blob>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-currentsrc
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-currentsrc>
|
||||||
current_src: DomRefCell<String>,
|
current_src: DomRefCell<String>,
|
||||||
/// Incremented whenever tasks associated with this element are cancelled.
|
/// Incremented whenever tasks associated with this element are cancelled.
|
||||||
generation_id: Cell<u32>,
|
generation_id: Cell<u32>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#fire-loadeddata
|
/// <https://html.spec.whatwg.org/multipage/#fire-loadeddata>
|
||||||
///
|
///
|
||||||
/// Reset to false every time the load algorithm is invoked.
|
/// Reset to false every time the load algorithm is invoked.
|
||||||
fired_loadeddata_event: Cell<bool>,
|
fired_loadeddata_event: Cell<bool>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-error
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-error>
|
||||||
error: MutNullableDom<MediaError>,
|
error: MutNullableDom<MediaError>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-paused
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-paused>
|
||||||
paused: Cell<bool>,
|
paused: Cell<bool>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#attr-media-autoplay
|
/// <https://html.spec.whatwg.org/multipage/#attr-media-autoplay>
|
||||||
autoplaying: Cell<bool>,
|
autoplaying: Cell<bool>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag
|
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||||
delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>,
|
delaying_the_load_event_flag: DomRefCell<Option<LoadBlocker>>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises
|
/// <https://html.spec.whatwg.org/multipage/#list-of-pending-play-promises>
|
||||||
#[ignore_heap_size_of = "promises are hard"]
|
#[ignore_heap_size_of = "promises are hard"]
|
||||||
pending_play_promises: DomRefCell<Vec<Rc<Promise>>>,
|
pending_play_promises: DomRefCell<Vec<Rc<Promise>>>,
|
||||||
/// Play promises which are soon to be fulfilled by a queued task.
|
/// Play promises which are soon to be fulfilled by a queued task.
|
||||||
|
@ -84,7 +84,7 @@ pub struct HTMLMediaElement {
|
||||||
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
|
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-networkstate
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-networkstate>
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum NetworkState {
|
pub enum NetworkState {
|
||||||
|
@ -94,7 +94,7 @@ pub enum NetworkState {
|
||||||
NoSource = HTMLMediaElementConstants::NETWORK_NO_SOURCE as u8,
|
NoSource = HTMLMediaElementConstants::NETWORK_NO_SOURCE as u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-readystate
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-readystate>
|
||||||
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, HeapSizeOf, JSTraceable, PartialEq, PartialOrd)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
enum ReadyState {
|
enum ReadyState {
|
||||||
|
@ -145,7 +145,7 @@ impl HTMLMediaElement {
|
||||||
/// Nothing happens if the element was already delaying the load event and
|
/// Nothing happens if the element was already delaying the load event and
|
||||||
/// we pass true to that method again.
|
/// we pass true to that method again.
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag
|
/// <https://html.spec.whatwg.org/multipage/#delaying-the-load-event-flag>
|
||||||
fn delay_load_event(&self, delay: bool) {
|
fn delay_load_event(&self, delay: bool) {
|
||||||
let mut blocker = self.delaying_the_load_event_flag.borrow_mut();
|
let mut blocker = self.delaying_the_load_event_flag.borrow_mut();
|
||||||
if delay && blocker.is_none() {
|
if delay && blocker.is_none() {
|
||||||
|
@ -155,7 +155,7 @@ impl HTMLMediaElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-media-play
|
/// <https://html.spec.whatwg.org/multipage/#dom-media-play>
|
||||||
// FIXME(nox): Move this back to HTMLMediaElementMethods::Play once
|
// FIXME(nox): Move this back to HTMLMediaElementMethods::Play once
|
||||||
// Rc<Promise> doesn't require #[allow(unrooted_must_root)] anymore.
|
// Rc<Promise> doesn't require #[allow(unrooted_must_root)] anymore.
|
||||||
fn play(&self, promise: &Rc<Promise>) {
|
fn play(&self, promise: &Rc<Promise>) {
|
||||||
|
@ -236,7 +236,7 @@ impl HTMLMediaElement {
|
||||||
// Not applicable here, the promise is returned from Play.
|
// Not applicable here, the promise is returned from Play.
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#internal-pause-steps
|
/// <https://html.spec.whatwg.org/multipage/#internal-pause-steps>
|
||||||
fn internal_pause_steps(&self) {
|
fn internal_pause_steps(&self) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
self.autoplaying.set(false);
|
self.autoplaying.set(false);
|
||||||
|
@ -807,7 +807,7 @@ impl HTMLMediaElement {
|
||||||
|
|
||||||
/// Handles insertion of `source` children.
|
/// Handles insertion of `source` children.
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted
|
/// <https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted>
|
||||||
pub fn handle_source_child_insertion(&self) {
|
pub fn handle_source_child_insertion(&self) {
|
||||||
if self.upcast::<Element>().has_attribute(&local_name!("src")) {
|
if self.upcast::<Element>().has_attribute(&local_name!("src")) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -135,7 +135,7 @@ impl HTMLMetaElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#meta-referrer
|
/// <https://html.spec.whatwg.org/multipage/#meta-referrer>
|
||||||
fn apply_referrer(&self) {
|
fn apply_referrer(&self) {
|
||||||
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
|
if let Some(parent) = self.upcast::<Node>().GetParentElement() {
|
||||||
if let Some(head) = parent.downcast::<HTMLHeadElement>() {
|
if let Some(head) = parent.downcast::<HTMLHeadElement>() {
|
||||||
|
|
|
@ -32,10 +32,10 @@ use style::str::{split_html_space_chars, str_join};
|
||||||
pub struct HTMLOptionElement {
|
pub struct HTMLOptionElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#attr-option-selected
|
/// <https://html.spec.whatwg.org/multipage/#attr-option-selected>
|
||||||
selectedness: Cell<bool>,
|
selectedness: Cell<bool>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#concept-option-dirtiness
|
/// <https://html.spec.whatwg.org/multipage/#concept-option-dirtiness>
|
||||||
dirtiness: Cell<bool>,
|
dirtiness: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,13 @@ use uuid::Uuid;
|
||||||
pub struct HTMLScriptElement {
|
pub struct HTMLScriptElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#already-started
|
/// <https://html.spec.whatwg.org/multipage/#already-started>
|
||||||
already_started: Cell<bool>,
|
already_started: Cell<bool>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#parser-inserted
|
/// <https://html.spec.whatwg.org/multipage/#parser-inserted>
|
||||||
parser_inserted: Cell<bool>,
|
parser_inserted: Cell<bool>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#non-blocking
|
/// <https://html.spec.whatwg.org/multipage/#non-blocking>
|
||||||
///
|
///
|
||||||
/// (currently unused)
|
/// (currently unused)
|
||||||
non_blocking: Cell<bool>,
|
non_blocking: Cell<bool>,
|
||||||
|
@ -190,7 +190,7 @@ impl FetchResponseListener for ScriptContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#fetch-a-classic-script
|
/// <https://html.spec.whatwg.org/multipage/#fetch-a-classic-script>
|
||||||
/// step 4-9
|
/// step 4-9
|
||||||
fn process_response_eof(&mut self, response: Result<(), NetworkError>) {
|
fn process_response_eof(&mut self, response: Result<(), NetworkError>) {
|
||||||
// Step 5.
|
// Step 5.
|
||||||
|
@ -226,7 +226,7 @@ impl FetchResponseListener for ScriptContext {
|
||||||
|
|
||||||
impl PreInvoke for ScriptContext {}
|
impl PreInvoke for ScriptContext {}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#fetch-a-classic-script
|
/// <https://html.spec.whatwg.org/multipage/#fetch-a-classic-script>
|
||||||
fn fetch_a_classic_script(script: &HTMLScriptElement,
|
fn fetch_a_classic_script(script: &HTMLScriptElement,
|
||||||
kind: ExternalScriptKind,
|
kind: ExternalScriptKind,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
|
@ -286,7 +286,7 @@ fn fetch_a_classic_script(script: &HTMLScriptElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLScriptElement {
|
impl HTMLScriptElement {
|
||||||
/// https://html.spec.whatwg.org/multipage/#prepare-a-script
|
/// <https://html.spec.whatwg.org/multipage/#prepare-a-script>
|
||||||
pub fn prepare(&self) {
|
pub fn prepare(&self) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
if self.already_started.get() {
|
if self.already_started.get() {
|
||||||
|
@ -500,7 +500,7 @@ impl HTMLScriptElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#execute-the-script-block
|
/// <https://html.spec.whatwg.org/multipage/#execute-the-script-block>
|
||||||
pub fn execute(&self, result: Result<ClassicScript, NetworkError>) {
|
pub fn execute(&self, result: Result<ClassicScript, NetworkError>) {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let doc = document_from_node(self);
|
let doc = document_from_node(self);
|
||||||
|
|
|
@ -44,7 +44,7 @@ impl VirtualMethods for HTMLSourceElement {
|
||||||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted
|
/// <https://html.spec.whatwg.org/multipage/#the-source-element:nodes-are-inserted>
|
||||||
fn bind_to_tree(&self, tree_in_doc: bool) {
|
fn bind_to_tree(&self, tree_in_doc: bool) {
|
||||||
self.super_type().unwrap().bind_to_tree(tree_in_doc);
|
self.super_type().unwrap().bind_to_tree(tree_in_doc);
|
||||||
let parent = self.upcast::<Node>().GetParentNode().unwrap();
|
let parent = self.upcast::<Node>().GetParentNode().unwrap();
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct HTMLStyleElement {
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_heap_size_of = "Arc"]
|
||||||
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
stylesheet: DomRefCell<Option<Arc<Stylesheet>>>,
|
||||||
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
cssom_stylesheet: MutNullableDom<CSSStyleSheet>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts
|
/// <https://html.spec.whatwg.org/multipage/#a-style-sheet-that-is-blocking-scripts>
|
||||||
parser_inserted: Cell<bool>,
|
parser_inserted: Cell<bool>,
|
||||||
in_stack_of_open_elements: Cell<bool>,
|
in_stack_of_open_elements: Cell<bool>,
|
||||||
pending_loads: Cell<u32>,
|
pending_loads: Cell<u32>,
|
||||||
|
|
|
@ -20,7 +20,7 @@ use html5ever::{LocalName, Prefix};
|
||||||
pub struct HTMLTemplateElement {
|
pub struct HTMLTemplateElement {
|
||||||
htmlelement: HTMLElement,
|
htmlelement: HTMLElement,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#template-contents
|
/// <https://html.spec.whatwg.org/multipage/#template-contents>
|
||||||
contents: MutNullableDom<DocumentFragment>,
|
contents: MutNullableDom<DocumentFragment>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ impl HTMLTemplateElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLTemplateElementMethods for HTMLTemplateElement {
|
impl HTMLTemplateElementMethods for HTMLTemplateElement {
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-template-content
|
/// <https://html.spec.whatwg.org/multipage/#dom-template-content>
|
||||||
fn Content(&self) -> DomRoot<DocumentFragment> {
|
fn Content(&self) -> DomRoot<DocumentFragment> {
|
||||||
self.contents.or_init(|| {
|
self.contents.or_init(|| {
|
||||||
let doc = document_from_node(self);
|
let doc = document_from_node(self);
|
||||||
|
@ -60,7 +60,7 @@ impl VirtualMethods for HTMLTemplateElement {
|
||||||
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
Some(self.upcast::<HTMLElement>() as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#template-adopting-steps
|
/// <https://html.spec.whatwg.org/multipage/#template-adopting-steps>
|
||||||
fn adopting_steps(&self, old_doc: &Document) {
|
fn adopting_steps(&self, old_doc: &Document) {
|
||||||
self.super_type().unwrap().adopting_steps(old_doc);
|
self.super_type().unwrap().adopting_steps(old_doc);
|
||||||
// Step 1.
|
// Step 1.
|
||||||
|
@ -69,7 +69,7 @@ impl VirtualMethods for HTMLTemplateElement {
|
||||||
Node::adopt(self.Content().upcast(), &doc);
|
Node::adopt(self.Content().upcast(), &doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#the-template-element:concept-node-clone-ext
|
/// <https://html.spec.whatwg.org/multipage/#the-template-element:concept-node-clone-ext>
|
||||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||||
clone_children: CloneChildrenFlag) {
|
clone_children: CloneChildrenFlag) {
|
||||||
self.super_type().unwrap().cloning_steps(copy, maybe_doc, clone_children);
|
self.super_type().unwrap().cloning_steps(copy, maybe_doc, clone_children);
|
||||||
|
|
|
@ -134,7 +134,7 @@ impl WeakMediaQueryListVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Evaluate media query lists and report changes
|
/// Evaluate media query lists and report changes
|
||||||
/// https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes
|
/// <https://drafts.csswg.org/cssom-view/#evaluate-media-queries-and-report-changes>
|
||||||
pub fn evaluate_and_report_changes(&self) {
|
pub fn evaluate_and_report_changes(&self) {
|
||||||
rooted_vec!(let mut mql_list);
|
rooted_vec!(let mut mql_list);
|
||||||
self.cell.borrow_mut().update(|mql| {
|
self.cell.borrow_mut().update(|mql| {
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl MutationObserver {
|
||||||
Ok(observer)
|
Ok(observer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask
|
/// <https://dom.spec.whatwg.org/#queue-a-mutation-observer-compound-microtask>
|
||||||
pub fn queue_mutation_observer_compound_microtask() {
|
pub fn queue_mutation_observer_compound_microtask() {
|
||||||
// Step 1
|
// Step 1
|
||||||
if ScriptThread::is_mutation_observer_compound_microtask_queued() {
|
if ScriptThread::is_mutation_observer_compound_microtask_queued() {
|
||||||
|
@ -84,7 +84,7 @@ impl MutationObserver {
|
||||||
ScriptThread::enqueue_microtask(Microtask::NotifyMutationObservers);
|
ScriptThread::enqueue_microtask(Microtask::NotifyMutationObservers);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#notify-mutation-observers
|
/// <https://dom.spec.whatwg.org/#notify-mutation-observers>
|
||||||
pub fn notify_mutation_observers() {
|
pub fn notify_mutation_observers() {
|
||||||
// Step 1
|
// Step 1
|
||||||
ScriptThread::set_mutation_observer_compound_microtask_queued(false);
|
ScriptThread::set_mutation_observer_compound_microtask_queued(false);
|
||||||
|
@ -103,7 +103,7 @@ impl MutationObserver {
|
||||||
// TODO: Step 6 (slot signals)
|
// TODO: Step 6 (slot signals)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#queueing-a-mutation-record
|
/// <https://dom.spec.whatwg.org/#queueing-a-mutation-record>
|
||||||
pub fn queue_a_mutation_record(target: &Node, attr_type: Mutation) {
|
pub fn queue_a_mutation_record(target: &Node, attr_type: Mutation) {
|
||||||
// Step 1
|
// Step 1
|
||||||
let mut interestedObservers: Vec<(DomRoot<MutationObserver>, Option<DOMString>)> = vec![];
|
let mut interestedObservers: Vec<(DomRoot<MutationObserver>, Option<DOMString>)> = vec![];
|
||||||
|
@ -182,7 +182,7 @@ impl MutationObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MutationObserverMethods for MutationObserver {
|
impl MutationObserverMethods for MutationObserver {
|
||||||
/// https://dom.spec.whatwg.org/#dom-mutationobserver-observe
|
/// <https://dom.spec.whatwg.org/#dom-mutationobserver-observe>
|
||||||
fn Observe(&self, target: &Node, options: &MutationObserverInit) -> Fallible<()> {
|
fn Observe(&self, target: &Node, options: &MutationObserverInit) -> Fallible<()> {
|
||||||
let attribute_filter = options.attributeFilter.clone().unwrap_or(vec![]);
|
let attribute_filter = options.attributeFilter.clone().unwrap_or(vec![]);
|
||||||
let attribute_old_value = options.attributeOldValue.unwrap_or(false);
|
let attribute_old_value = options.attributeOldValue.unwrap_or(false);
|
||||||
|
|
|
@ -198,8 +198,8 @@ impl Drop for Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// suppress observers flag
|
/// suppress observers flag
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-insert
|
/// <https://dom.spec.whatwg.org/#concept-node-insert>
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||||
#[derive(Clone, Copy, HeapSizeOf)]
|
#[derive(Clone, Copy, HeapSizeOf)]
|
||||||
enum SuppressObserver {
|
enum SuppressObserver {
|
||||||
Suppressed,
|
Suppressed,
|
||||||
|
@ -764,7 +764,7 @@ impl Node {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#scope-match-a-selectors-string
|
/// <https://dom.spec.whatwg.org/#scope-match-a-selectors-string>
|
||||||
/// Get an iterator over all nodes which match a set of selectors
|
/// Get an iterator over all nodes which match a set of selectors
|
||||||
/// Be careful not to do anything which may manipulate the DOM tree
|
/// Be careful not to do anything which may manipulate the DOM tree
|
||||||
/// whilst iterating, otherwise the iterator may be invalidated.
|
/// whilst iterating, otherwise the iterator may be invalidated.
|
||||||
|
@ -1887,7 +1887,7 @@ impl Node {
|
||||||
copy
|
copy
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#child-text-content
|
/// <https://html.spec.whatwg.org/multipage/#child-text-content>
|
||||||
pub fn child_text_content(&self) -> DOMString {
|
pub fn child_text_content(&self) -> DOMString {
|
||||||
Node::collect_text_contents(self.children())
|
Node::collect_text_contents(self.children())
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,12 +35,12 @@ impl PaintSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PaintSizeMethods for PaintSize {
|
impl PaintSizeMethods for PaintSize {
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paintsize
|
/// <https://drafts.css-houdini.org/css-paint-api/#paintsize>
|
||||||
fn Width(&self) -> Finite<f64> {
|
fn Width(&self) -> Finite<f64> {
|
||||||
self.width
|
self.width
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paintsize
|
/// <https://drafts.css-houdini.org/css-paint-api/#paintsize>
|
||||||
fn Height(&self) -> Finite<f64> {
|
fn Height(&self) -> Finite<f64> {
|
||||||
self.height
|
self.height
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ use style_traits::CSSPixel;
|
||||||
use style_traits::DevicePixel;
|
use style_traits::DevicePixel;
|
||||||
use style_traits::SpeculativePainter;
|
use style_traits::SpeculativePainter;
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope
|
/// <https://drafts.css-houdini.org/css-paint-api/#paintworkletglobalscope>
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct PaintWorkletGlobalScope {
|
pub struct PaintWorkletGlobalScope {
|
||||||
/// The worklet global for this object
|
/// The worklet global for this object
|
||||||
|
@ -70,9 +70,9 @@ pub struct PaintWorkletGlobalScope {
|
||||||
/// The image cache
|
/// The image cache
|
||||||
#[ignore_heap_size_of = "Arc"]
|
#[ignore_heap_size_of = "Arc"]
|
||||||
image_cache: Arc<ImageCache>,
|
image_cache: Arc<ImageCache>,
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-definitions
|
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions>
|
||||||
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
|
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-class-instances
|
/// <https://drafts.css-houdini.org/css-paint-api/#paint-class-instances>
|
||||||
paint_class_instances: DomRefCell<HashMap<Atom, Box<Heap<JSVal>>>>,
|
paint_class_instances: DomRefCell<HashMap<Atom, Box<Heap<JSVal>>>>,
|
||||||
/// The most recent name the worklet was called with
|
/// The most recent name the worklet was called with
|
||||||
cached_name: DomRefCell<Atom>,
|
cached_name: DomRefCell<Atom>,
|
||||||
|
@ -169,7 +169,7 @@ impl PaintWorkletGlobalScope {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image
|
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
|
||||||
fn draw_a_paint_image(&self,
|
fn draw_a_paint_image(&self,
|
||||||
name: &Atom,
|
name: &Atom,
|
||||||
size_in_px: TypedSize2D<f32, CSSPixel>,
|
size_in_px: TypedSize2D<f32, CSSPixel>,
|
||||||
|
@ -187,7 +187,7 @@ impl PaintWorkletGlobalScope {
|
||||||
self.invoke_a_paint_callback(name, size_in_px, size_in_dpx, device_pixel_ratio, properties, arguments)
|
self.invoke_a_paint_callback(name, size_in_px, size_in_dpx, device_pixel_ratio, properties, arguments)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback
|
/// <https://drafts.css-houdini.org/css-paint-api/#invoke-a-paint-callback>
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn invoke_a_paint_callback(&self,
|
fn invoke_a_paint_callback(&self,
|
||||||
name: &Atom,
|
name: &Atom,
|
||||||
|
@ -367,7 +367,7 @@ impl PaintWorkletGlobalScope {
|
||||||
impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
|
impl PaintWorkletGlobalScopeMethods for PaintWorkletGlobalScope {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#dom-paintworkletglobalscope-registerpaint
|
/// <https://drafts.css-houdini.org/css-paint-api/#dom-paintworkletglobalscope-registerpaint>
|
||||||
fn RegisterPaint(&self, name: DOMString, paint_ctor: Rc<VoidFunction>) -> Fallible<()> {
|
fn RegisterPaint(&self, name: DOMString, paint_ctor: Rc<VoidFunction>) -> Fallible<()> {
|
||||||
let name = Atom::from(name);
|
let name = Atom::from(name);
|
||||||
let cx = self.worklet_global.get_cx();
|
let cx = self.worklet_global.get_cx();
|
||||||
|
@ -461,7 +461,7 @@ pub enum PaintWorkletTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A paint definition
|
/// A paint definition
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#paint-definition
|
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definition>
|
||||||
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
|
/// This type is dangerous, because it contains uboxed `Heap<JSVal>` values,
|
||||||
/// which can't be moved.
|
/// which can't be moved.
|
||||||
#[derive(HeapSizeOf, JSTraceable)]
|
#[derive(HeapSizeOf, JSTraceable)]
|
||||||
|
|
|
@ -199,7 +199,7 @@ impl Performance {
|
||||||
/// notify the observers if no other notification task is already queued.
|
/// notify the observers if no other notification task is already queued.
|
||||||
///
|
///
|
||||||
/// Algorithm spec:
|
/// Algorithm spec:
|
||||||
/// https://w3c.github.io/performance-timeline/#queue-a-performanceentry
|
/// <https://w3c.github.io/performance-timeline/#queue-a-performanceentry>
|
||||||
pub fn queue_entry(&self, entry: &PerformanceEntry,
|
pub fn queue_entry(&self, entry: &PerformanceEntry,
|
||||||
add_to_performance_entries_buffer: bool) {
|
add_to_performance_entries_buffer: bool) {
|
||||||
// Steps 1-3.
|
// Steps 1-3.
|
||||||
|
@ -233,7 +233,7 @@ impl Performance {
|
||||||
/// Observers notifications task.
|
/// Observers notifications task.
|
||||||
///
|
///
|
||||||
/// Algorithm spec (step 7):
|
/// Algorithm spec (step 7):
|
||||||
/// https://w3c.github.io/performance-timeline/#queue-a-performanceentry
|
/// <https://w3c.github.io/performance-timeline/#queue-a-performanceentry>
|
||||||
pub fn notify_observers(&self) {
|
pub fn notify_observers(&self) {
|
||||||
// Step 7.1.
|
// Step 7.1.
|
||||||
self.pending_notification_observers_task.set(false);
|
self.pending_notification_observers_task.set(false);
|
||||||
|
|
|
@ -1031,19 +1031,19 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 2.1-2. when inserting a node.
|
/// Used for steps 2.1-2. when inserting a node.
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-insert
|
/// <https://dom.spec.whatwg.org/#concept-node-insert>
|
||||||
pub fn increase_above(&self, node: &Node, offset: u32, delta: u32) {
|
pub fn increase_above(&self, node: &Node, offset: u32, delta: u32) {
|
||||||
self.map_offset_above(node, offset, |offset| offset + delta);
|
self.map_offset_above(node, offset, |offset| offset + delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 4-5. when removing a node.
|
/// Used for steps 4-5. when removing a node.
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||||
pub fn decrease_above(&self, node: &Node, offset: u32, delta: u32) {
|
pub fn decrease_above(&self, node: &Node, offset: u32, delta: u32) {
|
||||||
self.map_offset_above(node, offset, |offset| offset - delta);
|
self.map_offset_above(node, offset, |offset| offset - delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 2-3. when removing a node.
|
/// Used for steps 2-3. when removing a node.
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-remove
|
/// <https://dom.spec.whatwg.org/#concept-node-remove>
|
||||||
pub fn drain_to_parent(&self, context: &UnbindContext, child: &Node) {
|
pub fn drain_to_parent(&self, context: &UnbindContext, child: &Node) {
|
||||||
if self.is_empty() {
|
if self.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
@ -1072,7 +1072,7 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 7.1-2. when normalizing a node.
|
/// Used for steps 7.1-2. when normalizing a node.
|
||||||
/// https://dom.spec.whatwg.org/#dom-node-normalize
|
/// <https://dom.spec.whatwg.org/#dom-node-normalize>
|
||||||
pub fn drain_to_preceding_text_sibling(&self, node: &Node, sibling: &Node, length: u32) {
|
pub fn drain_to_preceding_text_sibling(&self, node: &Node, sibling: &Node, length: u32) {
|
||||||
if self.is_empty() {
|
if self.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
@ -1099,7 +1099,7 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 7.3-4. when normalizing a node.
|
/// Used for steps 7.3-4. when normalizing a node.
|
||||||
/// https://dom.spec.whatwg.org/#dom-node-normalize
|
/// <https://dom.spec.whatwg.org/#dom-node-normalize>
|
||||||
pub fn move_to_text_child_at(&self,
|
pub fn move_to_text_child_at(&self,
|
||||||
node: &Node, offset: u32,
|
node: &Node, offset: u32,
|
||||||
child: &Node, new_offset: u32) {
|
child: &Node, new_offset: u32) {
|
||||||
|
@ -1142,7 +1142,7 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 8-11. when replacing character data.
|
/// Used for steps 8-11. when replacing character data.
|
||||||
/// https://dom.spec.whatwg.org/#concept-cd-replace
|
/// <https://dom.spec.whatwg.org/#concept-cd-replace>
|
||||||
pub fn replace_code_units(&self,
|
pub fn replace_code_units(&self,
|
||||||
node: &Node, offset: u32,
|
node: &Node, offset: u32,
|
||||||
removed_code_units: u32, added_code_units: u32) {
|
removed_code_units: u32, added_code_units: u32) {
|
||||||
|
@ -1156,7 +1156,7 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 7.2-3. when splitting a text node.
|
/// Used for steps 7.2-3. when splitting a text node.
|
||||||
/// https://dom.spec.whatwg.org/#concept-text-split
|
/// <https://dom.spec.whatwg.org/#concept-text-split>
|
||||||
pub fn move_to_following_text_sibling_above(&self,
|
pub fn move_to_following_text_sibling_above(&self,
|
||||||
node: &Node, offset: u32,
|
node: &Node, offset: u32,
|
||||||
sibling: &Node) {
|
sibling: &Node) {
|
||||||
|
@ -1202,7 +1202,7 @@ impl WeakRangeVec {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used for steps 7.4-5. when splitting a text node.
|
/// Used for steps 7.4-5. when splitting a text node.
|
||||||
/// https://dom.spec.whatwg.org/#concept-text-split
|
/// <https://dom.spec.whatwg.org/#concept-text-split>
|
||||||
pub fn increment_at(&self, node: &Node, offset: u32) {
|
pub fn increment_at(&self, node: &Node, offset: u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.cell.get()).update(|entry| {
|
(*self.cell.get()).update(|entry| {
|
||||||
|
|
|
@ -730,7 +730,7 @@ impl TreeSink for Sink {
|
||||||
self.send_op(ParseOperation::ReparentChildren { parent: parent.id, new_parent: new_parent.id });
|
self.send_op(ParseOperation::ReparentChildren { parent: parent.id, new_parent: new_parent.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#html-integration-point
|
/// <https://html.spec.whatwg.org/multipage/#html-integration-point>
|
||||||
/// Specifically, the <annotation-xml> cases.
|
/// Specifically, the <annotation-xml> cases.
|
||||||
fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {
|
fn is_mathml_annotation_xml_integration_point(&self, handle: &Self::Handle) -> bool {
|
||||||
let node_data = self.get_parse_node_data(&handle.id);
|
let node_data = self.get_parse_node_data(&handle.id);
|
||||||
|
|
|
@ -88,11 +88,11 @@ pub struct ServoParser {
|
||||||
last_chunk_received: Cell<bool>,
|
last_chunk_received: Cell<bool>,
|
||||||
/// Whether this parser should avoid passing any further data to the tokenizer.
|
/// Whether this parser should avoid passing any further data to the tokenizer.
|
||||||
suspended: Cell<bool>,
|
suspended: Cell<bool>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#script-nesting-level
|
/// <https://html.spec.whatwg.org/multipage/#script-nesting-level>
|
||||||
script_nesting_level: Cell<usize>,
|
script_nesting_level: Cell<usize>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#abort-a-parser
|
/// <https://html.spec.whatwg.org/multipage/#abort-a-parser>
|
||||||
aborted: Cell<bool>,
|
aborted: Cell<bool>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#script-created-parser
|
/// <https://html.spec.whatwg.org/multipage/#script-created-parser>
|
||||||
script_created_parser: bool,
|
script_created_parser: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ impl ServoParser {
|
||||||
|
|
||||||
/// Corresponds to the latter part of the "Otherwise" branch of the 'An end
|
/// Corresponds to the latter part of the "Otherwise" branch of the 'An end
|
||||||
/// tag whose tag name is "script"' of
|
/// tag whose tag name is "script"' of
|
||||||
/// https://html.spec.whatwg.org/multipage/#parsing-main-incdata
|
/// <https://html.spec.whatwg.org/multipage/#parsing-main-incdata>
|
||||||
///
|
///
|
||||||
/// This first moves everything from the script input to the beginning of
|
/// This first moves everything from the script input to the beginning of
|
||||||
/// the network input, effectively resetting the insertion point to just
|
/// the network input, effectively resetting the insertion point to just
|
||||||
|
@ -930,7 +930,7 @@ impl TreeSink for Sink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#html-integration-point
|
/// <https://html.spec.whatwg.org/multipage/#html-integration-point>
|
||||||
/// Specifically, the <annotation-xml> cases.
|
/// Specifically, the <annotation-xml> cases.
|
||||||
fn is_mathml_annotation_xml_integration_point(&self, handle: &Dom<Node>) -> bool {
|
fn is_mathml_annotation_xml_integration_point(&self, handle: &Dom<Node>) -> bool {
|
||||||
let elem = handle.downcast::<Element>().unwrap();
|
let elem = handle.downcast::<Element>().unwrap();
|
||||||
|
|
|
@ -147,7 +147,7 @@ impl StorageMethods for Storage {
|
||||||
|
|
||||||
|
|
||||||
impl Storage {
|
impl Storage {
|
||||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
/// <https://html.spec.whatwg.org/multipage/#send-a-storage-notification>
|
||||||
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
|
fn broadcast_change_notification(&self, key: Option<String>, old_value: Option<String>,
|
||||||
new_value: Option<String>) {
|
new_value: Option<String>) {
|
||||||
let storage = self.storage_type;
|
let storage = self.storage_type;
|
||||||
|
@ -156,7 +156,7 @@ impl Storage {
|
||||||
self.global().script_to_constellation_chan().send(msg).unwrap();
|
self.global().script_to_constellation_chan().send(msg).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
/// <https://html.spec.whatwg.org/multipage/#send-a-storage-notification>
|
||||||
pub fn queue_storage_event(
|
pub fn queue_storage_event(
|
||||||
&self,
|
&self,
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
|
|
|
@ -53,19 +53,19 @@ impl StylePropertyMapReadOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
|
impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
|
||||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get
|
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-get>
|
||||||
fn Get(&self, property: DOMString) -> Option<DomRoot<CSSStyleValue>> {
|
fn Get(&self, property: DOMString) -> Option<DomRoot<CSSStyleValue>> {
|
||||||
// TODO: avoid constructing an Atom
|
// TODO: avoid constructing an Atom
|
||||||
self.entries.get(&Atom::from(property)).map(|value| DomRoot::from_ref(&**value))
|
self.entries.get(&Atom::from(property)).map(|value| DomRoot::from_ref(&**value))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-has
|
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-has>
|
||||||
fn Has(&self, property: DOMString) -> bool {
|
fn Has(&self, property: DOMString) -> bool {
|
||||||
// TODO: avoid constructing an Atom
|
// TODO: avoid constructing an Atom
|
||||||
self.entries.contains_key(&Atom::from(property))
|
self.entries.contains_key(&Atom::from(property))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getproperties
|
/// <https://drafts.css-houdini.org/css-typed-om-1/#dom-stylepropertymapreadonly-getproperties>
|
||||||
fn GetProperties(&self) -> Vec<DOMString> {
|
fn GetProperties(&self) -> Vec<DOMString> {
|
||||||
let mut result: Vec<DOMString> = self.entries.keys()
|
let mut result: Vec<DOMString> = self.entries.keys()
|
||||||
.map(|key| DOMString::from(&**key))
|
.map(|key| DOMString::from(&**key))
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl TextDecoder {
|
||||||
TextDecoderBinding::Wrap)
|
TextDecoderBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://encoding.spec.whatwg.org/#dom-textdecoder
|
/// <https://encoding.spec.whatwg.org/#dom-textdecoder>
|
||||||
pub fn Constructor(global: &GlobalScope,
|
pub fn Constructor(global: &GlobalScope,
|
||||||
label: DOMString,
|
label: DOMString,
|
||||||
options: &TextDecoderBinding::TextDecoderOptions)
|
options: &TextDecoderBinding::TextDecoderOptions)
|
||||||
|
|
|
@ -60,42 +60,42 @@ impl Touch {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TouchMethods for Touch {
|
impl TouchMethods for Touch {
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-identifier
|
/// <https://w3c.github.io/touch-events/#widl-Touch-identifier>
|
||||||
fn Identifier(&self) -> i32 {
|
fn Identifier(&self) -> i32 {
|
||||||
self.identifier
|
self.identifier
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-target
|
/// <https://w3c.github.io/touch-events/#widl-Touch-target>
|
||||||
fn Target(&self) -> DomRoot<EventTarget> {
|
fn Target(&self) -> DomRoot<EventTarget> {
|
||||||
self.target.get()
|
self.target.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-screenX
|
/// <https://w3c.github.io/touch-events/#widl-Touch-screenX>
|
||||||
fn ScreenX(&self) -> Finite<f64> {
|
fn ScreenX(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.screen_x)
|
Finite::wrap(self.screen_x)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-screenY
|
/// <https://w3c.github.io/touch-events/#widl-Touch-screenY>
|
||||||
fn ScreenY(&self) -> Finite<f64> {
|
fn ScreenY(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.screen_y)
|
Finite::wrap(self.screen_y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientX
|
/// <https://w3c.github.io/touch-events/#widl-Touch-clientX>
|
||||||
fn ClientX(&self) -> Finite<f64> {
|
fn ClientX(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.client_x)
|
Finite::wrap(self.client_x)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientY
|
/// <https://w3c.github.io/touch-events/#widl-Touch-clientY>
|
||||||
fn ClientY(&self) -> Finite<f64> {
|
fn ClientY(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.client_y)
|
Finite::wrap(self.client_y)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientX
|
/// <https://w3c.github.io/touch-events/#widl-Touch-clientX>
|
||||||
fn PageX(&self) -> Finite<f64> {
|
fn PageX(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.page_x)
|
Finite::wrap(self.page_x)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-Touch-clientY
|
/// <https://w3c.github.io/touch-events/#widl-Touch-clientY>
|
||||||
fn PageY(&self) -> Finite<f64> {
|
fn PageY(&self) -> Finite<f64> {
|
||||||
Finite::wrap(self.page_y)
|
Finite::wrap(self.page_y)
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,42 +80,42 @@ impl TouchEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TouchEventMethods for &'a TouchEvent {
|
impl<'a> TouchEventMethods for &'a TouchEvent {
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-ctrlKey
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-ctrlKey>
|
||||||
fn CtrlKey(&self) -> bool {
|
fn CtrlKey(&self) -> bool {
|
||||||
self.ctrl_key.get()
|
self.ctrl_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-shiftKey
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-shiftKey>
|
||||||
fn ShiftKey(&self) -> bool {
|
fn ShiftKey(&self) -> bool {
|
||||||
self.shift_key.get()
|
self.shift_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-altKey
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-altKey>
|
||||||
fn AltKey(&self) -> bool {
|
fn AltKey(&self) -> bool {
|
||||||
self.alt_key.get()
|
self.alt_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-metaKey
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-metaKey>
|
||||||
fn MetaKey(&self) -> bool {
|
fn MetaKey(&self) -> bool {
|
||||||
self.meta_key.get()
|
self.meta_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEventInit-touches
|
/// <https://w3c.github.io/touch-events/#widl-TouchEventInit-touches>
|
||||||
fn Touches(&self) -> DomRoot<TouchList> {
|
fn Touches(&self) -> DomRoot<TouchList> {
|
||||||
self.touches.get()
|
self.touches.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-targetTouches>
|
||||||
fn TargetTouches(&self) -> DomRoot<TouchList> {
|
fn TargetTouches(&self) -> DomRoot<TouchList> {
|
||||||
self.target_touches.get()
|
self.target_touches.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches
|
/// <https://w3c.github.io/touch-events/#widl-TouchEvent-changedTouches>
|
||||||
fn ChangedTouches(&self) -> DomRoot<TouchList> {
|
fn ChangedTouches(&self) -> DomRoot<TouchList> {
|
||||||
self.changed_touches.get()
|
self.changed_touches.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#dom-event-istrusted
|
/// <https://dom.spec.whatwg.org/#dom-event-istrusted>
|
||||||
fn IsTrusted(&self) -> bool {
|
fn IsTrusted(&self) -> bool {
|
||||||
self.uievent.IsTrusted()
|
self.uievent.IsTrusted()
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,17 +31,17 @@ impl TouchList {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TouchListMethods for TouchList {
|
impl TouchListMethods for TouchList {
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchList-length
|
/// <https://w3c.github.io/touch-events/#widl-TouchList-length>
|
||||||
fn Length(&self) -> u32 {
|
fn Length(&self) -> u32 {
|
||||||
self.touches.len() as u32
|
self.touches.len() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index
|
/// <https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index>
|
||||||
fn Item(&self, index: u32) -> Option<DomRoot<Touch>> {
|
fn Item(&self, index: u32) -> Option<DomRoot<Touch>> {
|
||||||
self.touches.get(index as usize).map(|js| DomRoot::from_ref(&**js))
|
self.touches.get(index as usize).map(|js| DomRoot::from_ref(&**js))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index
|
/// <https://w3c.github.io/touch-events/#widl-TouchList-item-getter-Touch-unsigned-long-index>
|
||||||
fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Touch>> {
|
fn IndexedGetter(&self, index: u32) -> Option<DomRoot<Touch>> {
|
||||||
self.Item(index)
|
self.Item(index)
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,8 @@ pub trait VirtualMethods {
|
||||||
fn super_type(&self) -> Option<&VirtualMethods>;
|
fn super_type(&self) -> Option<&VirtualMethods>;
|
||||||
|
|
||||||
/// Called when attributes of a node are mutated.
|
/// Called when attributes of a node are mutated.
|
||||||
/// https://dom.spec.whatwg.org/#attribute-is-set
|
/// <https://dom.spec.whatwg.org/#attribute-is-set>
|
||||||
/// https://dom.spec.whatwg.org/#attribute-is-removed
|
/// <https://dom.spec.whatwg.org/#attribute-is-removed>
|
||||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||||
if let Some(s) = self.super_type() {
|
if let Some(s) = self.super_type() {
|
||||||
s.attribute_mutated(attr, mutation);
|
s.attribute_mutated(attr, mutation);
|
||||||
|
@ -100,7 +100,7 @@ pub trait VirtualMethods {
|
||||||
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
||||||
/// indicates whether the tree is part of a Document.
|
/// indicates whether the tree is part of a Document.
|
||||||
/// Implements removing steps:
|
/// Implements removing steps:
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-remove-ext
|
/// <https://dom.spec.whatwg.org/#concept-node-remove-ext>
|
||||||
fn unbind_from_tree(&self, context: &UnbindContext) {
|
fn unbind_from_tree(&self, context: &UnbindContext) {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.unbind_from_tree(context);
|
s.unbind_from_tree(context);
|
||||||
|
@ -121,14 +121,14 @@ pub trait VirtualMethods {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-adopt-ext
|
/// <https://dom.spec.whatwg.org/#concept-node-adopt-ext>
|
||||||
fn adopting_steps(&self, old_doc: &Document) {
|
fn adopting_steps(&self, old_doc: &Document) {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.adopting_steps(old_doc);
|
s.adopting_steps(old_doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#concept-node-clone-ext
|
/// <https://dom.spec.whatwg.org/#concept-node-clone-ext>
|
||||||
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
fn cloning_steps(&self, copy: &Node, maybe_doc: Option<&Document>,
|
||||||
clone_children: CloneChildrenFlag) {
|
clone_children: CloneChildrenFlag) {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
|
|
|
@ -270,7 +270,7 @@ pub struct TexImage2DValidatorResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TexImage2d validator as per
|
/// TexImage2d validator as per
|
||||||
/// https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml
|
/// <https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml>
|
||||||
impl<'a> WebGLValidator for TexImage2DValidator<'a> {
|
impl<'a> WebGLValidator for TexImage2DValidator<'a> {
|
||||||
type ValidatedOutput = TexImage2DValidatorResult;
|
type ValidatedOutput = TexImage2DValidatorResult;
|
||||||
type Error = TexImageValidationError;
|
type Error = TexImageValidationError;
|
||||||
|
|
|
@ -129,7 +129,7 @@ impl WebSocket {
|
||||||
global, WebSocketBinding::Wrap)
|
global, WebSocketBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-websocket
|
/// <https://html.spec.whatwg.org/multipage/#dom-websocket>
|
||||||
pub fn Constructor(global: &GlobalScope,
|
pub fn Constructor(global: &GlobalScope,
|
||||||
url: DOMString,
|
url: DOMString,
|
||||||
protocols: Option<StringOrStringSequence>)
|
protocols: Option<StringOrStringSequence>)
|
||||||
|
@ -391,14 +391,14 @@ impl WebSocketMethods for WebSocket {
|
||||||
|
|
||||||
|
|
||||||
/// Task queued when *the WebSocket connection is established*.
|
/// Task queued when *the WebSocket connection is established*.
|
||||||
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
|
/// <https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established>
|
||||||
struct ConnectionEstablishedTask {
|
struct ConnectionEstablishedTask {
|
||||||
address: Trusted<WebSocket>,
|
address: Trusted<WebSocket>,
|
||||||
protocol_in_use: Option<String>,
|
protocol_in_use: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TaskOnce for ConnectionEstablishedTask {
|
impl TaskOnce for ConnectionEstablishedTask {
|
||||||
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
|
/// <https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established>
|
||||||
fn run_once(self) {
|
fn run_once(self) {
|
||||||
let ws = self.address.root();
|
let ws = self.address.root();
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ pub struct Window {
|
||||||
|
|
||||||
/// Worklets
|
/// Worklets
|
||||||
test_worklet: MutNullableDom<Worklet>,
|
test_worklet: MutNullableDom<Worklet>,
|
||||||
/// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
|
/// <https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet>
|
||||||
paint_worklet: MutNullableDom<Worklet>,
|
paint_worklet: MutNullableDom<Worklet>,
|
||||||
/// The Webrender Document id associated with this window.
|
/// The Webrender Document id associated with this window.
|
||||||
#[ignore_heap_size_of = "defined in webrender_api"]
|
#[ignore_heap_size_of = "defined in webrender_api"]
|
||||||
|
@ -360,7 +360,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the window proxy if it has not been discarded.
|
/// Returns the window proxy if it has not been discarded.
|
||||||
/// https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded
|
/// <https://html.spec.whatwg.org/multipage/#a-browsing-context-is-discarded>
|
||||||
pub fn undiscarded_window_proxy(&self) -> Option<DomRoot<WindowProxy>> {
|
pub fn undiscarded_window_proxy(&self) -> Option<DomRoot<WindowProxy>> {
|
||||||
self.window_proxy.get()
|
self.window_proxy.get()
|
||||||
.and_then(|window_proxy| if window_proxy.is_browsing_context_discarded() {
|
.and_then(|window_proxy| if window_proxy.is_browsing_context_discarded() {
|
||||||
|
@ -742,13 +742,13 @@ impl WindowMethods for Window {
|
||||||
base64_atob(atob)
|
base64_atob(atob)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe
|
/// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe>
|
||||||
fn RequestAnimationFrame(&self, callback: Rc<FrameRequestCallback>) -> u32 {
|
fn RequestAnimationFrame(&self, callback: Rc<FrameRequestCallback>) -> u32 {
|
||||||
self.Document()
|
self.Document()
|
||||||
.request_animation_frame(AnimationFrameCallback::FrameRequestCallback { callback })
|
.request_animation_frame(AnimationFrameCallback::FrameRequestCallback { callback })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
|
/// <https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe>
|
||||||
fn CancelAnimationFrame(&self, ident: u32) {
|
fn CancelAnimationFrame(&self, ident: u32) {
|
||||||
let doc = self.Document();
|
let doc = self.Document();
|
||||||
doc.cancel_animation_frame(ident);
|
doc.cancel_animation_frame(ident);
|
||||||
|
@ -1090,7 +1090,7 @@ impl Window {
|
||||||
self.ignore_further_async_events.borrow().store(true, Ordering::SeqCst);
|
self.ignore_further_async_events.borrow().store(true, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/cssom-view/#dom-window-scroll
|
/// <https://drafts.csswg.org/cssom-view/#dom-window-scroll>
|
||||||
pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) {
|
pub fn scroll(&self, x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||||
// Step 3
|
// Step 3
|
||||||
let xfinite = if x_.is_finite() { x_ } else { 0.0f64 };
|
let xfinite = if x_.is_finite() { x_ } else { 0.0f64 };
|
||||||
|
@ -1144,7 +1144,7 @@ impl Window {
|
||||||
None);
|
None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/cssom-view/#perform-a-scroll
|
/// <https://drafts.csswg.org/cssom-view/#perform-a-scroll>
|
||||||
pub fn perform_a_scroll(&self,
|
pub fn perform_a_scroll(&self,
|
||||||
x: f32,
|
x: f32,
|
||||||
y: f32,
|
y: f32,
|
||||||
|
|
|
@ -74,7 +74,7 @@ const WORKLET_THREAD_POOL_SIZE: u32 = 3;
|
||||||
const MIN_GC_THRESHOLD: u32 = 1_000_000;
|
const MIN_GC_THRESHOLD: u32 = 1_000_000;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
/// https://drafts.css-houdini.org/worklets/#worklet
|
/// <https://drafts.css-houdini.org/worklets/#worklet>
|
||||||
pub struct Worklet {
|
pub struct Worklet {
|
||||||
reflector: Reflector,
|
reflector: Reflector,
|
||||||
window: Dom<Window>,
|
window: Dom<Window>,
|
||||||
|
@ -109,7 +109,7 @@ impl Worklet {
|
||||||
|
|
||||||
impl WorkletMethods for Worklet {
|
impl WorkletMethods for Worklet {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
/// https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule
|
/// <https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule>
|
||||||
fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc<Promise> {
|
fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc<Promise> {
|
||||||
// Step 1.
|
// Step 1.
|
||||||
let promise = Promise::new(self.window.upcast());
|
let promise = Promise::new(self.window.upcast());
|
||||||
|
@ -159,7 +159,7 @@ impl WorkletId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/worklets/#pending-tasks-struct
|
/// <https://drafts.css-houdini.org/worklets/#pending-tasks-struct>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct PendingTasksStruct(Arc<AtomicIsize>);
|
struct PendingTasksStruct(Arc<AtomicIsize>);
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ impl WorkletThreadPool {
|
||||||
/// Loads a worklet module into every worklet thread.
|
/// Loads a worklet module into every worklet thread.
|
||||||
/// If all of the threads load successfully, the promise is resolved.
|
/// If all of the threads load successfully, the promise is resolved.
|
||||||
/// If any of the threads fails to load, the promise is rejected.
|
/// If any of the threads fails to load, the promise is rejected.
|
||||||
/// https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
|
/// <https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script>
|
||||||
fn fetch_and_invoke_a_worklet_script(&self,
|
fn fetch_and_invoke_a_worklet_script(&self,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
worklet_id: WorkletId,
|
worklet_id: WorkletId,
|
||||||
|
@ -552,7 +552,7 @@ impl WorkletThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fetch and invoke a worklet script.
|
/// Fetch and invoke a worklet script.
|
||||||
/// https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
|
/// <https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script>
|
||||||
fn fetch_and_invoke_a_worklet_script(&self,
|
fn fetch_and_invoke_a_worklet_script(&self,
|
||||||
global_scope: &WorkletGlobalScope,
|
global_scope: &WorkletGlobalScope,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
|
|
|
@ -33,7 +33,7 @@ use std::sync::Arc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
/// https://drafts.css-houdini.org/worklets/#workletglobalscope
|
/// <https://drafts.css-houdini.org/worklets/#workletglobalscope>
|
||||||
pub struct WorkletGlobalScope {
|
pub struct WorkletGlobalScope {
|
||||||
/// The global for this worklet.
|
/// The global for this worklet.
|
||||||
globalscope: GlobalScope,
|
globalscope: GlobalScope,
|
||||||
|
@ -154,7 +154,7 @@ pub struct WorkletGlobalScopeInit {
|
||||||
pub image_cache: Arc<ImageCache>,
|
pub image_cache: Arc<ImageCache>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.css-houdini.org/worklets/#worklet-global-scope-type
|
/// <https://drafts.css-houdini.org/worklets/#worklet-global-scope-type>
|
||||||
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
|
#[derive(Clone, Copy, Debug, HeapSizeOf, JSTraceable)]
|
||||||
pub enum WorkletGlobalScopeType {
|
pub enum WorkletGlobalScopeType {
|
||||||
/// A servo-specific testing worklet
|
/// A servo-specific testing worklet
|
||||||
|
|
|
@ -25,7 +25,7 @@ use std::rc::Rc;
|
||||||
pub struct MicrotaskQueue {
|
pub struct MicrotaskQueue {
|
||||||
/// The list of enqueued microtasks that will be invoked at the next microtask checkpoint.
|
/// The list of enqueued microtasks that will be invoked at the next microtask checkpoint.
|
||||||
microtask_queue: DomRefCell<Vec<Microtask>>,
|
microtask_queue: DomRefCell<Vec<Microtask>>,
|
||||||
/// https://html.spec.whatwg.org/multipage/#performing-a-microtask-checkpoint
|
/// <https://html.spec.whatwg.org/multipage/#performing-a-microtask-checkpoint>
|
||||||
performing_a_microtask_checkpoint: Cell<bool>,
|
performing_a_microtask_checkpoint: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ impl MicrotaskQueue {
|
||||||
self.microtask_queue.borrow_mut().push(job);
|
self.microtask_queue.borrow_mut().push(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint
|
/// <https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint>
|
||||||
/// Perform a microtask checkpoint, executing all queued microtasks until the queue is empty.
|
/// Perform a microtask checkpoint, executing all queued microtasks until the queue is empty.
|
||||||
pub fn checkpoint<F>(&self, target_provider: F)
|
pub fn checkpoint<F>(&self, target_provider: F)
|
||||||
where F: Fn(PipelineId) -> Option<DomRoot<GlobalScope>>
|
where F: Fn(PipelineId) -> Option<DomRoot<GlobalScope>>
|
||||||
|
|
|
@ -468,7 +468,7 @@ pub struct ScriptThread {
|
||||||
|
|
||||||
content_process_shutdown_chan: IpcSender<()>,
|
content_process_shutdown_chan: IpcSender<()>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#microtask-queue
|
/// <https://html.spec.whatwg.org/multipage/#microtask-queue>
|
||||||
microtask_queue: Rc<MicrotaskQueue>,
|
microtask_queue: Rc<MicrotaskQueue>,
|
||||||
|
|
||||||
/// Microtask Queue for adding support for mutation observer microtasks
|
/// Microtask Queue for adding support for mutation observer microtasks
|
||||||
|
@ -494,7 +494,7 @@ pub struct ScriptThread {
|
||||||
/// of the transition.
|
/// of the transition.
|
||||||
transitioning_nodes: DomRefCell<Vec<Dom<Node>>>,
|
transitioning_nodes: DomRefCell<Vec<Dom<Node>>>,
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack
|
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
|
||||||
custom_element_reaction_stack: CustomElementReactionStack,
|
custom_element_reaction_stack: CustomElementReactionStack,
|
||||||
|
|
||||||
/// The Webrender Document ID associated with this thread.
|
/// The Webrender Document ID associated with this thread.
|
||||||
|
@ -1602,7 +1602,7 @@ impl ScriptThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles a mozbrowser event, for example see:
|
/// Handles a mozbrowser event, for example see:
|
||||||
/// https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart
|
/// <https://developer.mozilla.org/en-US/docs/Web/Events/mozbrowserloadstart>
|
||||||
fn handle_mozbrowser_event_msg(&self,
|
fn handle_mozbrowser_event_msg(&self,
|
||||||
parent_pipeline_id: PipelineId,
|
parent_pipeline_id: PipelineId,
|
||||||
top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
|
top_level_browsing_context_id: Option<TopLevelBrowsingContextId>,
|
||||||
|
@ -2309,7 +2309,7 @@ impl ScriptThread {
|
||||||
document.handle_touch_event(self.js_runtime.rt(), event_type, identifier, point)
|
document.handle_touch_event(self.js_runtime.rt(), event_type, identifier, point)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#navigating-across-documents
|
/// <https://html.spec.whatwg.org/multipage/#navigating-across-documents>
|
||||||
/// The entry point for content to notify that a new load has been requested
|
/// The entry point for content to notify that a new load has been requested
|
||||||
/// for the given pipeline (specifically the "navigate" algorithm).
|
/// for the given pipeline (specifically the "navigate" algorithm).
|
||||||
fn handle_navigate(&self, parent_pipeline_id: PipelineId,
|
fn handle_navigate(&self, parent_pipeline_id: PipelineId,
|
||||||
|
|
|
@ -72,7 +72,7 @@ pub struct TextInput<T: ClipboardProvider> {
|
||||||
clipboard_provider: T,
|
clipboard_provider: T,
|
||||||
/// The maximum number of UTF-16 code units this text input is allowed to hold.
|
/// The maximum number of UTF-16 code units this text input is allowed to hold.
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#attr-fe-maxlength
|
/// <https://html.spec.whatwg.org/multipage/#attr-fe-maxlength>
|
||||||
pub max_length: Option<usize>,
|
pub max_length: Option<usize>,
|
||||||
pub min_length: Option<usize>,
|
pub min_length: Option<usize>,
|
||||||
pub selection_direction: SelectionDirection,
|
pub selection_direction: SelectionDirection,
|
||||||
|
|
|
@ -158,7 +158,7 @@ pub struct LoadData {
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub enum JsEvalResult {
|
pub enum JsEvalResult {
|
||||||
/// The js evaluation had a non-string result, 204 status code.
|
/// The js evaluation had a non-string result, 204 status code.
|
||||||
/// https://html.spec.whatwg.org/multipage/#navigate 12.11
|
/// <https://html.spec.whatwg.org/multipage/#navigate> 12.11
|
||||||
NoContent,
|
NoContent,
|
||||||
/// The js evaluation had a string result.
|
/// The js evaluation had a string result.
|
||||||
Ok(Vec<u8>)
|
Ok(Vec<u8>)
|
||||||
|
@ -221,8 +221,9 @@ pub enum DiscardBrowsingContext {
|
||||||
/// A document is active if it is the current active document in its session history,
|
/// A document is active if it is the current active document in its session history,
|
||||||
/// it is fuly active if it is active and all of its ancestors are active,
|
/// it is fuly active if it is active and all of its ancestors are active,
|
||||||
/// and it is inactive otherwise.
|
/// and it is inactive otherwise.
|
||||||
/// https://html.spec.whatwg.org/multipage/#active-document
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#fully-active
|
/// * <https://html.spec.whatwg.org/multipage/#active-document>
|
||||||
|
/// * <https://html.spec.whatwg.org/multipage/#fully-active>
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, HeapSizeOf, PartialEq, Serialize)]
|
||||||
pub enum DocumentActivity {
|
pub enum DocumentActivity {
|
||||||
/// An inactive document
|
/// An inactive document
|
||||||
|
@ -402,7 +403,7 @@ pub enum TouchEventType {
|
||||||
|
|
||||||
/// An opaque identifier for a touch point.
|
/// An opaque identifier for a touch point.
|
||||||
///
|
///
|
||||||
/// http://w3c.github.io/touch-events/#widl-Touch-identifier
|
/// <http://w3c.github.io/touch-events/#widl-Touch-identifier>
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
|
||||||
pub struct TouchId(pub i32);
|
pub struct TouchId(pub i32);
|
||||||
|
|
||||||
|
@ -722,7 +723,7 @@ pub struct ScrollState {
|
||||||
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Copy, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct WindowSizeData {
|
pub struct WindowSizeData {
|
||||||
/// The size of the initial layout viewport, before parsing an
|
/// The size of the initial layout viewport, before parsing an
|
||||||
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
/// <http://www.w3.org/TR/css-device-adapt/#initial-viewport>
|
||||||
pub initial_viewport: TypedSize2D<f32, CSSPixel>,
|
pub initial_viewport: TypedSize2D<f32, CSSPixel>,
|
||||||
|
|
||||||
/// The resolution of the window in dppx, not including any "pinch zoom" factor.
|
/// The resolution of the window in dppx, not including any "pinch zoom" factor.
|
||||||
|
@ -853,7 +854,7 @@ impl From<RecvTimeoutError> for PaintWorkletError {
|
||||||
|
|
||||||
/// Execute paint code in the worklet thread pool.
|
/// Execute paint code in the worklet thread pool.
|
||||||
pub trait Painter: SpeculativePainter {
|
pub trait Painter: SpeculativePainter {
|
||||||
/// https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image
|
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
|
||||||
fn draw_a_paint_image(&self,
|
fn draw_a_paint_image(&self,
|
||||||
size: TypedSize2D<f32, CSSPixel>,
|
size: TypedSize2D<f32, CSSPixel>,
|
||||||
zoom: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
zoom: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||||
|
@ -869,7 +870,8 @@ impl fmt::Debug for Painter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The result of executing paint code: the image together with any image URLs that need to be loaded.
|
/// The result of executing paint code: the image together with any image URLs that need to be loaded.
|
||||||
/// TODO: this should return a WR display list. https://github.com/servo/servo/issues/17497
|
///
|
||||||
|
/// TODO: this should return a WR display list. <https://github.com/servo/servo/issues/17497>
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct DrawAPaintImageResult {
|
pub struct DrawAPaintImageResult {
|
||||||
/// The image height
|
/// The image height
|
||||||
|
|
|
@ -137,7 +137,7 @@ pub enum ScriptMsg {
|
||||||
/// Scroll a page in a window
|
/// Scroll a page in a window
|
||||||
ScrollFragmentPoint(ClipId, Point2D<f32>, bool),
|
ScrollFragmentPoint(ClipId, Point2D<f32>, bool),
|
||||||
/// Set title of current page
|
/// Set title of current page
|
||||||
/// https://html.spec.whatwg.org/multipage/#document.title
|
/// <https://html.spec.whatwg.org/multipage/#document.title>
|
||||||
SetTitle(Option<String>),
|
SetTitle(Option<String>),
|
||||||
/// Send a key event
|
/// Send a key event
|
||||||
SendKeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
SendKeyEvent(Option<char>, Key, KeyState, KeyModifiers),
|
||||||
|
|
|
@ -24,7 +24,7 @@ fn main() {
|
||||||
write!(&mut file, "; &SET }}").unwrap();
|
write!(&mut file, "; &SET }}").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#selectors
|
/// <https://html.spec.whatwg.org/multipage/#selectors>
|
||||||
static ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES: &'static str = r#"
|
static ASCII_CASE_INSENSITIVE_HTML_ATTRIBUTES: &'static str = r#"
|
||||||
accept
|
accept
|
||||||
accept-charset
|
accept-charset
|
||||||
|
|
|
@ -82,7 +82,7 @@ macro_rules! with_all_bounds {
|
||||||
///
|
///
|
||||||
/// NB: We need Clone so that we can derive(Clone) on struct with that
|
/// NB: We need Clone so that we can derive(Clone) on struct with that
|
||||||
/// are parameterized on SelectorImpl. See
|
/// are parameterized on SelectorImpl. See
|
||||||
/// https://github.com/rust-lang/rust/issues/26925
|
/// <https://github.com/rust-lang/rust/issues/26925>
|
||||||
pub trait SelectorImpl: Clone + Sized + 'static {
|
pub trait SelectorImpl: Clone + Sized + 'static {
|
||||||
type AttrValue: $($InSelector)*;
|
type AttrValue: $($InSelector)*;
|
||||||
type Identifier: $($InSelector)* + PrecomputedHash;
|
type Identifier: $($InSelector)* + PrecomputedHash;
|
||||||
|
@ -177,7 +177,7 @@ pub struct SelectorList<Impl: SelectorImpl>(pub SmallVec<[Selector<Impl>; 1]>);
|
||||||
|
|
||||||
impl<Impl: SelectorImpl> SelectorList<Impl> {
|
impl<Impl: SelectorImpl> SelectorList<Impl> {
|
||||||
/// Parse a comma-separated list of Selectors.
|
/// Parse a comma-separated list of Selectors.
|
||||||
/// https://drafts.csswg.org/selectors/#grouping
|
/// <https://drafts.csswg.org/selectors/#grouping>
|
||||||
///
|
///
|
||||||
/// Return the Selectors or Err if there is an invalid selector.
|
/// Return the Selectors or Err if there is an invalid selector.
|
||||||
pub fn parse<'i, 't, P>(parser: &P, input: &mut CssParser<'i, 't>)
|
pub fn parse<'i, 't, P>(parser: &P, input: &mut CssParser<'i, 't>)
|
||||||
|
@ -898,7 +898,7 @@ impl<Impl: SelectorImpl> ToCss for Component<Impl> {
|
||||||
use self::Component::*;
|
use self::Component::*;
|
||||||
|
|
||||||
/// Serialize <an+b> values (part of the CSS Syntax spec, but currently only used here).
|
/// Serialize <an+b> values (part of the CSS Syntax spec, but currently only used here).
|
||||||
/// https://drafts.csswg.org/css-syntax-3/#serialize-an-anb-value
|
/// <https://drafts.csswg.org/css-syntax-3/#serialize-an-anb-value>
|
||||||
fn write_affine<W>(dest: &mut W, a: i32, b: i32) -> fmt::Result where W: fmt::Write {
|
fn write_affine<W>(dest: &mut W, a: i32, b: i32) -> fmt::Result where W: fmt::Write {
|
||||||
match (a, b) {
|
match (a, b) {
|
||||||
(0, 0) => dest.write_char('0'),
|
(0, 0) => dest.write_char('0'),
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//! Fork of Arc for Servo. This has the following advantages over std::Arc:
|
//! Fork of Arc for Servo. This has the following advantages over std::Arc:
|
||||||
|
//!
|
||||||
//! * We don't waste storage on the weak reference count.
|
//! * We don't waste storage on the weak reference count.
|
||||||
//! * We don't do extra RMU operations to handle the possibility of weak references.
|
//! * We don't do extra RMU operations to handle the possibility of weak references.
|
||||||
//! * We can experiment with arena allocation (todo).
|
//! * We can experiment with arena allocation (todo).
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
//! * We have support for dynamically-sized types (see from_header_and_iter).
|
//! * We have support for dynamically-sized types (see from_header_and_iter).
|
||||||
//! * We have support for thin arcs to unsized types (see ThinArc).
|
//! * We have support for thin arcs to unsized types (see ThinArc).
|
||||||
//!
|
//!
|
||||||
//! [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1360883
|
//! [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1360883
|
||||||
|
|
||||||
// The semantics of Arc are alread documented in the Rust docs, so we don't
|
// The semantics of Arc are alread documented in the Rust docs, so we don't
|
||||||
// duplicate those here.
|
// duplicate those here.
|
||||||
|
@ -83,7 +84,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
|
||||||
/// be thin or fat (which depends on whether or not T is sized). Given
|
/// be thin or fat (which depends on whether or not T is sized). Given
|
||||||
/// that this is all a temporary hack, this restriction is fine for now.
|
/// that this is all a temporary hack, this restriction is fine for now.
|
||||||
///
|
///
|
||||||
/// [1] https://github.com/rust-lang/rust/issues/27730
|
/// [1]: https://github.com/rust-lang/rust/issues/27730
|
||||||
pub struct NonZeroPtrMut<T: ?Sized + 'static>(&'static mut T);
|
pub struct NonZeroPtrMut<T: ?Sized + 'static>(&'static mut T);
|
||||||
impl<T: ?Sized> NonZeroPtrMut<T> {
|
impl<T: ?Sized> NonZeroPtrMut<T> {
|
||||||
pub fn new(ptr: *mut T) -> Self {
|
pub fn new(ptr: *mut T) -> Self {
|
||||||
|
|
|
@ -393,7 +393,7 @@ impl PartialEq<Atom> for AttrValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values
|
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-non-zero-dimension-values>
|
||||||
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
|
pub fn parse_nonzero_length(value: &str) -> LengthOrPercentageOrAuto {
|
||||||
match parse_length(value) {
|
match parse_length(value) {
|
||||||
LengthOrPercentageOrAuto::Length(x) if x == Au::zero() => LengthOrPercentageOrAuto::Auto,
|
LengthOrPercentageOrAuto::Length(x) if x == Au::zero() => LengthOrPercentageOrAuto::Auto,
|
||||||
|
|
|
@ -229,55 +229,55 @@ macro_rules! counter_style_descriptors {
|
||||||
}
|
}
|
||||||
|
|
||||||
counter_style_descriptors! {
|
counter_style_descriptors! {
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-system
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-system>
|
||||||
"system" system / eCSSCounterDesc_System: System = {
|
"system" system / eCSSCounterDesc_System: System = {
|
||||||
System::Symbolic
|
System::Symbolic
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-negative
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-negative>
|
||||||
"negative" negative / eCSSCounterDesc_Negative: Negative = {
|
"negative" negative / eCSSCounterDesc_Negative: Negative = {
|
||||||
Negative(Symbol::String("-".to_owned()), None)
|
Negative(Symbol::String("-".to_owned()), None)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-prefix
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-prefix>
|
||||||
"prefix" prefix / eCSSCounterDesc_Prefix: Symbol = {
|
"prefix" prefix / eCSSCounterDesc_Prefix: Symbol = {
|
||||||
Symbol::String("".to_owned())
|
Symbol::String("".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-suffix
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-suffix>
|
||||||
"suffix" suffix / eCSSCounterDesc_Suffix: Symbol = {
|
"suffix" suffix / eCSSCounterDesc_Suffix: Symbol = {
|
||||||
Symbol::String(". ".to_owned())
|
Symbol::String(". ".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-range
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-range>
|
||||||
"range" range / eCSSCounterDesc_Range: Ranges = {
|
"range" range / eCSSCounterDesc_Range: Ranges = {
|
||||||
Ranges(Vec::new()) // Empty Vec represents 'auto'
|
Ranges(Vec::new()) // Empty Vec represents 'auto'
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-pad
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||||
"pad" pad / eCSSCounterDesc_Pad: Pad = {
|
"pad" pad / eCSSCounterDesc_Pad: Pad = {
|
||||||
Pad(0, Symbol::String("".to_owned()))
|
Pad(0, Symbol::String("".to_owned()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-fallback
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-fallback>
|
||||||
"fallback" fallback / eCSSCounterDesc_Fallback: Fallback = {
|
"fallback" fallback / eCSSCounterDesc_Fallback: Fallback = {
|
||||||
// FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 use atom!()
|
// FIXME https://bugzilla.mozilla.org/show_bug.cgi?id=1359323 use atom!()
|
||||||
Fallback(CustomIdent(Atom::from("decimal")))
|
Fallback(CustomIdent(Atom::from("decimal")))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
||||||
"symbols" symbols / eCSSCounterDesc_Symbols: Symbols = !
|
"symbols" symbols / eCSSCounterDesc_Symbols: Symbols = !
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
|
||||||
"additive-symbols" additive_symbols / eCSSCounterDesc_AdditiveSymbols: AdditiveSymbols = !
|
"additive-symbols" additive_symbols / eCSSCounterDesc_AdditiveSymbols: AdditiveSymbols = !
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as>
|
||||||
"speak-as" speak_as / eCSSCounterDesc_SpeakAs: SpeakAs = {
|
"speak-as" speak_as / eCSSCounterDesc_SpeakAs: SpeakAs = {
|
||||||
SpeakAs::Auto
|
SpeakAs::Auto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-system
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-system>
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum System {
|
pub enum System {
|
||||||
/// 'cyclic'
|
/// 'cyclic'
|
||||||
|
@ -343,7 +343,7 @@ impl ToCss for System {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#typedef-symbol
|
/// <https://drafts.csswg.org/css-counter-styles/#typedef-symbol>
|
||||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||||
pub enum Symbol {
|
pub enum Symbol {
|
||||||
|
@ -388,7 +388,7 @@ impl Symbol {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-negative
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-negative>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct Negative(pub Symbol, pub Option<Symbol>);
|
pub struct Negative(pub Symbol, pub Option<Symbol>);
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ impl Parse for Negative {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-range
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-range>
|
||||||
///
|
///
|
||||||
/// Empty Vec represents 'auto'
|
/// Empty Vec represents 'auto'
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
@ -467,7 +467,7 @@ fn bound_to_css<W>(range: Option<i32>, dest: &mut W) -> fmt::Result where W: fmt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-pad
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-pad>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct Pad(pub u32, pub Symbol);
|
pub struct Pad(pub u32, pub Symbol);
|
||||||
|
|
||||||
|
@ -483,7 +483,7 @@ impl Parse for Pad {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-fallback
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-fallback>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct Fallback(pub CustomIdent);
|
pub struct Fallback(pub CustomIdent);
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ impl Parse for Fallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols>
|
||||||
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
|
||||||
pub struct Symbols(pub Vec<Symbol>);
|
pub struct Symbols(pub Vec<Symbol>);
|
||||||
|
@ -528,7 +528,7 @@ impl ToCss for Symbols {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols
|
/// <https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-additive-symbols>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
|
pub struct AdditiveSymbols(pub Vec<AdditiveTuple>);
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ impl Parse for AdditiveTuple {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as
|
/// <https://drafts.csswg.org/css-counter-styles/#counter-style-speak-as>
|
||||||
#[derive(Clone, Debug, ToCss)]
|
#[derive(Clone, Debug, ToCss)]
|
||||||
pub enum SpeakAs {
|
pub enum SpeakAs {
|
||||||
/// auto
|
/// auto
|
||||||
|
|
|
@ -28,7 +28,7 @@ pub type Name = Atom;
|
||||||
|
|
||||||
/// Parse a custom property name.
|
/// Parse a custom property name.
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-variables/#typedef-custom-property-name
|
/// <https://drafts.csswg.org/css-variables/#typedef-custom-property-name>
|
||||||
pub fn parse_name(s: &str) -> Result<&str, ()> {
|
pub fn parse_name(s: &str) -> Result<&str, ()> {
|
||||||
if s.starts_with("--") {
|
if s.starts_with("--") {
|
||||||
Ok(&s[2..])
|
Ok(&s[2..])
|
||||||
|
@ -317,7 +317,7 @@ fn parse_self_contained_declaration_value<'i, 't>(
|
||||||
Ok((first, css, last))
|
Ok((first, css, last))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value
|
/// <https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value>
|
||||||
fn parse_declaration_value<'i, 't>(
|
fn parse_declaration_value<'i, 't>(
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
references: Option<&mut PrecomputedHashSet<Name>>,
|
references: Option<&mut PrecomputedHashSet<Name>>,
|
||||||
|
|
|
@ -9,7 +9,7 @@ use context::QuirksMode;
|
||||||
use selectors::{Element, NthIndexCache, SelectorList};
|
use selectors::{Element, NthIndexCache, SelectorList};
|
||||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#dom-element-matches
|
/// <https://dom.spec.whatwg.org/#dom-element-matches>
|
||||||
pub fn element_matches<E>(
|
pub fn element_matches<E>(
|
||||||
element: &E,
|
element: &E,
|
||||||
selector_list: &SelectorList<E::Impl>,
|
selector_list: &SelectorList<E::Impl>,
|
||||||
|
@ -28,7 +28,7 @@ where
|
||||||
matching::matches_selector_list(selector_list, element, &mut context)
|
matching::matches_selector_list(selector_list, element, &mut context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dom.spec.whatwg.org/#dom-element-closest
|
/// <https://dom.spec.whatwg.org/#dom-element-closest>
|
||||||
pub fn element_closest<E>(
|
pub fn element_closest<E>(
|
||||||
element: E,
|
element: E,
|
||||||
selector_list: &SelectorList<E::Impl>,
|
selector_list: &SelectorList<E::Impl>,
|
||||||
|
|
|
@ -18,35 +18,35 @@ bitflags! {
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub flags ElementState: u64 {
|
pub flags ElementState: u64 {
|
||||||
/// The mouse is down on this element.
|
/// The mouse is down on this element.
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-active
|
/// <https://html.spec.whatwg.org/multipage/#selector-active>
|
||||||
/// FIXME(#7333): set/unset this when appropriate
|
/// FIXME(#7333): set/unset this when appropriate
|
||||||
const IN_ACTIVE_STATE = 1 << 0,
|
const IN_ACTIVE_STATE = 1 << 0,
|
||||||
/// This element has focus.
|
/// This element has focus.
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-focus
|
/// <https://html.spec.whatwg.org/multipage/#selector-focus>
|
||||||
const IN_FOCUS_STATE = 1 << 1,
|
const IN_FOCUS_STATE = 1 << 1,
|
||||||
/// The mouse is hovering over this element.
|
/// The mouse is hovering over this element.
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-hover
|
/// <https://html.spec.whatwg.org/multipage/#selector-hover>
|
||||||
const IN_HOVER_STATE = 1 << 2,
|
const IN_HOVER_STATE = 1 << 2,
|
||||||
/// Content is enabled (and can be disabled).
|
/// Content is enabled (and can be disabled).
|
||||||
/// http://www.whatwg.org/html/#selector-enabled
|
/// <http://www.whatwg.org/html/#selector-enabled>
|
||||||
const IN_ENABLED_STATE = 1 << 3,
|
const IN_ENABLED_STATE = 1 << 3,
|
||||||
/// Content is disabled.
|
/// Content is disabled.
|
||||||
/// http://www.whatwg.org/html/#selector-disabled
|
/// <http://www.whatwg.org/html/#selector-disabled>
|
||||||
const IN_DISABLED_STATE = 1 << 4,
|
const IN_DISABLED_STATE = 1 << 4,
|
||||||
/// Content is checked.
|
/// Content is checked.
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-checked
|
/// <https://html.spec.whatwg.org/multipage/#selector-checked>
|
||||||
const IN_CHECKED_STATE = 1 << 5,
|
const IN_CHECKED_STATE = 1 << 5,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-indeterminate
|
/// <https://html.spec.whatwg.org/multipage/#selector-indeterminate>
|
||||||
const IN_INDETERMINATE_STATE = 1 << 6,
|
const IN_INDETERMINATE_STATE = 1 << 6,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-placeholder-shown
|
/// <https://html.spec.whatwg.org/multipage/#selector-placeholder-shown>
|
||||||
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7,
|
const IN_PLACEHOLDER_SHOWN_STATE = 1 << 7,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-target
|
/// <https://html.spec.whatwg.org/multipage/#selector-target>
|
||||||
const IN_TARGET_STATE = 1 << 8,
|
const IN_TARGET_STATE = 1 << 8,
|
||||||
/// https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class
|
/// <https://fullscreen.spec.whatwg.org/#%3Afullscreen-pseudo-class>
|
||||||
const IN_FULLSCREEN_STATE = 1 << 9,
|
const IN_FULLSCREEN_STATE = 1 << 9,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-valid
|
/// <https://html.spec.whatwg.org/multipage/#selector-valid>
|
||||||
const IN_VALID_STATE = 1 << 10,
|
const IN_VALID_STATE = 1 << 10,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-invalid
|
/// <https://html.spec.whatwg.org/multipage/#selector-invalid>
|
||||||
const IN_INVALID_STATE = 1 << 11,
|
const IN_INVALID_STATE = 1 << 11,
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid
|
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-valid
|
||||||
const IN_MOZ_UI_VALID_STATE = 1 << 12,
|
const IN_MOZ_UI_VALID_STATE = 1 << 12,
|
||||||
|
@ -66,31 +66,31 @@ bitflags! {
|
||||||
const IN_HANDLER_DISABLED_STATE = 1 << 19,
|
const IN_HANDLER_DISABLED_STATE = 1 << 19,
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed
|
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-handler-crashed
|
||||||
const IN_HANDLER_CRASHED_STATE = 1 << 20,
|
const IN_HANDLER_CRASHED_STATE = 1 << 20,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-required
|
/// <https://html.spec.whatwg.org/multipage/#selector-required>
|
||||||
const IN_REQUIRED_STATE = 1 << 21,
|
const IN_REQUIRED_STATE = 1 << 21,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-optional
|
/// <https://html.spec.whatwg.org/multipage/#selector-optional>
|
||||||
const IN_OPTIONAL_STATE = 1 << 22,
|
const IN_OPTIONAL_STATE = 1 << 22,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-read-write
|
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||||
const IN_READ_WRITE_STATE = 1 << 22,
|
const IN_READ_WRITE_STATE = 1 << 22,
|
||||||
/// Non-standard: Older custom-elements spec.
|
/// Non-standard: Older custom-elements spec.
|
||||||
const IN_UNRESOLVED_STATE = 1 << 23,
|
const IN_UNRESOLVED_STATE = 1 << 23,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-visited
|
/// <https://html.spec.whatwg.org/multipage/#selector-visited>
|
||||||
const IN_VISITED_STATE = 1 << 24,
|
const IN_VISITED_STATE = 1 << 24,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-link
|
/// <https://html.spec.whatwg.org/multipage/#selector-link>
|
||||||
const IN_UNVISITED_STATE = 1 << 25,
|
const IN_UNVISITED_STATE = 1 << 25,
|
||||||
/// https://drafts.csswg.org/selectors-4/#the-any-link-pseudo
|
/// <https://drafts.csswg.org/selectors-4/#the-any-link-pseudo>
|
||||||
const IN_VISITED_OR_UNVISITED_STATE = IN_VISITED_STATE.bits | IN_UNVISITED_STATE.bits,
|
const IN_VISITED_OR_UNVISITED_STATE = IN_VISITED_STATE.bits | IN_UNVISITED_STATE.bits,
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
|
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-drag-over
|
||||||
const IN_DRAGOVER_STATE = 1 << 26,
|
const IN_DRAGOVER_STATE = 1 << 26,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-in-range
|
/// <https://html.spec.whatwg.org/multipage/#selector-in-range>
|
||||||
const IN_INRANGE_STATE = 1 << 27,
|
const IN_INRANGE_STATE = 1 << 27,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-out-of-range
|
/// <https://html.spec.whatwg.org/multipage/#selector-out-of-range>
|
||||||
const IN_OUTOFRANGE_STATE = 1 << 28,
|
const IN_OUTOFRANGE_STATE = 1 << 28,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-read-only
|
/// <https://html.spec.whatwg.org/multipage/#selector-read-only>
|
||||||
const IN_MOZ_READONLY_STATE = 1 << 29,
|
const IN_MOZ_READONLY_STATE = 1 << 29,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-read-write
|
/// <https://html.spec.whatwg.org/multipage/#selector-read-write>
|
||||||
const IN_MOZ_READWRITE_STATE = 1 << 30,
|
const IN_MOZ_READWRITE_STATE = 1 << 30,
|
||||||
/// https://html.spec.whatwg.org/multipage/#selector-default
|
/// <https://html.spec.whatwg.org/multipage/#selector-default>
|
||||||
const IN_DEFAULT_STATE = 1 << 31,
|
const IN_DEFAULT_STATE = 1 << 31,
|
||||||
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid
|
/// Non-standard: https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-submit-invalid
|
||||||
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32,
|
const IN_MOZ_SUBMITINVALID_STATE = 1 << 32,
|
||||||
|
@ -114,7 +114,7 @@ bitflags! {
|
||||||
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41,
|
const IN_HANDLER_VULNERABLE_UPDATABLE_STATE = 1 << 41,
|
||||||
/// Non-standard & undocumented.
|
/// Non-standard & undocumented.
|
||||||
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42,
|
const IN_HANDLER_VULNERABLE_NO_UPDATE_STATE = 1 << 42,
|
||||||
/// https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo
|
/// <https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo>
|
||||||
const IN_FOCUS_WITHIN_STATE = 1 << 43,
|
const IN_FOCUS_WITHIN_STATE = 1 << 43,
|
||||||
/// :dir matching; the states are used for dynamic change detection.
|
/// :dir matching; the states are used for dynamic change detection.
|
||||||
/// State that elements that match :dir(ltr) are in.
|
/// State that elements that match :dir(ltr) are in.
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl OneOrMoreSeparated for Source {
|
||||||
/// A `UrlSource` represents a font-face source that has been specified with a
|
/// A `UrlSource` represents a font-face source that has been specified with a
|
||||||
/// `url()` function.
|
/// `url()` function.
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-fonts/#src-desc
|
/// <https://drafts.csswg.org/css-fonts/#src-desc>
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
pub struct UrlSource {
|
pub struct UrlSource {
|
||||||
|
@ -235,7 +235,7 @@ macro_rules! font_face_descriptors_common {
|
||||||
) => {
|
) => {
|
||||||
/// Data inside a `@font-face` rule.
|
/// Data inside a `@font-face` rule.
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-fonts/#font-face-rule
|
/// <https://drafts.csswg.org/css-fonts/#font-face-rule>
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct FontFaceRuleData {
|
pub struct FontFaceRuleData {
|
||||||
$(
|
$(
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub struct Device {
|
||||||
/// The body text color, stored as an `nscolor`, used for the "tables
|
/// The body text color, stored as an `nscolor`, used for the "tables
|
||||||
/// inherit from body" quirk.
|
/// inherit from body" quirk.
|
||||||
///
|
///
|
||||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||||
body_text_color: AtomicUsize,
|
body_text_color: AtomicUsize,
|
||||||
/// Whether any styles computed in the document relied on the root font-size
|
/// Whether any styles computed in the document relied on the root font-size
|
||||||
/// by using rem units.
|
/// by using rem units.
|
||||||
|
@ -118,7 +118,7 @@ impl Device {
|
||||||
|
|
||||||
/// Sets the body text color for the "inherit color from body" quirk.
|
/// Sets the body text color for the "inherit color from body" quirk.
|
||||||
///
|
///
|
||||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||||
pub fn set_body_text_color(&self, color: RGBA) {
|
pub fn set_body_text_color(&self, color: RGBA) {
|
||||||
self.body_text_color.store(convert_rgba_to_nscolor(&color) as usize, Ordering::Relaxed)
|
self.body_text_color.store(convert_rgba_to_nscolor(&color) as usize, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ impl NonTSPseudoClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/selectors-4/#useraction-pseudos
|
/// <https://drafts.csswg.org/selectors-4/#useraction-pseudos>
|
||||||
///
|
///
|
||||||
/// We intentionally skip the link-related ones.
|
/// We intentionally skip the link-related ones.
|
||||||
pub fn is_safe_user_action_state(&self) -> bool {
|
pub fn is_safe_user_action_state(&self) -> bool {
|
||||||
|
|
|
@ -47,15 +47,15 @@ impl MediaList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/mediaqueries/#mq-prefix
|
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
|
||||||
pub enum Qualifier {
|
pub enum Qualifier {
|
||||||
/// Hide a media query from legacy UAs:
|
/// Hide a media query from legacy UAs:
|
||||||
/// https://drafts.csswg.org/mediaqueries/#mq-only
|
/// <https://drafts.csswg.org/mediaqueries/#mq-only>
|
||||||
Only,
|
Only,
|
||||||
/// Negate a media query:
|
/// Negate a media query:
|
||||||
/// https://drafts.csswg.org/mediaqueries/#mq-not
|
/// <https://drafts.csswg.org/mediaqueries/#mq-not>
|
||||||
Not,
|
Not,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ impl ToCss for MediaQuery {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media0
|
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum MediaQueryType {
|
pub enum MediaQueryType {
|
||||||
|
@ -162,7 +162,7 @@ impl MediaQueryType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/mediaqueries/#media-types
|
/// <https://drafts.csswg.org/mediaqueries/#media-types>
|
||||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct MediaType(pub CustomIdent);
|
pub struct MediaType(pub CustomIdent);
|
||||||
|
@ -241,7 +241,7 @@ impl MediaQuery {
|
||||||
/// Always returns a media query list. If any invalid media query is found, the
|
/// Always returns a media query list. If any invalid media query is found, the
|
||||||
/// media query list is only filled with the equivalent of "not all", see:
|
/// media query list is only filled with the equivalent of "not all", see:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/mediaqueries/#error-handling
|
/// <https://drafts.csswg.org/mediaqueries/#error-handling>
|
||||||
pub fn parse_media_query_list<R>(
|
pub fn parse_media_query_list<R>(
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
input: &mut Parser,
|
input: &mut Parser,
|
||||||
|
@ -311,7 +311,7 @@ impl MediaList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append a new media query item to the media list.
|
/// Append a new media query item to the media list.
|
||||||
/// https://drafts.csswg.org/cssom/#dom-medialist-appendmedium
|
/// <https://drafts.csswg.org/cssom/#dom-medialist-appendmedium>
|
||||||
///
|
///
|
||||||
/// Returns true if added, false if fail to parse the medium string.
|
/// Returns true if added, false if fail to parse the medium string.
|
||||||
pub fn append_medium(&mut self, context: &ParserContext, new_medium: &str) -> bool {
|
pub fn append_medium(&mut self, context: &ParserContext, new_medium: &str) -> bool {
|
||||||
|
@ -330,7 +330,7 @@ impl MediaList {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Delete a media query from the media list.
|
/// Delete a media query from the media list.
|
||||||
/// https://drafts.csswg.org/cssom/#dom-medialist-deletemedium
|
/// <https://drafts.csswg.org/cssom/#dom-medialist-deletemedium>
|
||||||
///
|
///
|
||||||
/// Returns true if found and deleted, false otherwise.
|
/// Returns true if found and deleted, false otherwise.
|
||||||
pub fn delete_medium(&mut self, context: &ParserContext, old_medium: &str) -> bool {
|
pub fn delete_medium(&mut self, context: &ParserContext, old_medium: &str) -> bool {
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl PropertyDeclarationBlock {
|
||||||
|
|
||||||
/// Find the value of the given property in this block and serialize it
|
/// Find the value of the given property in this block and serialize it
|
||||||
///
|
///
|
||||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
|
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue>
|
||||||
pub fn property_value_to_css<W>(&self, property: &PropertyId, dest: &mut W) -> fmt::Result
|
pub fn property_value_to_css<W>(&self, property: &PropertyId, dest: &mut W) -> fmt::Result
|
||||||
where W: fmt::Write,
|
where W: fmt::Write,
|
||||||
{
|
{
|
||||||
|
@ -365,7 +365,7 @@ impl PropertyDeclarationBlock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority
|
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority>
|
||||||
pub fn property_priority(&self, property: &PropertyId) -> Importance {
|
pub fn property_priority(&self, property: &PropertyId) -> Importance {
|
||||||
// Step 1: done when parsing a string to PropertyId
|
// Step 1: done when parsing a string to PropertyId
|
||||||
|
|
||||||
|
@ -560,7 +560,7 @@ impl PropertyDeclarationBlock {
|
||||||
updated_at_least_one
|
updated_at_least_one
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
/// <https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty>
|
||||||
///
|
///
|
||||||
/// Returns whether any declaration was actually removed.
|
/// Returns whether any declaration was actually removed.
|
||||||
pub fn remove_property(&mut self, property: &PropertyId) -> bool {
|
pub fn remove_property(&mut self, property: &PropertyId) -> bool {
|
||||||
|
|
|
@ -57,7 +57,7 @@ use values::generics::position as generic_position;
|
||||||
use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint};
|
use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint};
|
||||||
use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity};
|
use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity};
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transitions/#animtype-repeatable-list
|
/// <https://drafts.csswg.org/css-transitions/#animtype-repeatable-list>
|
||||||
pub trait RepeatableListAnimatable: Animate {}
|
pub trait RepeatableListAnimatable: Animate {}
|
||||||
|
|
||||||
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
|
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
|
||||||
|
@ -655,7 +655,7 @@ macro_rules! repeated_vec_impl {
|
||||||
|
|
||||||
repeated_vec_impl!(SmallVec<[T; 1]>, Vec<T>);
|
repeated_vec_impl!(SmallVec<[T; 1]>, Vec<T>);
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transitions/#animtype-visibility
|
/// <https://drafts.csswg.org/css-transitions/#animtype-visibility>
|
||||||
impl Animate for Visibility {
|
impl Animate for Visibility {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
|
@ -686,7 +686,7 @@ impl ToAnimatedZero for Visibility {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
/// <https://drafts.csswg.org/css-transitions/#animtype-lpcalc>
|
||||||
impl Animate for CalcLengthOrPercentage {
|
impl Animate for CalcLengthOrPercentage {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
|
@ -738,7 +738,7 @@ impl ToAnimatedZero for MaxLength {
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dev.w3.org/csswg/css-transitions/#animtype-font-weight
|
/// <http://dev.w3.org/csswg/css-transitions/#animtype-font-weight>
|
||||||
impl Animate for FontWeight {
|
impl Animate for FontWeight {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
|
@ -759,7 +759,7 @@ impl ToAnimatedZero for FontWeight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-fonts/#font-stretch-prop
|
/// <https://drafts.csswg.org/css-fonts/#font-stretch-prop>
|
||||||
impl Animate for FontStretch {
|
impl Animate for FontStretch {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
|
||||||
|
@ -786,7 +786,7 @@ impl ToAnimatedZero for FontStretch {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// We should treat font stretch as real number in order to interpolate this property.
|
/// We should treat font stretch as real number in order to interpolate this property.
|
||||||
/// https://drafts.csswg.org/css-fonts-3/#font-stretch-animation
|
/// <https://drafts.csswg.org/css-fonts-3/#font-stretch-animation>
|
||||||
impl From<FontStretch> for f64 {
|
impl From<FontStretch> for f64 {
|
||||||
fn from(stretch: FontStretch) -> f64 {
|
fn from(stretch: FontStretch) -> f64 {
|
||||||
use self::FontStretch::*;
|
use self::FontStretch::*;
|
||||||
|
@ -815,7 +815,7 @@ impl Into<FontStretch> for f64 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def
|
/// <https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def>
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl Animate for FontVariationSettings {
|
impl Animate for FontVariationSettings {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -989,7 +989,7 @@ impl<'a> Iterator for FontSettingTagIter<'a> {
|
||||||
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
|
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
|
||||||
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
|
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transitions/#animtype-rect
|
/// <https://drafts.csswg.org/css-transitions/#animtype-rect>
|
||||||
impl Animate for ClipRect {
|
impl Animate for ClipRect {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
|
@ -1018,7 +1018,7 @@ impl ToAnimatedZero for ClipRect {
|
||||||
|
|
||||||
/// Build an equivalent 'identity transform function list' based
|
/// Build an equivalent 'identity transform function list' based
|
||||||
/// on an existing transform list.
|
/// on an existing transform list.
|
||||||
/// http://dev.w3.org/csswg/css-transforms/#none-transform-animation
|
/// <http://dev.w3.org/csswg/css-transforms/#none-transform-animation>
|
||||||
impl ToAnimatedZero for TransformOperation {
|
impl ToAnimatedZero for TransformOperation {
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||||
match *self {
|
match *self {
|
||||||
|
@ -1078,7 +1078,7 @@ fn animate_multiplicative_factor(
|
||||||
Ok((this - 1.).animate(&(other - 1.), procedure)? + 1.)
|
Ok((this - 1.).animate(&(other - 1.), procedure)? + 1.)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms
|
/// <http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms>
|
||||||
impl Animate for TransformOperation {
|
impl Animate for TransformOperation {
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
match (self, other) {
|
match (self, other) {
|
||||||
|
@ -1159,7 +1159,7 @@ impl Animate for TransformOperation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined
|
/// <https://www.w3.org/TR/css-transforms-1/#Rotate3dDefined>
|
||||||
fn rotate_to_matrix(x: f32, y: f32, z: f32, a: Angle) -> ComputedMatrix {
|
fn rotate_to_matrix(x: f32, y: f32, z: f32, a: Angle) -> ComputedMatrix {
|
||||||
let half_rad = a.radians() / 2.0;
|
let half_rad = a.radians() / 2.0;
|
||||||
let sc = (half_rad).sin() * (half_rad).cos();
|
let sc = (half_rad).sin() * (half_rad).cos();
|
||||||
|
@ -1246,7 +1246,7 @@ impl Animate for Scale2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Animate for MatrixDecomposed2D {
|
impl Animate for MatrixDecomposed2D {
|
||||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values
|
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-2d-matrix-values>
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
// If x-axis of one is flipped, and y-axis of the other,
|
// If x-axis of one is flipped, and y-axis of the other,
|
||||||
// convert to an unflipped rotation.
|
// convert to an unflipped rotation.
|
||||||
|
@ -1375,7 +1375,7 @@ impl ComputeSquaredDistance for ComputedMatrix {
|
||||||
|
|
||||||
impl From<ComputedMatrix> for MatrixDecomposed2D {
|
impl From<ComputedMatrix> for MatrixDecomposed2D {
|
||||||
/// Decompose a 2D matrix.
|
/// Decompose a 2D matrix.
|
||||||
/// https://drafts.csswg.org/css-transforms/#decomposing-a-2d-matrix
|
/// <https://drafts.csswg.org/css-transforms/#decomposing-a-2d-matrix>
|
||||||
fn from(matrix: ComputedMatrix) -> MatrixDecomposed2D {
|
fn from(matrix: ComputedMatrix) -> MatrixDecomposed2D {
|
||||||
let mut row0x = matrix.m11;
|
let mut row0x = matrix.m11;
|
||||||
let mut row0y = matrix.m12;
|
let mut row0y = matrix.m12;
|
||||||
|
@ -1439,7 +1439,7 @@ impl From<ComputedMatrix> for MatrixDecomposed2D {
|
||||||
|
|
||||||
impl From<MatrixDecomposed2D> for ComputedMatrix {
|
impl From<MatrixDecomposed2D> for ComputedMatrix {
|
||||||
/// Recompose a 2D matrix.
|
/// Recompose a 2D matrix.
|
||||||
/// https://drafts.csswg.org/css-transforms/#recomposing-to-a-2d-matrix
|
/// <https://drafts.csswg.org/css-transforms/#recomposing-to-a-2d-matrix>
|
||||||
fn from(decomposed: MatrixDecomposed2D) -> ComputedMatrix {
|
fn from(decomposed: MatrixDecomposed2D) -> ComputedMatrix {
|
||||||
let mut computed_matrix = ComputedMatrix::identity();
|
let mut computed_matrix = ComputedMatrix::identity();
|
||||||
computed_matrix.m11 = decomposed.matrix.m11;
|
computed_matrix.m11 = decomposed.matrix.m11;
|
||||||
|
@ -1577,7 +1577,7 @@ impl ComputeSquaredDistance for Quaternion {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decompose a 3D matrix.
|
/// Decompose a 3D matrix.
|
||||||
/// https://drafts.csswg.org/css-transforms/#decomposing-a-3d-matrix
|
/// <https://drafts.csswg.org/css-transforms/#decomposing-a-3d-matrix>
|
||||||
fn decompose_3d_matrix(mut matrix: ComputedMatrix) -> Result<MatrixDecomposed3D, ()> {
|
fn decompose_3d_matrix(mut matrix: ComputedMatrix) -> Result<MatrixDecomposed3D, ()> {
|
||||||
// Normalize the matrix.
|
// Normalize the matrix.
|
||||||
if matrix.m44 == 0.0 {
|
if matrix.m44 == 0.0 {
|
||||||
|
@ -1829,7 +1829,7 @@ impl Animate for Perspective {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Animate for MatrixDecomposed3D {
|
impl Animate for MatrixDecomposed3D {
|
||||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values
|
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-decomposed-3d-matrix-values>
|
||||||
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
|
||||||
use std::f64;
|
use std::f64;
|
||||||
|
|
||||||
|
@ -1911,7 +1911,7 @@ impl Animate for MatrixDecomposed3D {
|
||||||
|
|
||||||
impl From<MatrixDecomposed3D> for ComputedMatrix {
|
impl From<MatrixDecomposed3D> for ComputedMatrix {
|
||||||
/// Recompose a 3D matrix.
|
/// Recompose a 3D matrix.
|
||||||
/// https://drafts.csswg.org/css-transforms/#recomposing-to-a-3d-matrix
|
/// <https://drafts.csswg.org/css-transforms/#recomposing-to-a-3d-matrix>
|
||||||
fn from(decomposed: MatrixDecomposed3D) -> ComputedMatrix {
|
fn from(decomposed: MatrixDecomposed3D) -> ComputedMatrix {
|
||||||
let mut matrix = ComputedMatrix::identity();
|
let mut matrix = ComputedMatrix::identity();
|
||||||
|
|
||||||
|
@ -2106,7 +2106,7 @@ impl ComputedMatrix {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transforms/#interpolation-of-transforms
|
/// <https://drafts.csswg.org/css-transforms/#interpolation-of-transforms>
|
||||||
impl Animate for TransformList {
|
impl Animate for TransformList {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn animate(
|
fn animate(
|
||||||
|
@ -2463,7 +2463,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty
|
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty>
|
||||||
impl<L> Animate for SVGStrokeDashArray<L>
|
impl<L> Animate for SVGStrokeDashArray<L>
|
||||||
where
|
where
|
||||||
L: Clone + RepeatableListAnimatable,
|
L: Clone + RepeatableListAnimatable,
|
||||||
|
@ -2521,7 +2521,7 @@ where
|
||||||
'Sepia' ]
|
'Sepia' ]
|
||||||
%>
|
%>
|
||||||
|
|
||||||
/// https://drafts.fxtf.org/filters/#animation-of-filters
|
/// <https://drafts.fxtf.org/filters/#animation-of-filters>
|
||||||
impl Animate for AnimatedFilter {
|
impl Animate for AnimatedFilter {
|
||||||
fn animate(
|
fn animate(
|
||||||
&self,
|
&self,
|
||||||
|
@ -2553,7 +2553,7 @@ impl Animate for AnimatedFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dev.w3.org/csswg/css-transforms/#none-transform-animation
|
/// <http://dev.w3.org/csswg/css-transforms/#none-transform-animation>
|
||||||
impl ToAnimatedZero for AnimatedFilter {
|
impl ToAnimatedZero for AnimatedFilter {
|
||||||
fn to_animated_zero(&self) -> Result<Self, ()> {
|
fn to_animated_zero(&self) -> Result<Self, ()> {
|
||||||
match *self {
|
match *self {
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ impl PropertyDeclaration {
|
||||||
|
|
||||||
/// The `context` parameter controls this:
|
/// The `context` parameter controls this:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-animations/#keyframes
|
/// <https://drafts.csswg.org/css-animations/#keyframes>
|
||||||
/// > The <declaration-list> inside of <keyframe-block> accepts any CSS property
|
/// > The <declaration-list> inside of <keyframe-block> accepts any CSS property
|
||||||
/// > except those defined in this specification,
|
/// > except those defined in this specification,
|
||||||
/// > but does accept the `animation-play-state` property and interprets it specially.
|
/// > but does accept the `animation-play-state` property and interprets it specially.
|
||||||
|
@ -2377,7 +2377,7 @@ impl ComputedValuesInner {
|
||||||
effects.mix_blend_mode != mix_blend_mode::T::normal
|
effects.mix_blend_mode != mix_blend_mode::T::normal
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-transforms/#grouping-property-values
|
/// <https://drafts.csswg.org/css-transforms/#grouping-property-values>
|
||||||
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
|
pub fn get_used_transform_style(&self) -> computed_values::transform_style::T {
|
||||||
use computed_values::transform_style;
|
use computed_values::transform_style;
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl Device {
|
||||||
|
|
||||||
/// Sets the body text color for the "inherit color from body" quirk.
|
/// Sets the body text color for the "inherit color from body" quirk.
|
||||||
///
|
///
|
||||||
/// https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk
|
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||||
pub fn set_body_text_color(&self, _color: RGBA) {
|
pub fn set_body_text_color(&self, _color: RGBA) {
|
||||||
// Servo doesn't implement this quirk (yet)
|
// Servo doesn't implement this quirk (yet)
|
||||||
}
|
}
|
||||||
|
@ -155,13 +155,13 @@ impl Device {
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub enum ExpressionKind {
|
pub enum ExpressionKind {
|
||||||
/// http://dev.w3.org/csswg/mediaqueries-3/#width
|
/// <http://dev.w3.org/csswg/mediaqueries-3/#width>
|
||||||
Width(Range<specified::Length>),
|
Width(Range<specified::Length>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single expression a per:
|
/// A single expression a per:
|
||||||
///
|
///
|
||||||
/// http://dev.w3.org/csswg/mediaqueries-3/#media1
|
/// <http://dev.w3.org/csswg/mediaqueries-3/#media1>
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||||
pub struct Expression(pub ExpressionKind);
|
pub struct Expression(pub ExpressionKind);
|
||||||
|
|
|
@ -21,7 +21,7 @@ use values::computed::{Context, ToComputedValue, ComputedUrl};
|
||||||
/// eagerly resolving with rust-url would be duplicated work.
|
/// eagerly resolving with rust-url would be duplicated work.
|
||||||
///
|
///
|
||||||
/// However, this approach is still not necessarily optimal: See
|
/// However, this approach is still not necessarily optimal: See
|
||||||
/// https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6
|
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6>
|
||||||
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
|
||||||
pub struct SpecifiedUrl {
|
pub struct SpecifiedUrl {
|
||||||
/// The original URI. This might be optional since we may insert computed
|
/// The original URI. This might be optional since we may insert computed
|
||||||
|
|
|
@ -21,7 +21,7 @@ pub type StaticStringVec = &'static [&'static str];
|
||||||
|
|
||||||
/// A "space character" according to:
|
/// A "space character" according to:
|
||||||
///
|
///
|
||||||
/// https://html.spec.whatwg.org/multipage/#space-character
|
/// <https://html.spec.whatwg.org/multipage/#space-character>
|
||||||
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
pub static HTML_SPACE_CHARACTERS: StaticCharVec = &[
|
||||||
'\u{0020}',
|
'\u{0020}',
|
||||||
'\u{0009}',
|
'\u{0009}',
|
||||||
|
|
|
@ -30,7 +30,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://fullscreen.spec.whatwg.org/#new-stacking-layer
|
/// <https://fullscreen.spec.whatwg.org/#new-stacking-layer>
|
||||||
///
|
///
|
||||||
/// Any position value other than 'absolute' and 'fixed' are
|
/// Any position value other than 'absolute' and 'fixed' are
|
||||||
/// computed to 'absolute' if the element is in a top layer.
|
/// computed to 'absolute' if the element is in a top layer.
|
||||||
|
@ -53,7 +53,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply the blockification rules based on the table in CSS 2.2 section 9.7.
|
/// Apply the blockification rules based on the table in CSS 2.2 section 9.7.
|
||||||
/// https://drafts.csswg.org/css2/visuren.html#dis-pos-flo
|
/// <https://drafts.csswg.org/css2/visuren.html#dis-pos-flo>
|
||||||
fn blockify_if_necessary(
|
fn blockify_if_necessary(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout_parent_style: &ComputedValues,
|
layout_parent_style: &ComputedValues,
|
||||||
|
@ -160,7 +160,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://drafts.csswg.org/css-writing-modes-3/#block-flow:
|
/// <https://drafts.csswg.org/css-writing-modes-3/#block-flow:>
|
||||||
///
|
///
|
||||||
/// If a box has a different writing-mode value than its containing
|
/// If a box has a different writing-mode value than its containing
|
||||||
/// block:
|
/// block:
|
||||||
|
@ -171,8 +171,8 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
/// This matches the adjustment that Gecko does, not exactly following
|
/// This matches the adjustment that Gecko does, not exactly following
|
||||||
/// the spec. See also:
|
/// the spec. See also:
|
||||||
///
|
///
|
||||||
/// https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html
|
/// <https://lists.w3.org/Archives/Public/www-style/2017Mar/0045.html>
|
||||||
/// https://github.com/servo/servo/issues/15754
|
/// <https://github.com/servo/servo/issues/15754>
|
||||||
fn adjust_for_writing_mode(
|
fn adjust_for_writing_mode(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout_parent_style: &ComputedValues,
|
layout_parent_style: &ComputedValues,
|
||||||
|
@ -519,7 +519,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||||
/// Resolves "justify-items: auto" based on the inherited style if needed to
|
/// Resolves "justify-items: auto" based on the inherited style if needed to
|
||||||
/// comply with:
|
/// comply with:
|
||||||
///
|
///
|
||||||
/// https://drafts.csswg.org/css-align/#valdef-justify-items-legacy
|
/// <https://drafts.csswg.org/css-align/#valdef-justify-items-legacy>
|
||||||
///
|
///
|
||||||
/// (Note that "auto" is being renamed to "legacy")
|
/// (Note that "auto" is being renamed to "legacy")
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
|
|
@ -194,7 +194,7 @@ impl ToCss for UrlMatchingFunction {
|
||||||
|
|
||||||
/// A `@document` rule's condition.
|
/// A `@document` rule's condition.
|
||||||
///
|
///
|
||||||
/// https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document
|
/// <https://www.w3.org/TR/2012/WD-css3-conditional-20120911/#at-document>
|
||||||
///
|
///
|
||||||
/// The `@document` rule's condition is written as a comma-separated list of
|
/// The `@document` rule's condition is written as a comma-separated list of
|
||||||
/// URL matching functions, and the condition evaluates to true whenever any
|
/// URL matching functions, and the condition evaluates to true whenever any
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue