layout: Address some more review comments

This commit is contained in:
Patrick Walton 2014-03-31 19:48:40 -07:00
parent aabda89a90
commit 56096503b0
2 changed files with 28 additions and 23 deletions

View file

@ -766,7 +766,8 @@ impl BlockFlow {
/// If this is the root flow, shifts all kids down and adjusts our size to account for
/// collapsed margins.
///
/// TODO(pcwalton): This is somewhat inefficient (traverses kids twice); can we do better?
/// TODO(#2017, pcwalton): This is somewhat inefficient (traverses kids twice); can we do
/// better?
fn adjust_boxes_for_collapsed_margins_if_root(&mut self) {
if !self.is_root() {
return
@ -1519,7 +1520,7 @@ impl BlockFlow {
// Per CSS 2.1 § 16.3.1, text decoration propagates to all children in flow.
//
// TODO(pcwalton): When we have out-of-flow children, don't unconditionally propagate.
// TODO(#2018, pcwalton): Do this in the cascade instead.
let child_base = flow::mut_base(kid);
child_base.flags_info.propagate_text_decoration_from_parent(&flags_info);
child_base.flags_info.propagate_text_alignment_from_parent(&flags_info)

View file

@ -97,29 +97,29 @@ pub mod longhands {
% endif
pub use self::computed_value::*;
${caller.body()}
pub fn parse_declared(input: &[ComponentValue], base_url: &Url)
-> Option<DeclaredValue<SpecifiedValue>> {
match CSSWideKeyword::parse(input) {
Some(Some(keyword)) => Some(CSSWideKeyword(keyword)),
Some(None) => Some(CSSWideKeyword(${
"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"})),
None => parse_specified(input, base_url),
% if derived_from is None:
pub fn parse_declared(input: &[ComponentValue], base_url: &Url)
-> Option<DeclaredValue<SpecifiedValue>> {
match CSSWideKeyword::parse(input) {
Some(Some(keyword)) => Some(CSSWideKeyword(keyword)),
Some(None) => Some(CSSWideKeyword(${
"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"})),
None => parse_specified(input, base_url),
}
}
}
% endif
}
</%def>
<%def name="longhand(name, no_super=False, derived_from=None)">
<%self:raw_longhand name="${name}" derived_from="${derived_from}">
${caller.body()}
pub fn parse_specified(_input: &[ComponentValue], _base_url: &Url)
-> Option<DeclaredValue<SpecifiedValue>> {
% if derived_from is None:
% if derived_from is None:
pub fn parse_specified(_input: &[ComponentValue], _base_url: &Url)
-> Option<DeclaredValue<SpecifiedValue>> {
parse(_input, _base_url).map(super::SpecifiedValue)
% else:
None
% endif
}
}
% endif
</%self:raw_longhand>
</%def>
@ -1328,12 +1328,16 @@ impl PropertyDeclaration {
let name_lower = tmp_for_lifetime.as_str_ascii();
match name_lower.as_slice() {
% for property in LONGHANDS:
"${property.name}" => result_list.push(${property.ident}_declaration(
match longhands::${property.ident}::parse_declared(value, base_url) {
Some(value) => value,
None => return InvalidValue,
}
)),
% if property.derived_from is None:
"${property.name}" => result_list.push(${property.ident}_declaration(
match longhands::${property.ident}::parse_declared(value, base_url) {
Some(value) => value,
None => return InvalidValue,
}
)),
% else:
"${property.name}" => {}
% endif
% endfor
% for shorthand in SHORTHANDS:
"${shorthand.name}" => match CSSWideKeyword::parse(value) {