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:
bors-servo 2015-07-07 10:28:04 -06:00
commit bbcd427733
30 changed files with 68 additions and 69 deletions

View file

@ -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(),

View file

@ -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
}
}
}

View file

@ -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, ")")
}
}

View file

@ -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(())
}
}

View file

@ -169,6 +169,7 @@ experimental == iframe/size_attributes_vertical_writing_mode.html iframe/size_at
== inset.html inset_ref.html
!= inset_blackborder.html blackborder_ref.html
== issue-1324.html issue-1324-ref.html
== jumpiness_a.html jumpiness_ref.html
== last_child_pseudo_a.html last_child_pseudo_b.html
== last_of_type_pseudo_a.html last_of_type_pseudo_b.html
== legacy_cellspacing_attribute_a.html border_spacing_ref.html

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<style>
body.hello {
text-decoration: underline;
}
</style>
</head>
<body>
a
<script>
setTimeout(function() {
document.body.classList.add('hello');
}, 0);
</script>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<style>
body {
text-decoration: underline;
}
</style>
</head>
<body>
a
</body>
</html>

View file

@ -1,3 +1,4 @@
[block-in-inline-001.htm]
type: reftest
disabled: seems to assume ascent and block size above baseline are equal
expected: FAIL

View file

@ -1,3 +1,4 @@
[block-in-inline-002.htm]
type: reftest
disabled: seems to assume ascent and block size above baseline are equal
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-block-in-inlines-beginning-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-block-in-inlines-end-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-block-in-inlines-middle-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-inline-in-blocks-beginning-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-inline-in-blocks-end-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[delete-inline-in-blocks-middle-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-block-in-inlines-beginning-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-block-in-inlines-end-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-block-in-inlines-middle-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-beginning-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-end-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-begin-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-begin-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-begin-003.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-end-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-end-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-end-003.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-middle-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-middle-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[insert-inline-in-blocks-n-inlines-middle-003.htm]
type: reftest
expected: FAIL

View file

@ -1,5 +1,3 @@
[position-relative-035.htm]
type: reftest
expected:
if (os == "mac") and (version == "OS X 10.8.5"): FAIL
if (os == "mac") and (version == "OS X 10.10.3"): FAIL
expected: FAIL