mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Don't resolve URLs at parse time for Stylo.
It's a bit unfortunate the use separate implementations of SpecifiedUrl for Servo and Gecko, but they're different enough at this point that I don't think it really makes sense to try to share everything. Splitting them out has some nice simplifications as well. I recognize that there's still some potential correctness issues for Servo using the resolved URI in various places where the original URI may be the right thing, but I've got too much on my plate to look into that for now. MozReview-Commit-ID: BeDu93TQ4Ow
This commit is contained in:
parent
16e04046b5
commit
63e8367eee
14 changed files with 278 additions and 244 deletions
|
@ -42,7 +42,33 @@ pub mod grid;
|
|||
pub mod image;
|
||||
pub mod length;
|
||||
pub mod position;
|
||||
pub mod url;
|
||||
|
||||
/// Common handling for the specified value CSS url() values.
|
||||
pub mod url {
|
||||
use cssparser::Parser;
|
||||
use parser::{Parse, ParserContext};
|
||||
use values::HasViewportPercentage;
|
||||
use values::computed::ComputedValueAsSpecified;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use ::servo::url::*;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use ::gecko::url::*;
|
||||
|
||||
impl Parse for SpecifiedUrl {
|
||||
fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
let url = try!(input.expect_url());
|
||||
Self::parse_from_string(url, context)
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for SpecifiedUrl {}
|
||||
|
||||
// TODO(emilio): Maybe consider ComputedUrl to save a word in style structs?
|
||||
impl ComputedValueAsSpecified for SpecifiedUrl {}
|
||||
|
||||
no_viewport_percentage!(SpecifiedUrl);
|
||||
}
|
||||
|
||||
no_viewport_percentage!(i32); // For PropertyDeclaration::Order
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue