mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Auto merge of #7534 - pcwalton:inline-absolute-out-of-flow, r=mbrubeck
layout: Lay absolutely-positioned blocks with inline containing blocks out of flow. Removes the long space before the site-specific drop-down in the Google SERPs. r? @glennw <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7534) <!-- Reviewable:end -->
This commit is contained in:
commit
aeb8dce2d9
5 changed files with 40 additions and 9 deletions
|
@ -2376,6 +2376,13 @@ impl Fragment {
|
|||
self.style.get_box().position == position::T::absolute
|
||||
}
|
||||
|
||||
pub fn is_inline_absolute(&self) -> bool {
|
||||
match self.specific {
|
||||
SpecificFragmentInfo::InlineAbsolute(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn meld_with_next_inline_fragment(&mut self, next_fragment: &Fragment) {
|
||||
if let Some(ref mut inline_context_of_this_fragment) = self.inline_context {
|
||||
if let Some(ref inline_context_of_next_fragment) = next_fragment.inline_context {
|
||||
|
|
|
@ -738,13 +738,17 @@ impl LineBreaker {
|
|||
layout_context: &LayoutContext) {
|
||||
let indentation = self.indentation_for_pending_fragment();
|
||||
self.pending_line.range.extend_by(FragmentIndex(1));
|
||||
self.pending_line.bounds.size.inline = self.pending_line.bounds.size.inline +
|
||||
fragment.margin_box_inline_size() +
|
||||
indentation;
|
||||
self.pending_line.inline_metrics =
|
||||
self.new_inline_metrics_for_line(&fragment, layout_context);
|
||||
self.pending_line.bounds.size.block =
|
||||
self.new_block_size_for_line(&fragment, layout_context);
|
||||
|
||||
if !fragment.is_inline_absolute() {
|
||||
self.pending_line.bounds.size.inline = self.pending_line.bounds.size.inline +
|
||||
fragment.margin_box_inline_size() +
|
||||
indentation;
|
||||
self.pending_line.inline_metrics =
|
||||
self.new_inline_metrics_for_line(&fragment, layout_context);
|
||||
self.pending_line.bounds.size.block =
|
||||
self.new_block_size_for_line(&fragment, layout_context);
|
||||
}
|
||||
|
||||
self.new_fragments.push(fragment);
|
||||
}
|
||||
|
||||
|
@ -1079,8 +1083,11 @@ impl InlineFlow {
|
|||
fragment.border_box.size.inline,
|
||||
fragment.border_box.size.block);
|
||||
fragment.update_late_computed_inline_position_if_necessary();
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
fragment.border_box.size.inline + fragment.margin.inline_end;
|
||||
|
||||
if !fragment.is_inline_absolute() {
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
fragment.border_box.size.inline + fragment.margin.inline_end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue