servo: Merge #4952 - Dont draw interior borders for text run fragments (from bjwbell:borders-txt-nodes); r=pcwalton

Inline fragments that are part of a text run don't have interior borders.
So don't draw interior borders or include them when calculating positioning.

Fixes https://github.com/servo/servo/issues/4658, where multiple text nodes that are adjacent have distinct borders.

r? @Ms2ger, @pcwalton

Source-Repo: https://github.com/servo/servo
Source-Revision: b2f099026a8c649daf063dc7e119a514c2680697
This commit is contained in:
Bryan Bell
2015-02-27 16:57:53 -07:00
parent dfc038211d
commit bf1bb7a4da
3 changed files with 49 additions and 9 deletions

View File

@@ -195,14 +195,17 @@ impl InlineFragmentsAccumulator {
mut fragments,
enclosing_style
} = self;
if let Some(enclosing_style) = enclosing_style {
let frag_len = fragments.len();
for (idx, frag) in fragments.iter_mut().enumerate() {
match enclosing_style {
Some(enclosing_style) => {
for frag in fragments.iter_mut() {
frag.add_inline_context_style(enclosing_style.clone());
}
// frag is first inline fragment in the inline node
let is_first = idx == 0;
// frag is the last inline fragment in the inline node
let is_last = idx == frag_len - 1;
frag.add_inline_context_style(enclosing_style.clone(), is_first, is_last);
}
None => {}
}
fragments
}