Auto merge of #16241 - upsuper:bug1352763-bug1352025, r=Manishearth,emilio

Stop passing url as string into Servo side

This is the Servo side changes of [bug 1352763](https://bugzilla.mozilla.org/show_bug.cgi?id=1352763) and [bug 1352025](https://bugzilla.mozilla.org/show_bug.cgi?id=1352025) which have been reviewed on Bugzilla.
This commit is contained in:
bors-servo 2017-04-03 07:05:42 -05:00 committed by GitHub
commit 679b418937
32 changed files with 269 additions and 308 deletions

View file

@ -27,13 +27,12 @@ use font_metrics::FontMetricsProvider;
#[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide};
use logical_geometry::WritingMode;
use media_queries::Device;
use parser::{Parse, ParserContext, ParserContextExtraData};
use parser::{Parse, ParserContext};
use properties::animated_properties::TransitionProperty;
#[cfg(feature = "servo")] use servo_config::prefs::PREFS;
use servo_url::ServoUrl;
use shared_lock::StylesheetGuards;
use style_traits::ToCss;
use stylesheets::Origin;
use stylesheets::{Origin, UrlExtraData};
#[cfg(feature = "servo")] use values::Either;
use values::{HasViewportPercentage, computed};
use cascade_info::CascadeInfo;
@ -296,18 +295,13 @@ impl PropertyDeclarationIdSet {
% endif
{
if let DeclaredValue::WithVariables(ref with_variables) = *value {
// FIXME(heycam): A ParserContextExtraData should be built from data
// stored in the WithVariables, in case variable expansion results in
// a url() value.
let extra_data = ParserContextExtraData::default();
substitute_variables_${property.ident}_slow(&with_variables.css,
with_variables.first_token_type,
&with_variables.base_url,
&with_variables.url_data,
with_variables.from_shorthand,
custom_properties,
f,
error_reporter,
extra_data);
error_reporter);
} else {
f(value);
}
@ -318,12 +312,11 @@ impl PropertyDeclarationIdSet {
fn substitute_variables_${property.ident}_slow<F>(
css: &String,
first_token_type: TokenSerializationType,
base_url: &ServoUrl,
url_data: &UrlExtraData,
from_shorthand: Option<ShorthandId>,
custom_properties: &Option<Arc<::custom_properties::ComputedValuesMap>>,
f: F,
error_reporter: &ParseErrorReporter,
extra_data: ParserContextExtraData)
error_reporter: &ParseErrorReporter)
% if property.boxed:
where F: FnOnce(&DeclaredValue<Box<longhands::${property.ident}::SpecifiedValue>>)
% else:
@ -337,9 +330,7 @@ impl PropertyDeclarationIdSet {
//
// FIXME(pcwalton): Cloning the error reporter is slow! But so are custom
// properties, so whatever...
let context = ParserContext::new_with_extra_data(
::stylesheets::Origin::Author, base_url, error_reporter,
extra_data);
let context = ParserContext::new(Origin::Author, url_data, error_reporter);
Parser::new(&css).parse_entirely(|input| {
match from_shorthand {
None => {
@ -652,8 +643,8 @@ pub struct UnparsedValue {
css: String,
/// The first token type for this serialization.
first_token_type: TokenSerializationType,
/// The base url.
base_url: ServoUrl,
/// The url data for resolving url values.
url_data: UrlExtraData,
/// The shorthand this came from.
from_shorthand: Option<ShorthandId>,
}