mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #6492 - pcwalton:even-more-jumpiness, r=mbrubeck
layout: Modify styles for replaced content as appropriate during incremental flow construction. Fixes jumpiness on lots of Web sites. r? @mbrubeck <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6492) <!-- Reviewable:end -->
This commit is contained in:
commit
bbcd427733
30 changed files with 68 additions and 69 deletions
|
@ -1171,7 +1171,12 @@ pub trait ToAzureRect {
|
|||
|
||||
impl ToAzureRect for Rect<Au> {
|
||||
fn to_nearest_azure_rect(&self) -> Rect<AzFloat> {
|
||||
Rect::new(self.origin.to_nearest_azure_point(), self.size.to_nearest_azure_size())
|
||||
let top_left = self.origin.to_nearest_azure_point();
|
||||
let bottom_right = self.bottom_right().to_nearest_azure_point();
|
||||
Rect::new(top_left,
|
||||
Size2D::new((bottom_right.x - top_left.x) as AzFloat,
|
||||
(bottom_right.y - top_left.y) as AzFloat))
|
||||
|
||||
}
|
||||
fn to_azure_rect(&self) -> Rect<AzFloat> {
|
||||
Rect::new(self.origin.to_azure_point(), Size2D::new(self.size.width.to_f32_px(),
|
||||
|
|
|
@ -1249,7 +1249,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
|
||||
let mut layout_data_ref = node.mutate_layout_data();
|
||||
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
||||
let style = (*node.get_style(&layout_data)).clone();
|
||||
let mut style = (*node.get_style(&layout_data)).clone();
|
||||
let damage = layout_data.data.restyle_damage;
|
||||
match node.construction_result_mut(layout_data) {
|
||||
&mut ConstructionResult::None => true,
|
||||
|
@ -1297,8 +1297,10 @@ impl<'a> FlowConstructor<'a> {
|
|||
.repair_style_and_bubble_inline_sizes(&style);
|
||||
}
|
||||
_ => {
|
||||
if node.is_replaced_content() {
|
||||
properties::modify_style_for_replaced_content(&mut style);
|
||||
}
|
||||
fragment.repair_style(&style);
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,6 +208,19 @@ impl SpecificFragmentInfo {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for SpecificFragmentInfo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
SpecificFragmentInfo::ScannedText(ref info) => {
|
||||
write!(f, " \"{}\"", info.run.text.slice_chars(info.range.begin().get() as usize,
|
||||
info.range.end().get() as usize));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Clamp a value obtained from style_length, based on min / max lengths.
|
||||
fn clamp_size(size: Au,
|
||||
min_size: LengthOrPercentage,
|
||||
|
@ -2120,10 +2133,11 @@ impl Fragment {
|
|||
impl fmt::Debug for Fragment {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
try!(write!(f, "({} {} ", self.debug_id(), self.specific.get_type()));
|
||||
try!(write!(f, "bb {:?} bp {:?} m {:?}",
|
||||
try!(write!(f, "bb {:?} bp {:?} m {:?}{:?}",
|
||||
self.border_box,
|
||||
self.border_padding,
|
||||
self.margin));
|
||||
self.margin,
|
||||
self.specific));
|
||||
write!(f, ")")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -689,7 +689,10 @@ pub struct InlineFragments {
|
|||
|
||||
impl fmt::Debug for InlineFragments {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self.fragments)
|
||||
for fragment in self.fragments.iter() {
|
||||
try!(write!(f, "\n * {:?}", fragment))
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue