mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +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> {
|
impl ToAzureRect for Rect<Au> {
|
||||||
fn to_nearest_azure_rect(&self) -> Rect<AzFloat> {
|
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> {
|
fn to_azure_rect(&self) -> Rect<AzFloat> {
|
||||||
Rect::new(self.origin.to_azure_point(), Size2D::new(self.size.width.to_f32_px(),
|
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 mut layout_data_ref = node.mutate_layout_data();
|
||||||
let layout_data = layout_data_ref.as_mut().expect("no 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;
|
let damage = layout_data.data.restyle_damage;
|
||||||
match node.construction_result_mut(layout_data) {
|
match node.construction_result_mut(layout_data) {
|
||||||
&mut ConstructionResult::None => true,
|
&mut ConstructionResult::None => true,
|
||||||
|
@ -1297,8 +1297,10 @@ impl<'a> FlowConstructor<'a> {
|
||||||
.repair_style_and_bubble_inline_sizes(&style);
|
.repair_style_and_bubble_inline_sizes(&style);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
if node.is_replaced_content() {
|
||||||
|
properties::modify_style_for_replaced_content(&mut style);
|
||||||
|
}
|
||||||
fragment.repair_style(&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.
|
/// Clamp a value obtained from style_length, based on min / max lengths.
|
||||||
fn clamp_size(size: Au,
|
fn clamp_size(size: Au,
|
||||||
min_size: LengthOrPercentage,
|
min_size: LengthOrPercentage,
|
||||||
|
@ -2120,10 +2133,11 @@ impl Fragment {
|
||||||
impl fmt::Debug for Fragment {
|
impl fmt::Debug for Fragment {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
try!(write!(f, "({} {} ", self.debug_id(), self.specific.get_type()));
|
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_box,
|
||||||
self.border_padding,
|
self.border_padding,
|
||||||
self.margin));
|
self.margin,
|
||||||
|
self.specific));
|
||||||
write!(f, ")")
|
write!(f, ")")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -689,7 +689,10 @@ pub struct InlineFragments {
|
||||||
|
|
||||||
impl fmt::Debug for InlineFragments {
|
impl fmt::Debug for InlineFragments {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,7 @@ experimental == iframe/size_attributes_vertical_writing_mode.html iframe/size_at
|
||||||
== inset.html inset_ref.html
|
== inset.html inset_ref.html
|
||||||
!= inset_blackborder.html blackborder_ref.html
|
!= inset_blackborder.html blackborder_ref.html
|
||||||
== issue-1324.html issue-1324-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_child_pseudo_a.html last_child_pseudo_b.html
|
||||||
== last_of_type_pseudo_a.html last_of_type_pseudo_b.html
|
== last_of_type_pseudo_a.html last_of_type_pseudo_b.html
|
||||||
== legacy_cellspacing_attribute_a.html border_spacing_ref.html
|
== legacy_cellspacing_attribute_a.html border_spacing_ref.html
|
||||||
|
|
19
tests/ref/jumpiness_a.html
Normal file
19
tests/ref/jumpiness_a.html
Normal 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>
|
||||||
|
|
15
tests/ref/jumpiness_ref.html
Normal file
15
tests/ref/jumpiness_ref.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
a
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
[block-in-inline-001.htm]
|
[block-in-inline-001.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
|
disabled: seems to assume ascent and block size above baseline are equal
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
[block-in-inline-002.htm]
|
[block-in-inline-002.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
|
disabled: seems to assume ascent and block size above baseline are equal
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-block-in-inlines-beginning-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-block-in-inlines-end-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-block-in-inlines-middle-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-inline-in-blocks-beginning-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-inline-in-blocks-end-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[delete-inline-in-blocks-middle-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-block-in-inlines-beginning-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-block-in-inlines-end-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-block-in-inlines-middle-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-beginning-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-end-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-begin-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-begin-002.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-begin-003.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-end-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-end-002.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-end-003.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-middle-001.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-middle-002.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[insert-inline-in-blocks-n-inlines-middle-003.htm]
|
|
||||||
type: reftest
|
|
||||||
expected: FAIL
|
|
|
@ -1,5 +1,3 @@
|
||||||
[position-relative-035.htm]
|
[position-relative-035.htm]
|
||||||
type: reftest
|
type: reftest
|
||||||
expected:
|
expected: FAIL
|
||||||
if (os == "mac") and (version == "OS X 10.8.5"): FAIL
|
|
||||||
if (os == "mac") and (version == "OS X 10.10.3"): FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue