Struct style::servo::url::SpecifiedUrl
[−]
[src]
pub struct SpecifiedUrl { /* fields omitted */ }
A specified url() value for servo.
Servo eagerly resolves SpecifiedUrls, which it can then take advantage of when computing values. In contrast, Gecko uses a different URL backend, so eagerly resolving with rust-url would be duplicated work.
However, this approach is still not necessarily optimal: See https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6
Methods
impl SpecifiedUrl
[src]
pub fn parse_from_string<'a>(
url: String,
context: &ParserContext
) -> Result<Self, ParseError<'a>>
[src]
url: String,
context: &ParserContext
) -> Result<Self, ParseError<'a>>
Try to parse a URL from a string value that is a valid CSS token for a URL. Never fails - the API is only fallible to be compatible with the gecko version.
pub fn is_invalid(&self) -> bool
[src]
Returns true if the URL is definitely invalid. For Servo URLs, we can use its |resolved| status.
pub fn is_fragment(&self) -> bool
[src]
Returns true if this URL looks like a fragment. See https://drafts.csswg.org/css-values/#local-urls
Since Servo currently stores resolved URLs, this is hard to implement. We either need to change servo to lazily resolve (like Gecko), or note this information in the tokenizer.
pub fn url(&self) -> Option<&ServoUrl>
[src]
Returns the resolved url if it was valid.
pub fn as_str(&self) -> &str
[src]
Return the resolved url as string, or the empty string if it's invalid.
TODO(emilio): Should we return the original one if needed?
pub fn for_cascade(url: ServoUrl) -> Self
[src]
Creates an already specified url value from an already resolved URL for insertion in the cascade.
pub fn new_for_testing(url: &str) -> Self
[src]
Gets a new url from a string for unit tests.
Trait Implementations
impl Clone for SpecifiedUrl
[src]
fn clone(&self) -> SpecifiedUrl
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for SpecifiedUrl
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for SpecifiedUrl
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl PartialEq for SpecifiedUrl
[src]
fn eq(&self, other: &Self) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl ToCss for SpecifiedUrl
[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write,
[src]
W: Write,
Serialize self
in CSS syntax, writing to dest
.
fn to_css_string(&self) -> String
[src]
Serialize self
in CSS syntax and return a string. Read more
impl ToComputedValue for SpecifiedUrl
[src]
type ComputedValue = ComputedUrl
The computed value type we're going to be converted to.
fn to_computed_value(&self, _: &Context) -> Self::ComputedValue
[src]
Convert a specified value to a computed value, using itself and the data inside the Context
. Read more
fn from_computed_value(computed: &ComputedUrl) -> Self
[src]
Convert a computed value to specified value form. Read more
impl AnimatedValueAsComputed for SpecifiedUrl
[src]
impl Parse for SpecifiedUrl
[src]
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
Parse a value of this type. Read more