Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't mark the first/last fragment of an {ib} split as FIRST/LAST_FRAGMENT_OF_ELEMENT. #14035

Merged
merged 3 commits into from Nov 10, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Elaborated on enclosing_node in comment, moved existing comments around

  • Loading branch information
Permutatrix committed Nov 7, 2016
commit 0db5c557f28d636d585c0423e56e34d4eaa7cccf
@@ -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));
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.