From ba0a6708767300e9fceaa7751d036340d5af13a5 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Sun, 7 Aug 2016 23:46:47 +0300 Subject: [PATCH 1/4] reduce max_inline_size inside breaking strategy by border_padding --- components/layout/fragment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 0ddb083c1c0..254ed8d4177 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -1644,7 +1644,7 @@ impl Fragment { _ => return None, }; - let mut remaining_inline_size = max_inline_size; + let mut remaining_inline_size = max_inline_size - self.border_padding.inline_start_end(); let mut inline_start_range = Range::new(text_fragment_info.range.begin(), ByteIndex(0)); let mut inline_end_range = None; let mut overflowing = false; From 0b68fb3cb537c0eb3e25bee395ff1e40d4e60258 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Sun, 7 Aug 2016 23:47:50 +0300 Subject: [PATCH 2/4] reset border_padding between, account for border_padding in border_box and reset *_FRAGMENT_OF_ELEMENT flag for splitted fragments --- components/layout/inline.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/components/layout/inline.rs b/components/layout/inline.rs index f734e66eb6a..0bc24d76276 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -636,7 +636,23 @@ impl LineBreaker { // Push the first fragment onto the line we're working on and start off the next line with // the second fragment. If there's no second fragment, the next line will start off empty. match (inline_start_fragment, inline_end_fragment) { - (Some(inline_start_fragment), Some(inline_end_fragment)) => { + (Some(mut inline_start_fragment), Some(mut inline_end_fragment)) => { + inline_start_fragment.border_padding.inline_end = Au(0); + if let Some(ref mut inline_context) = inline_start_fragment.inline_context { + for node in &mut inline_context.nodes { + node.flags.remove(LAST_FRAGMENT_OF_ELEMENT); + } + } + inline_start_fragment.border_box.size.inline += inline_start_fragment.border_padding.inline_start; + + inline_end_fragment.border_padding.inline_start = Au(0); + if let Some(ref mut inline_context) = inline_end_fragment.inline_context { + for node in &mut inline_context.nodes { + node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT); + } + } + inline_end_fragment.border_box.size.inline += inline_end_fragment.border_padding.inline_end; + self.push_fragment_to_line(layout_context, inline_start_fragment, LineFlushMode::Flush); From 721b59a1137adeca8a2f7bd7d06462f61df6974f Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Mon, 8 Aug 2016 00:13:59 +0300 Subject: [PATCH 3/4] add test for splitted span with borders --- tests/wpt/mozilla/meta/MANIFEST.json | 24 +++++++++++++++++++ .../tests/css/border_inline_split.html | 20 ++++++++++++++++ .../tests/css/border_inline_split_ref.html | 14 +++++++++++ 3 files changed, 58 insertions(+) create mode 100644 tests/wpt/mozilla/tests/css/border_inline_split.html create mode 100644 tests/wpt/mozilla/tests/css/border_inline_split_ref.html diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 4d0e9b89ac2..2188a9ca79a 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -816,6 +816,18 @@ "url": "/_mozilla/css/border_collapse_simple_a.html" } ], + "css/border_inline_split.html": [ + { + "path": "css/border_inline_split.html", + "references": [ + [ + "/_mozilla/css/border_inline_split_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/border_inline_split.html" + } + ], "css/border_radius_asymmetric_sizes_a.html": [ { "path": "css/border_radius_asymmetric_sizes_a.html", @@ -9958,6 +9970,18 @@ "url": "/_mozilla/css/border_collapse_simple_a.html" } ], + "css/border_inline_split.html": [ + { + "path": "css/border_inline_split.html", + "references": [ + [ + "/_mozilla/css/border_inline_split_ref.html", + "==" + ] + ], + "url": "/_mozilla/css/border_inline_split.html" + } + ], "css/border_radius_asymmetric_sizes_a.html": [ { "path": "css/border_radius_asymmetric_sizes_a.html", diff --git a/tests/wpt/mozilla/tests/css/border_inline_split.html b/tests/wpt/mozilla/tests/css/border_inline_split.html new file mode 100644 index 00000000000..4cf2aaacc11 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/border_inline_split.html @@ -0,0 +1,20 @@ + + + + + + + +
+ Very long | +
+ diff --git a/tests/wpt/mozilla/tests/css/border_inline_split_ref.html b/tests/wpt/mozilla/tests/css/border_inline_split_ref.html new file mode 100644 index 00000000000..658b7f533b6 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/border_inline_split_ref.html @@ -0,0 +1,14 @@ + + + + + + + Very
long |
+ From 9c8b3a6733e8e9e7db44ca6b4dd9e10334c989d3 Mon Sep 17 00:00:00 2001 From: Alexandrov Sergey Date: Mon, 8 Aug 2016 20:00:52 +0300 Subject: [PATCH 4/4] update tests expectations --- .../wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-001.htm.ini | 3 --- .../wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-003.htm.ini | 3 ++- tests/wpt/metadata-css/css21_dev/html4/inlines-017.htm.ini | 3 --- 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-001.htm.ini delete mode 100644 tests/wpt/metadata-css/css21_dev/html4/inlines-017.htm.ini diff --git a/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-001.htm.ini deleted file mode 100644 index a804c570c98..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[c5509-ipadn-l-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-003.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-003.htm.ini index 6d242c822ca..11101467644 100644 --- a/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-003.htm.ini +++ b/tests/wpt/metadata-css/css21_dev/html4/c5509-ipadn-l-003.htm.ini @@ -1,3 +1,4 @@ [c5509-ipadn-l-003.htm] type: reftest - expected: FAIL + expected: + if os == "mac": FAIL diff --git a/tests/wpt/metadata-css/css21_dev/html4/inlines-017.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/inlines-017.htm.ini deleted file mode 100644 index 9f87e4c3ae1..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/inlines-017.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[inlines-017.htm] - type: reftest - expected: FAIL