mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
layout: Address some more review comments
This commit is contained in:
parent
aabda89a90
commit
56096503b0
2 changed files with 28 additions and 23 deletions
|
@ -766,7 +766,8 @@ impl BlockFlow {
|
||||||
/// If this is the root flow, shifts all kids down and adjusts our size to account for
|
/// If this is the root flow, shifts all kids down and adjusts our size to account for
|
||||||
/// collapsed margins.
|
/// 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) {
|
fn adjust_boxes_for_collapsed_margins_if_root(&mut self) {
|
||||||
if !self.is_root() {
|
if !self.is_root() {
|
||||||
return
|
return
|
||||||
|
@ -1519,7 +1520,7 @@ impl BlockFlow {
|
||||||
|
|
||||||
// Per CSS 2.1 § 16.3.1, text decoration propagates to all children in flow.
|
// 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);
|
let child_base = flow::mut_base(kid);
|
||||||
child_base.flags_info.propagate_text_decoration_from_parent(&flags_info);
|
child_base.flags_info.propagate_text_decoration_from_parent(&flags_info);
|
||||||
child_base.flags_info.propagate_text_alignment_from_parent(&flags_info)
|
child_base.flags_info.propagate_text_alignment_from_parent(&flags_info)
|
||||||
|
|
|
@ -97,29 +97,29 @@ pub mod longhands {
|
||||||
% endif
|
% endif
|
||||||
pub use self::computed_value::*;
|
pub use self::computed_value::*;
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
pub fn parse_declared(input: &[ComponentValue], base_url: &Url)
|
% if derived_from is None:
|
||||||
-> Option<DeclaredValue<SpecifiedValue>> {
|
pub fn parse_declared(input: &[ComponentValue], base_url: &Url)
|
||||||
match CSSWideKeyword::parse(input) {
|
-> Option<DeclaredValue<SpecifiedValue>> {
|
||||||
Some(Some(keyword)) => Some(CSSWideKeyword(keyword)),
|
match CSSWideKeyword::parse(input) {
|
||||||
Some(None) => Some(CSSWideKeyword(${
|
Some(Some(keyword)) => Some(CSSWideKeyword(keyword)),
|
||||||
"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"})),
|
Some(None) => Some(CSSWideKeyword(${
|
||||||
None => parse_specified(input, base_url),
|
"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"})),
|
||||||
|
None => parse_specified(input, base_url),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
% endif
|
||||||
}
|
}
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="longhand(name, no_super=False, derived_from=None)">
|
<%def name="longhand(name, no_super=False, derived_from=None)">
|
||||||
<%self:raw_longhand name="${name}" derived_from="${derived_from}">
|
<%self:raw_longhand name="${name}" derived_from="${derived_from}">
|
||||||
${caller.body()}
|
${caller.body()}
|
||||||
pub fn parse_specified(_input: &[ComponentValue], _base_url: &Url)
|
% if derived_from is None:
|
||||||
-> Option<DeclaredValue<SpecifiedValue>> {
|
pub fn parse_specified(_input: &[ComponentValue], _base_url: &Url)
|
||||||
% if derived_from is None:
|
-> Option<DeclaredValue<SpecifiedValue>> {
|
||||||
parse(_input, _base_url).map(super::SpecifiedValue)
|
parse(_input, _base_url).map(super::SpecifiedValue)
|
||||||
% else:
|
}
|
||||||
None
|
% endif
|
||||||
% endif
|
|
||||||
}
|
|
||||||
</%self:raw_longhand>
|
</%self:raw_longhand>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
|
@ -1328,12 +1328,16 @@ impl PropertyDeclaration {
|
||||||
let name_lower = tmp_for_lifetime.as_str_ascii();
|
let name_lower = tmp_for_lifetime.as_str_ascii();
|
||||||
match name_lower.as_slice() {
|
match name_lower.as_slice() {
|
||||||
% for property in LONGHANDS:
|
% for property in LONGHANDS:
|
||||||
"${property.name}" => result_list.push(${property.ident}_declaration(
|
% if property.derived_from is None:
|
||||||
match longhands::${property.ident}::parse_declared(value, base_url) {
|
"${property.name}" => result_list.push(${property.ident}_declaration(
|
||||||
Some(value) => value,
|
match longhands::${property.ident}::parse_declared(value, base_url) {
|
||||||
None => return InvalidValue,
|
Some(value) => value,
|
||||||
}
|
None => return InvalidValue,
|
||||||
)),
|
}
|
||||||
|
)),
|
||||||
|
% else:
|
||||||
|
"${property.name}" => {}
|
||||||
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
% for shorthand in SHORTHANDS:
|
% for shorthand in SHORTHANDS:
|
||||||
"${shorthand.name}" => match CSSWideKeyword::parse(value) {
|
"${shorthand.name}" => match CSSWideKeyword::parse(value) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue