diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 70 | ||||
-rw-r--r-- | components/script/dom/webidls/CSSStyleDeclaration.webidl | 8 |
2 files changed, 8 insertions, 70 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 61acecda71d..b37199ca0db 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use app_units::{Au, AU_PER_PX}; -use cssparser::{Parser, ParserInput}; use document_loader::{LoadType, LoadBlocker}; use dom::activation::Activatable; use dom::attr::Attr; @@ -58,13 +57,7 @@ use std::default::Default; use std::i32; use std::sync::{Arc, Mutex}; use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_double, parse_unsigned_integer}; -use style::context::QuirksMode; -use style::media_queries::MediaQuery; -use style::parser::ParserContext; use style::str::is_ascii_digit; -use style::values::specified::{Length, ViewportPercentageLength}; -use style::values::specified::length::NoCalcLength; -use style_traits::ParsingMode; use task_source::TaskSource; enum ParseState { @@ -94,12 +87,6 @@ enum State { Broken, } -#[derive(Debug, PartialEq)] -pub struct Size { - pub query: Option<MediaQuery>, - pub length: Length, -} - #[derive(Clone, Copy, JSTraceable, MallocSizeOf)] enum ImageRequestPhase { Pending, @@ -758,63 +745,6 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<HTMLImageElement> { } } -//https://html.spec.whatwg.org/multipage/#parse-a-sizes-attribute -pub fn parse_a_sizes_attribute(input: DOMString, width: Option<u32>) -> Vec<Size> { - let mut sizes = Vec::<Size>::new(); - for unparsed_size in input.split(',') { - let whitespace = unparsed_size.chars().rev().take_while(|c| char::is_whitespace(*c)).count(); - let trimmed: String = unparsed_size.chars().take(unparsed_size.chars().count() - whitespace).collect(); - - if trimmed.is_empty() { - continue; - } - let mut input = ParserInput::new(&trimmed); - let url = ServoUrl::parse("about:blank").unwrap(); - let context = ParserContext::new_for_cssom( - &url, - None, - ParsingMode::empty(), - QuirksMode::NoQuirks, - None, - ); - let mut parser = Parser::new(&mut input); - let length = parser.try(|i| Length::parse_non_negative(&context, i)); - match length { - Ok(len) => sizes.push(Size { - length: len, - query: None - }), - Err(_) => { - let mut media_query_parser = parser; - let media_query = media_query_parser.try(|i| MediaQuery::parse(&context, i)); - if let Ok(query) = media_query { - let length = Length::parse_non_negative(&context, &mut media_query_parser); - if let Ok(length) = length { - sizes.push(Size { - length: length, - query: Some(query) - }) - } - } - }, - } - } - if sizes.is_empty() { - let size = match width { - Some(w) => Size { - length: Length::from_px(w as f32), - query: None - }, - None => Size { - length: Length::NoCalc(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.))), - query: None - }, - }; - sizes.push(size); - } - sizes -} - impl HTMLImageElementMethods for HTMLImageElement { // https://html.spec.whatwg.org/multipage/#dom-img-alt make_getter!(Alt, "alt"); diff --git a/components/script/dom/webidls/CSSStyleDeclaration.webidl b/components/script/dom/webidls/CSSStyleDeclaration.webidl index 49377cd1044..2841f3e9016 100644 --- a/components/script/dom/webidls/CSSStyleDeclaration.webidl +++ b/components/script/dom/webidls/CSSStyleDeclaration.webidl @@ -350,6 +350,14 @@ partial interface CSSStyleDeclaration { [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetInlineStart; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString offset-inline-end; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString offsetInlineEnd; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset-block-start; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString insetBlockStart; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset-block-end; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString insetBlockEnd; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset-inline-start; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString insetInlineStart; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString inset-inline-end; + [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString insetInlineEnd; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString height; [CEReactions, SetterThrows, TreatNullAs=EmptyString] attribute DOMString minHeight; |