diff options
author | Permutator <permutatorem@gmail.com> | 2016-11-06 23:34:02 -0800 |
---|---|---|
committer | Permutator <permutatorem@gmail.com> | 2016-11-06 23:34:02 -0800 |
commit | 0db5c557f28d636d585c0423e56e34d4eaa7cccf (patch) | |
tree | c88f583099cedb2641fe664b880b0d49926a6a62 /components/layout/construct.rs | |
parent | 6321f70861fedce3797406dd3b759ebdcfa31cea (diff) | |
download | servo-0db5c557f28d636d585c0423e56e34d4eaa7cccf.tar.gz servo-0db5c557f28d636d585c0423e56e34d4eaa7cccf.zip |
Elaborated on enclosing_node in comment, moved existing comments around
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r-- | components/layout/construct.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 126d325d939..43299327684 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -159,9 +159,9 @@ pub struct InlineBlockSplit { pub flow: FlowRef, } -/// Flushes the given accumulator to the new split and makes a new accumulator to hold any -/// subsequent fragments. impl InlineBlockSplit { + /// Flushes the given accumulator to the new split and makes a new accumulator to hold any + /// subsequent fragments. fn new<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>(fragment_accumulator: &mut InlineFragmentsAccumulator, node: &ConcreteThreadSafeLayoutNode, style_context: &SharedStyleContext, @@ -218,8 +218,14 @@ struct InlineFragmentsAccumulator { /// The list of fragments. fragments: IntermediateInlineFragments, - /// Whether we've created a range to enclose all the fragments. This will be Some() if the - /// outer node is an inline and None otherwise. + /// Information about the inline box directly enclosing the fragments being gathered, if any. + /// + /// `inline::InlineFragmentNodeInfo` also stores flags indicating whether a fragment is the + /// first and/or last of the corresponding inline box. This `InlineFragmentsAccumulator` may + /// represent only one side of an {ib} split, so we store these flags as if it represented only + /// one fragment. `to_intermediate_inline_fragments` later splits this hypothetical fragment + /// into pieces, leaving the `FIRST_FRAGMENT_OF_ELEMENT` and `LAST_FRAGMENT_OF_ELEMENT` flags, + /// if present, on the first and last fragments of the output. enclosing_node: Option<InlineFragmentNodeInfo>, /// Restyle damage to use for fragments created in this node. @@ -284,10 +290,10 @@ impl InlineFragmentsAccumulator { fragment.add_inline_context_style(enclosing_node); } - enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT); - // Control characters are later discarded in transform_text, so they don't affect the // is_first/is_last styles above. + enclosing_node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT | LAST_FRAGMENT_OF_ELEMENT); + if let Some((start, end)) = bidi_control_chars { fragments.fragments.push_front( control_chars_to_fragment(&enclosing_node, start, restyle_damage)); |