зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #6548 - Upgrade to rustc 1.3.0-dev (f3b97a74a 2015-07-03) (from servo:rustup_2015-07-03); r=nox
Source-Repo: https://github.com/servo/servo Source-Revision: f5f64dab749d0851ef82be3cdc7fb2bd1cb09956
This commit is contained in:
Родитель
21c2cedaa2
Коммит
8423111051
|
@ -14,6 +14,7 @@ use msg::constellation_msg::{AnimationState, Msg, PipelineId};
|
||||||
use script::layout_interface::Animation;
|
use script::layout_interface::Animation;
|
||||||
use script_traits::{ConstellationControlMsg, ScriptControlChan};
|
use script_traits::{ConstellationControlMsg, ScriptControlChan};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use style::animation::{GetMod, PropertyAnimation};
|
use style::animation::{GetMod, PropertyAnimation};
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
@ -68,7 +69,6 @@ pub fn process_new_animations(rw_data: &mut LayoutTaskData, pipeline_id: Pipelin
|
||||||
|
|
||||||
/// Recalculates style for an animation. This does *not* run with the DOM lock held.
|
/// Recalculates style for an animation. This does *not* run with the DOM lock held.
|
||||||
pub fn recalc_style_for_animation(flow: &mut Flow, animation: &Animation) {
|
pub fn recalc_style_for_animation(flow: &mut Flow, animation: &Animation) {
|
||||||
#![allow(unsafe_code)] // #6376
|
|
||||||
let mut damage = RestyleDamage::empty();
|
let mut damage = RestyleDamage::empty();
|
||||||
flow.mutate_fragments(&mut |fragment| {
|
flow.mutate_fragments(&mut |fragment| {
|
||||||
if fragment.node.id() != animation.node {
|
if fragment.node.id() != animation.node {
|
||||||
|
@ -85,7 +85,7 @@ pub fn recalc_style_for_animation(flow: &mut Flow, animation: &Animation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut new_style = fragment.style.clone();
|
let mut new_style = fragment.style.clone();
|
||||||
animation.property_animation.update(&mut *unsafe { new_style.make_unique() }, progress);
|
animation.property_animation.update(&mut *Arc::make_unique(&mut new_style), progress);
|
||||||
damage.insert(incremental::compute_damage(&Some(fragment.style.clone()), &new_style));
|
damage.insert(incremental::compute_damage(&Some(fragment.style.clone()), &new_style));
|
||||||
fragment.style = new_style
|
fragment.style = new_style
|
||||||
});
|
});
|
||||||
|
|
|
@ -939,7 +939,6 @@ impl InlineFlow {
|
||||||
fn justify_inline_fragments(fragments: &mut InlineFragments,
|
fn justify_inline_fragments(fragments: &mut InlineFragments,
|
||||||
line: &Line,
|
line: &Line,
|
||||||
slack_inline_size: Au) {
|
slack_inline_size: Au) {
|
||||||
#![allow(unsafe_code)] // #6376
|
|
||||||
// Fast path.
|
// Fast path.
|
||||||
if slack_inline_size == Au(0) {
|
if slack_inline_size == Au(0) {
|
||||||
return
|
return
|
||||||
|
@ -974,9 +973,9 @@ impl InlineFlow {
|
||||||
// FIXME(pcwalton): This is an awful lot of uniqueness making. I don't see any easy way
|
// FIXME(pcwalton): This is an awful lot of uniqueness making. I don't see any easy way
|
||||||
// to get rid of it without regressing the performance of the non-justified case,
|
// to get rid of it without regressing the performance of the non-justified case,
|
||||||
// though.
|
// though.
|
||||||
let run = unsafe { scanned_text_fragment_info.run.make_unique() };
|
let run = Arc::make_unique(&mut scanned_text_fragment_info.run);
|
||||||
{
|
{
|
||||||
let glyph_runs = unsafe { run.glyphs.make_unique() };
|
let glyph_runs = Arc::make_unique(&mut run.glyphs);
|
||||||
for mut glyph_run in glyph_runs.iter_mut() {
|
for mut glyph_run in glyph_runs.iter_mut() {
|
||||||
let mut range = glyph_run.range.intersect(&fragment_range);
|
let mut range = glyph_run.range.intersect(&fragment_range);
|
||||||
if range.is_empty() {
|
if range.is_empty() {
|
||||||
|
@ -984,7 +983,7 @@ impl InlineFlow {
|
||||||
}
|
}
|
||||||
range.shift_by(-glyph_run.range.begin());
|
range.shift_by(-glyph_run.range.begin());
|
||||||
|
|
||||||
let glyph_store = unsafe { glyph_run.glyph_store.make_unique() };
|
let glyph_store = Arc::make_unique(&mut glyph_run.glyph_store);
|
||||||
glyph_store.distribute_extra_space_in_range(&range,
|
glyph_store.distribute_extra_space_in_range(&range,
|
||||||
space_per_expansion_opportunity);
|
space_per_expansion_opportunity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,6 @@ name = "plugins"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
plugin = true
|
plugin = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies.tenacious]
|
||||||
tenacious = "*"
|
git = "https://github.com/servo/rust-tenacious"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use syntax::{ast, ast_util};
|
use syntax::{ast, ast_util};
|
||||||
use rustc::lint::{Context, LintPass, LintArray, Level};
|
use rustc::lint::{Context, LintPass, LintArray, Level};
|
||||||
use rustc::middle::{ty, def};
|
use rustc::middle::def;
|
||||||
|
|
||||||
use utils::match_lang_ty;
|
use utils::match_lang_ty;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ impl LintPass for InheritancePass {
|
||||||
_gen: &ast::Generics, id: ast::NodeId) {
|
_gen: &ast::Generics, id: ast::NodeId) {
|
||||||
// Lints are run post expansion, so it's fine to use
|
// Lints are run post expansion, so it's fine to use
|
||||||
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
// #[_dom_struct_marker] here without also checking for #[dom_struct]
|
||||||
if ty::has_attr(cx.tcx, ast_util::local_def(id), "_dom_struct_marker") {
|
if cx.tcx.has_attr(ast_util::local_def(id), "_dom_struct_marker") {
|
||||||
// Find the reflector, if any
|
// Find the reflector, if any
|
||||||
let reflector_span = def.fields.iter().enumerate()
|
let reflector_span = def.fields.iter().enumerate()
|
||||||
.find(|&(ctr, f)| {
|
.find(|&(ctr, f)| {
|
||||||
|
@ -46,7 +46,7 @@ impl LintPass for InheritancePass {
|
||||||
if let ast::TyPath(..) = f.node.ty.node {
|
if let ast::TyPath(..) = f.node.ty.node {
|
||||||
if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
|
if let Some(&def::PathResolution { base_def: def::DefTy(def_id, _), .. }) =
|
||||||
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
|
cx.tcx.def_map.borrow().get(&f.node.ty.id) {
|
||||||
if ty::has_attr(cx.tcx, def_id, "_dom_struct_marker") {
|
if cx.tcx.has_attr(def_id, "_dom_struct_marker") {
|
||||||
// If the field is not the first, it's probably
|
// If the field is not the first, it's probably
|
||||||
// being misused (a)
|
// being misused (a)
|
||||||
if ctr > 0 {
|
if ctr > 0 {
|
||||||
|
|
|
@ -6,7 +6,6 @@ use syntax::{ast, ast_util};
|
||||||
use syntax::ast::Public;
|
use syntax::ast::Public;
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use rustc::lint::{Context, LintPass, LintArray};
|
use rustc::lint::{Context, LintPass, LintArray};
|
||||||
use rustc::middle::ty;
|
|
||||||
|
|
||||||
declare_lint!(PRIVATIZE, Deny,
|
declare_lint!(PRIVATIZE, Deny,
|
||||||
"Allows to enforce private fields for struct definitions");
|
"Allows to enforce private fields for struct definitions");
|
||||||
|
@ -28,7 +27,7 @@ impl LintPass for PrivatizePass {
|
||||||
_i: ast::Ident,
|
_i: ast::Ident,
|
||||||
_gen: &ast::Generics,
|
_gen: &ast::Generics,
|
||||||
id: ast::NodeId) {
|
id: ast::NodeId) {
|
||||||
if ty::has_attr(cx.tcx, ast_util::local_def(id), "privatize") {
|
if cx.tcx.has_attr(ast_util::local_def(id), "privatize") {
|
||||||
for field in def.fields.iter() {
|
for field in def.fields.iter() {
|
||||||
match field.node {
|
match field.node {
|
||||||
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
|
ast::StructField_ { kind: ast::NamedField(ident, visibility), .. } if visibility == Public => {
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use rustc::lint::{Context, LintPass, LintArray};
|
use rustc::lint::{Context, LintPass, LintArray};
|
||||||
use rustc::middle::ty::expr_ty;
|
|
||||||
use rustc::middle::ty;
|
use rustc::middle::ty;
|
||||||
|
|
||||||
declare_lint!(STR_TO_STRING, Deny,
|
declare_lint!(STR_TO_STRING, Deny,
|
||||||
|
@ -38,7 +37,7 @@ impl LintPass for StrToStringPass {
|
||||||
_ => ty
|
_ => ty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match walk_ty(expr_ty(cx.tcx, expr)).sty {
|
match walk_ty(cx.tcx.expr_ty(expr)).sty {
|
||||||
ty::TyStr => true,
|
ty::TyStr => true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use rustc::lint::{Context, LintPass, LintArray};
|
use rustc::lint::{Context, LintPass, LintArray};
|
||||||
use rustc::middle::ty::expr_ty;
|
|
||||||
|
|
||||||
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
|
declare_lint!(TRANSMUTE_TYPE_LINT, Allow,
|
||||||
"Warn and report types being transmuted");
|
"Warn and report types being transmuted");
|
||||||
|
@ -32,8 +31,8 @@ impl LintPass for TransmutePass {
|
||||||
let tcx = cx.tcx;
|
let tcx = cx.tcx;
|
||||||
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
|
cx.span_lint(TRANSMUTE_TYPE_LINT, ex.span,
|
||||||
&format!("Transmute to {:?} from {:?} detected",
|
&format!("Transmute to {:?} from {:?} detected",
|
||||||
expr_ty(tcx, ex),
|
tcx.expr_ty(ex),
|
||||||
expr_ty(tcx, &**args.get(0).unwrap())
|
tcx.expr_ty(&**args.get(0).unwrap())
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use syntax::{ast, codemap, visit};
|
||||||
use syntax::attr::AttrMetaMethods;
|
use syntax::attr::AttrMetaMethods;
|
||||||
use rustc::ast_map;
|
use rustc::ast_map;
|
||||||
use rustc::lint::{Context, LintPass, LintArray};
|
use rustc::lint::{Context, LintPass, LintArray};
|
||||||
use rustc::middle::ty::expr_ty;
|
|
||||||
use rustc::middle::{ty, def};
|
use rustc::middle::{ty, def};
|
||||||
use utils::unsafe_context;
|
use utils::unsafe_context;
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
|
||||||
ast::TyPath(..) => {
|
ast::TyPath(..) => {
|
||||||
match cx.tcx.def_map.borrow()[&ty.id] {
|
match cx.tcx.def_map.borrow()[&ty.id] {
|
||||||
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
|
def::PathResolution{ base_def: def::DefTy(def_id, _), .. } => {
|
||||||
if ty::has_attr(cx.tcx, def_id, "must_root") {
|
if cx.tcx.has_attr(def_id, "must_root") {
|
||||||
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
|
cx.span_lint(UNROOTED_MUST_ROOT, ty.span, warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,11 +155,11 @@ impl LintPass for UnrootedPass {
|
||||||
_ => return
|
_ => return
|
||||||
};
|
};
|
||||||
|
|
||||||
let t = expr_ty(cx.tcx, &*expr);
|
let t = cx.tcx.expr_ty(&*expr);
|
||||||
match t.sty {
|
match t.sty {
|
||||||
ty::TyStruct(did, _) |
|
ty::TyStruct(did, _) |
|
||||||
ty::TyEnum(did, _) => {
|
ty::TyEnum(did, _) => {
|
||||||
if ty::has_attr(cx.tcx, did, "must_root") {
|
if cx.tcx.has_attr(did, "must_root") {
|
||||||
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
|
cx.span_lint(UNROOTED_MUST_ROOT, expr.span,
|
||||||
&format!("Expression of type {:?} must be rooted", t));
|
&format!("Expression of type {:?} must be rooted", t));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use rustc::ast_map;
|
use rustc::ast_map;
|
||||||
use rustc::lint::Context;
|
use rustc::lint::Context;
|
||||||
use rustc::middle::{ty, def};
|
use rustc::middle::def;
|
||||||
|
|
||||||
use syntax::ptr::P;
|
use syntax::ptr::P;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
|
@ -49,7 +49,7 @@ pub fn match_lang_ty(cx: &Context, ty: &Ty, value: &str) -> bool {
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
|
|
||||||
ty::get_attrs(cx.tcx, def_id).iter().any(|attr| {
|
cx.tcx.get_attrs(def_id).iter().any(|attr| {
|
||||||
match attr.node.value.node {
|
match attr.node.value.node {
|
||||||
ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => {
|
ast::MetaNameValue(ref name, ref val) if &**name == "servo_lang" => {
|
||||||
match val.node {
|
match val.node {
|
||||||
|
|
|
@ -619,14 +619,13 @@ impl<'a> ElementHelpers<'a> for &'a Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_inline_style_property(self, property: DOMString) {
|
fn remove_inline_style_property(self, property: DOMString) {
|
||||||
#![allow(unsafe_code)] // #6376
|
|
||||||
let mut inline_declarations = self.style_attribute.borrow_mut();
|
let mut inline_declarations = self.style_attribute.borrow_mut();
|
||||||
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
||||||
let index = declarations.normal
|
let index = declarations.normal
|
||||||
.iter()
|
.iter()
|
||||||
.position(|decl| decl.name() == property);
|
.position(|decl| decl.name() == property);
|
||||||
if let Some(index) = index {
|
if let Some(index) = index {
|
||||||
unsafe { declarations.normal.make_unique().remove(index); }
|
Arc::make_unique(&mut declarations.normal).remove(index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,20 +633,19 @@ impl<'a> ElementHelpers<'a> for &'a Element {
|
||||||
.iter()
|
.iter()
|
||||||
.position(|decl| decl.name() == property);
|
.position(|decl| decl.name() == property);
|
||||||
if let Some(index) = index {
|
if let Some(index) = index {
|
||||||
unsafe { declarations.important.make_unique().remove(index); }
|
Arc::make_unique(&mut declarations.important).remove(index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_inline_style(self, property_decl: PropertyDeclaration, style_priority: StylePriority) {
|
fn update_inline_style(self, property_decl: PropertyDeclaration, style_priority: StylePriority) {
|
||||||
#![allow(unsafe_code)] // #6376
|
|
||||||
let mut inline_declarations = self.style_attribute().borrow_mut();
|
let mut inline_declarations = self.style_attribute().borrow_mut();
|
||||||
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
if let &mut Some(ref mut declarations) = &mut *inline_declarations {
|
||||||
let existing_declarations = if style_priority == StylePriority::Important {
|
let existing_declarations = if style_priority == StylePriority::Important {
|
||||||
unsafe { declarations.important.make_unique() }
|
Arc::make_unique(&mut declarations.important)
|
||||||
} else {
|
} else {
|
||||||
unsafe { declarations.normal.make_unique() }
|
Arc::make_unique(&mut declarations.normal)
|
||||||
};
|
};
|
||||||
|
|
||||||
for declaration in existing_declarations.iter_mut() {
|
for declaration in existing_declarations.iter_mut() {
|
||||||
|
|
|
@ -963,7 +963,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
name = "plugins"
|
name = "plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tenacious 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tenacious 0.0.6 (git+https://github.com/servo/rust-tenacious)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1240,8 +1240,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tenacious"
|
name = "tenacious"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/servo/rust-tenacious#8f878d812a95dc44dab9c03096fcf8a52687868a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendril"
|
name = "tendril"
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
// This file is a Mako template: http://www.makotemplates.org/
|
// This file is a Mako template: http://www.makotemplates.org/
|
||||||
|
|
||||||
// XXXManishearth remove all unsafe blocks when
|
|
||||||
// https://github.com/rust-lang/rust/issues/24880 is fixed
|
|
||||||
// See #6376
|
|
||||||
|
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
@ -5502,7 +5498,7 @@ impl ComputedValues {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mutate_${style_struct.name.lower()}
|
pub fn mutate_${style_struct.name.lower()}
|
||||||
<'a>(&'a mut self) -> &'a mut style_structs::${style_struct.name} {
|
<'a>(&'a mut self) -> &'a mut style_structs::${style_struct.name} {
|
||||||
unsafe{ &mut *self.${style_struct.ident}.make_unique() }
|
&mut *Arc::make_unique(&mut self.${style_struct.ident})
|
||||||
}
|
}
|
||||||
% endfor
|
% endfor
|
||||||
}
|
}
|
||||||
|
@ -5613,8 +5609,8 @@ fn cascade_with_cached_declarations(
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
unsafe { style_${style_struct.ident}.make_unique()
|
Arc::make_unique(&mut style_${style_struct.ident})
|
||||||
.${property.ident} = computed_value; }
|
.${property.ident} = computed_value;
|
||||||
% endif
|
% endif
|
||||||
|
|
||||||
% if property.name in DERIVED_LONGHANDS:
|
% if property.name in DERIVED_LONGHANDS:
|
||||||
|
@ -5624,13 +5620,12 @@ fn cascade_with_cached_declarations(
|
||||||
.${property.ident}.clone();
|
.${property.ident}.clone();
|
||||||
% endif
|
% endif
|
||||||
% for derived in DERIVED_LONGHANDS[property.name]:
|
% for derived in DERIVED_LONGHANDS[property.name]:
|
||||||
unsafe { style_${derived.style_struct.ident}
|
Arc::make_unique(&mut style_${derived.style_struct.ident})
|
||||||
.make_unique()
|
|
||||||
.${derived.ident} =
|
.${derived.ident} =
|
||||||
longhands::${derived.ident}
|
longhands::${derived.ident}
|
||||||
::derive_from_${property.ident}(
|
::derive_from_${property.ident}(
|
||||||
computed_value,
|
computed_value,
|
||||||
context); }
|
context);
|
||||||
% endfor
|
% endfor
|
||||||
% endif
|
% endif
|
||||||
}
|
}
|
||||||
|
@ -5647,7 +5642,7 @@ fn cascade_with_cached_declarations(
|
||||||
|
|
||||||
if seen.get_font_style() || seen.get_font_weight() || seen.get_font_stretch() ||
|
if seen.get_font_style() || seen.get_font_weight() || seen.get_font_stretch() ||
|
||||||
seen.get_font_family() {
|
seen.get_font_family() {
|
||||||
unsafe { compute_font_hash(&mut *style_font.make_unique()) }
|
compute_font_hash(&mut *Arc::make_unique(&mut style_font))
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputedValues {
|
ComputedValues {
|
||||||
|
@ -5859,18 +5854,17 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
.clone()
|
.clone()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
unsafe { style_${style_struct.ident}.make_unique()
|
Arc::make_unique(&mut style_${style_struct.ident})
|
||||||
.${property.ident} = computed_value; }
|
.${property.ident} = computed_value;
|
||||||
|
|
||||||
% if property.name in DERIVED_LONGHANDS:
|
% if property.name in DERIVED_LONGHANDS:
|
||||||
% for derived in DERIVED_LONGHANDS[property.name]:
|
% for derived in DERIVED_LONGHANDS[property.name]:
|
||||||
unsafe { style_${derived.style_struct.ident}
|
Arc::make_unique(&mut style_${derived.style_struct.ident})
|
||||||
.make_unique()
|
|
||||||
.${derived.ident} =
|
.${derived.ident} =
|
||||||
longhands::${derived.ident}
|
longhands::${derived.ident}
|
||||||
::derive_from_${property.ident}(
|
::derive_from_${property.ident}(
|
||||||
computed_value,
|
computed_value,
|
||||||
&context); }
|
&context);
|
||||||
% endfor
|
% endfor
|
||||||
% endif
|
% endif
|
||||||
}
|
}
|
||||||
|
@ -5887,7 +5881,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
|
|
||||||
// The initial value of border-*-width may be changed at computed value time.
|
// The initial value of border-*-width may be changed at computed value time.
|
||||||
{
|
{
|
||||||
let border = unsafe { style_border.make_unique() };
|
let border = Arc::make_unique(&mut style_border);
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
// Like calling to_computed_value, which wouldn't type check.
|
// Like calling to_computed_value, which wouldn't type check.
|
||||||
if !context.border_${side}_present {
|
if !context.border_${side}_present {
|
||||||
|
@ -5898,13 +5892,13 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
|
|
||||||
// The initial value of display may be changed at computed value time.
|
// The initial value of display may be changed at computed value time.
|
||||||
if !seen.get_display() {
|
if !seen.get_display() {
|
||||||
let box_ = unsafe { style_box_.make_unique() };
|
let box_ = Arc::make_unique(&mut style_box_);
|
||||||
box_.display = box_.display.to_computed_value(&context);
|
box_.display = box_.display.to_computed_value(&context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The initial value of outline width may be changed at computed value time.
|
// The initial value of outline width may be changed at computed value time.
|
||||||
if !context.outline_style_present {
|
if !context.outline_style_present {
|
||||||
let outline = unsafe { style_outline.make_unique() };
|
let outline = Arc::make_unique(&mut style_outline);
|
||||||
outline.outline_width = Au(0);
|
outline.outline_width = Au(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5914,7 +5908,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
|
|
||||||
if seen.get_font_style() || seen.get_font_weight() || seen.get_font_stretch() ||
|
if seen.get_font_style() || seen.get_font_weight() || seen.get_font_stretch() ||
|
||||||
seen.get_font_family() {
|
seen.get_font_family() {
|
||||||
unsafe { compute_font_hash(&mut *style_font.make_unique()) }
|
compute_font_hash(&mut *Arc::make_unique(&mut style_font))
|
||||||
}
|
}
|
||||||
|
|
||||||
(ComputedValues {
|
(ComputedValues {
|
||||||
|
@ -5949,7 +5943,7 @@ pub fn cascade_anonymous(parent_style: &ComputedValues) -> ComputedValues {
|
||||||
root_font_size: parent_style.root_font_size,
|
root_font_size: parent_style.root_font_size,
|
||||||
};
|
};
|
||||||
{
|
{
|
||||||
let border = unsafe { result.border.make_unique() };
|
let border = Arc::make_unique(&mut result.border);
|
||||||
% for side in ["top", "right", "bottom", "left"]:
|
% for side in ["top", "right", "bottom", "left"]:
|
||||||
// Like calling to_computed_value, which wouldn't type check.
|
// Like calling to_computed_value, which wouldn't type check.
|
||||||
border.border_${side}_width = Au(0);
|
border.border_${side}_width = Au(0);
|
||||||
|
@ -5957,7 +5951,7 @@ pub fn cascade_anonymous(parent_style: &ComputedValues) -> ComputedValues {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// Initial value of outline-style is always none for anonymous box.
|
// Initial value of outline-style is always none for anonymous box.
|
||||||
let outline = unsafe { result.outline.make_unique() };
|
let outline = Arc::make_unique(&mut result.outline);
|
||||||
outline.outline_width = Au(0);
|
outline.outline_width = Au(0);
|
||||||
}
|
}
|
||||||
// None of the teaks on 'display' apply here.
|
// None of the teaks on 'display' apply here.
|
||||||
|
@ -5974,20 +5968,16 @@ pub fn cascade_anonymous(parent_style: &ComputedValues) -> ComputedValues {
|
||||||
pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
|
pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
|
||||||
// Reset `position` to handle cases like `<div style="position: absolute">foo bar baz</div>`.
|
// Reset `position` to handle cases like `<div style="position: absolute">foo bar baz</div>`.
|
||||||
if style.box_.display != longhands::display::computed_value::T::inline {
|
if style.box_.display != longhands::display::computed_value::T::inline {
|
||||||
unsafe {
|
let mut style = Arc::make_unique(style);
|
||||||
let mut style = style.make_unique();
|
Arc::make_unique(&mut style.box_).display = longhands::display::computed_value::T::inline;
|
||||||
style.box_.make_unique().display = longhands::display::computed_value::T::inline;
|
Arc::make_unique(&mut style.box_).position = longhands::position::computed_value::T::static_;
|
||||||
style.box_.make_unique().position = longhands::position::computed_value::T::static_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset `vertical-align` to handle cases like `<sup>foo</sup>`.
|
// Reset `vertical-align` to handle cases like `<sup>foo</sup>`.
|
||||||
if style.box_.vertical_align != longhands::vertical_align::computed_value::T::baseline {
|
if style.box_.vertical_align != longhands::vertical_align::computed_value::T::baseline {
|
||||||
unsafe {
|
let mut style = Arc::make_unique(style);
|
||||||
let mut style = style.make_unique();
|
Arc::make_unique(&mut style.box_).vertical_align =
|
||||||
style.box_.make_unique().vertical_align =
|
longhands::vertical_align::computed_value::T::baseline
|
||||||
longhands::vertical_align::computed_value::T::baseline
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset margins.
|
// Reset margins.
|
||||||
|
@ -5995,14 +5985,12 @@ pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
|
||||||
style.margin.margin_left != computed::LengthOrPercentageOrAuto::Length(Au(0)) ||
|
style.margin.margin_left != computed::LengthOrPercentageOrAuto::Length(Au(0)) ||
|
||||||
style.margin.margin_bottom != computed::LengthOrPercentageOrAuto::Length(Au(0)) ||
|
style.margin.margin_bottom != computed::LengthOrPercentageOrAuto::Length(Au(0)) ||
|
||||||
style.margin.margin_right != computed::LengthOrPercentageOrAuto::Length(Au(0)) {
|
style.margin.margin_right != computed::LengthOrPercentageOrAuto::Length(Au(0)) {
|
||||||
unsafe {
|
let mut style = Arc::make_unique(style);
|
||||||
let mut style = style.make_unique();
|
let margin = Arc::make_unique(&mut style.margin);
|
||||||
let margin = style.margin.make_unique();
|
margin.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||||
margin.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
margin.margin_left = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||||
margin.margin_left = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
margin.margin_bottom = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||||
margin.margin_bottom = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
margin.margin_right = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
||||||
margin.margin_right = computed::LengthOrPercentageOrAuto::Length(Au(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6016,42 +6004,40 @@ pub fn modify_style_for_inline_sides(style: &mut Arc<ComputedValues>,
|
||||||
is_first_fragment_of_element: bool,
|
is_first_fragment_of_element: bool,
|
||||||
is_last_fragment_of_element: bool) {
|
is_last_fragment_of_element: bool) {
|
||||||
fn modify_side(style: &mut Arc<ComputedValues>, side: PhysicalSide) {
|
fn modify_side(style: &mut Arc<ComputedValues>, side: PhysicalSide) {
|
||||||
unsafe {
|
let mut style = Arc::make_unique(style);
|
||||||
let mut style = style.make_unique();
|
let border = Arc::make_unique(&mut style.border);
|
||||||
let border = style.border.make_unique();
|
match side {
|
||||||
match side {
|
PhysicalSide::Left => {
|
||||||
PhysicalSide::Left => {
|
border.border_left_width = Au(0);
|
||||||
border.border_left_width = Au(0);
|
border.border_left_style = BorderStyle::none;
|
||||||
border.border_left_style = BorderStyle::none;
|
Arc::make_unique(&mut style.padding).padding_left =
|
||||||
style.padding.make_unique().padding_left =
|
computed::LengthOrPercentage::Length(Au(0));
|
||||||
computed::LengthOrPercentage::Length(Au(0));
|
Arc::make_unique(&mut style.margin).margin_left =
|
||||||
style.margin.make_unique().margin_left =
|
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
||||||
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
}
|
||||||
}
|
PhysicalSide::Right => {
|
||||||
PhysicalSide::Right => {
|
border.border_right_width = Au(0);
|
||||||
border.border_right_width = Au(0);
|
border.border_right_style = BorderStyle::none;
|
||||||
border.border_right_style = BorderStyle::none;
|
Arc::make_unique(&mut style.padding).padding_right =
|
||||||
style.padding.make_unique().padding_right =
|
computed::LengthOrPercentage::Length(Au(0));
|
||||||
computed::LengthOrPercentage::Length(Au(0));
|
Arc::make_unique(&mut style.margin).margin_right =
|
||||||
style.margin.make_unique().margin_right =
|
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
||||||
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
}
|
||||||
}
|
PhysicalSide::Bottom => {
|
||||||
PhysicalSide::Bottom => {
|
border.border_bottom_width = Au(0);
|
||||||
border.border_bottom_width = Au(0);
|
border.border_bottom_style = BorderStyle::none;
|
||||||
border.border_bottom_style = BorderStyle::none;
|
Arc::make_unique(&mut style.padding).padding_bottom =
|
||||||
style.padding.make_unique().padding_bottom =
|
computed::LengthOrPercentage::Length(Au(0));
|
||||||
computed::LengthOrPercentage::Length(Au(0));
|
Arc::make_unique(&mut style.margin).margin_bottom =
|
||||||
style.margin.make_unique().margin_bottom =
|
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
||||||
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
}
|
||||||
}
|
PhysicalSide::Top => {
|
||||||
PhysicalSide::Top => {
|
border.border_top_width = Au(0);
|
||||||
border.border_top_width = Au(0);
|
border.border_top_style = BorderStyle::none;
|
||||||
border.border_top_style = BorderStyle::none;
|
Arc::make_unique(&mut style.padding).padding_top =
|
||||||
style.padding.make_unique().padding_top =
|
computed::LengthOrPercentage::Length(Au(0));
|
||||||
computed::LengthOrPercentage::Length(Au(0));
|
Arc::make_unique(&mut style.margin).margin_top =
|
||||||
style.margin.make_unique().margin_top =
|
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
||||||
computed::LengthOrPercentageOrAuto::Length(Au(0))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -943,7 +943,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
name = "plugins"
|
name = "plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tenacious 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tenacious 0.0.6 (git+https://github.com/servo/rust-tenacious)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1224,8 +1224,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tenacious"
|
name = "tenacious"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/servo/rust-tenacious#8f878d812a95dc44dab9c03096fcf8a52687868a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendril"
|
name = "tendril"
|
||||||
|
|
|
@ -851,7 +851,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
name = "plugins"
|
name = "plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tenacious 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tenacious 0.0.6 (git+https://github.com/servo/rust-tenacious)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1122,8 +1122,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tenacious"
|
name = "tenacious"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/servo/rust-tenacious#8f878d812a95dc44dab9c03096fcf8a52687868a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tendril"
|
name = "tendril"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2d0cbf3e3e25e092bd9e4c94d08e446b680869f0/rustc-1.2.0-dev
|
f3b97a74aade8cb13a10c3669a1c18e19ff45890/rustc-1.3.0-dev
|
||||||
|
|
Загрузка…
Ссылка в новой задаче