Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,21 @@ public void DisplayNone_GeneratesNoBoxAndTakesNoSpace()
Assert.AreEqual(LayoutHarness.FindById(root, "a")!.ActualBottom, LayoutHarness.FindById(root, "b")!.Location.Y, Delta);
}

[Ignore("Gap, see Spec/css21.yml")]
[TestMethod]
[Spec("css21", "visuren.html#display-prop")]
[Spec("css-display-3", "#box-generation")]
[Spec("css-display-4", "#box-generation")]
[DataRow("<tr style='display:none'><td>b</td></tr>")]
[DataRow("<tbody style='display:none'><tr><td>b</td></tr></tbody>")]
public void DisplayNone_HidesATableRow(string hidden)
{
var (root, _) = LayoutHarness.Layout(LayoutHarness.Wrap(
$"<table style='border-spacing:0'><tr><td id='a'>a</td></tr>{hidden}<tr><td id='c'>c</td></tr></table>"));

Assert.AreEqual(LayoutHarness.FindById(root, "a")!.ActualBottom, LayoutHarness.FindById(root, "c")!.Location.Y, Delta);
}

[TestMethod]
[Spec("css21", "visuren.html#display-prop")]
public void UnknownElement_IsInlineByDefault()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ public void Normal_BreaksBetweenCjkCharacters()
Assert.IsGreaterThan(1, LinesWithText(p));
}

[Ignore("Gap, see Spec/css-text-3.yml")]
[TestMethod]
[Spec("css-text-3", "#line-breaking")]
[Spec("css-text-4", "#line-breaking")]
public void Normal_BreaksBetweenKana()
{
var p = Paragraph("<p id='p' style='width:50px'>あいうえおかきくけこさしすせそ</p>");

Assert.IsGreaterThan(1, LinesWithText(p));
}

[Ignore("Gap, see Spec/css-text-3.yml")]
[TestMethod]
[Spec("css-text-3", "#line-breaking")]
[Spec("css-text-4", "#line-breaking")]
public void CjkComma_DoesntStartALine()
{
var p = Paragraph("<p id='p' style='width:110px'>中文中文中文中,中文中文</p>");

Assert.IsGreaterThan(1, LinesWithText(p));
Assert.IsFalse(p.LineBoxes.Any(lb => lb.Words.FirstOrDefault(w => !w.IsSpaces)?.Text.StartsWith(',') == true));
}

[Ignore("Gap, see Spec/css-text-3.yml")]
[TestMethod]
[Spec("css-text-3", "#word-break-property")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ public void Justify_DoesntAlterPreservedWhiteSpace()
Assert.AreEqual(a.Right, space.Left, Delta);
}

[Ignore("Gap, see Spec/css21.yml")]
[TestMethod]
[Spec("css21", "text.html#alignment-prop")]
[Spec("css-text-3", "#expanding-text")]
[Spec("css-text-4", "#expanding-text")]
[DataRow("The HTML<b>rend</b>erer", "HTML", "rend")]
[DataRow("The HTML<b>rend</b>erer", "rend", "erer")]
[DataRow("The non-public", "non-", "public")]
public void Justify_DoesntStretchWithinAWord(string start, string first, string second)
{
var words = Words($"<p id='p' style='margin:0;text-align:justify;width:250px'>{start} ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor</p>");
var a = words.First(w => w.Text.Trim() == first);
var b = words.First(w => w.Text.Trim() == second);

Assert.AreEqual(a.Top, b.Top, Delta);
Assert.AreEqual(a.Right, b.Left, Delta);
}

private static List<CssRect> Words(string bodyHtml)
{
var (root, _) = LayoutHarness.Layout(LayoutHarness.Wrap(bodyHtml));
Expand Down
11 changes: 11 additions & 0 deletions Source/Test/HtmlRenderer.Test/Html/TablesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ public void Tfoot_IsPlacedAfterAllBodies()
Assert.IsLessThan(b[0].Location.Y, b[2].Location.Y);
}

[TestMethod]
[Ignore("Gap, see Spec/html.yml")]
[Spec("html", "tables.html#forming-a-table")]
public void Cell_SkipsTheSlotsOfRowspansFromDifferentRows()
{
var b = Table("<tr><td rowspan=2>a</td><td rowspan=4>b</td><td id=x>c</td></tr><tr><td>d</td></tr>"
+ "<tr><td rowspan=2>e</td><td>f</td></tr><tr><td id=y>g</td></tr>", "x", "y");

Assert.AreEqual(b[0].Location.X, b[1].Location.X, 0.01);
}

[TestMethod]
[Spec("html", "tables.html#attributes-common-to-td-and-th-elements")]
[Spec("html", "tables.html#forming-a-table")]
Expand Down
1 change: 1 addition & 0 deletions Spec/css-display-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ sections:
status: partial
gaps:
- "'contents' is ignored, the element keeps its own box"
- "'none' on a table row or row group is ignored, see CSS 2.1 9.2.4"
'#legacy-display':
title: 2.6 Precomposed Inline-level Display Values
status: partial
Expand Down
1 change: 1 addition & 0 deletions Spec/css-display-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sections:
status: partial
gaps:
- "'contents' is ignored, the element keeps its own box"
- "'none' on a table row or row group is ignored, see CSS 2.1 9.2.4"
'#legacy-display':
title: 2.6 Precomposed Inline-level Display Values
status: partial
Expand Down
4 changes: 4 additions & 0 deletions Spec/css-text-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ sections:
'#line-breaking':
title: 5 Line Breaking and Word Boundaries
status: partial
gaps:
- Only CJK ideographs from U+4E00 to U+FA2D are break opportunities, a run of kana doesn't break and overflows the line
- CJK punctuation like the fullwidth comma sticks to the next character instead of the previous one, so a line can start with it
'#word-break-property':
title: '5.1 Breaking Rules for Letters: the word-break property'
status: partial
Expand Down Expand Up @@ -113,6 +116,7 @@ sections:
status: partial
gaps:
- Preserved spaces in pre and pre-wrap text are stretched too, see CSS 2.1 16.2
- Justification also stretches within a word that is split by an inline element or after a hyphen, see CSS 2.1 16.2
'#justify-symbols':
title: 6.4.2 Handling Symbols and Punctuation
status: n/a
Expand Down
4 changes: 4 additions & 0 deletions Spec/css-text-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ sections:
'#line-breaking':
title: 6 Line Breaking and Word Boundaries
status: partial
gaps:
- Only CJK ideographs from U+4E00 to U+FA2D are break opportunities, a run of kana doesn't break and overflows the line
- CJK punctuation like the fullwidth comma sticks to the next character instead of the previous one, so a line can start with it
'#word-break-property':
title: '6.1 Breaking Rules for Letters: the word-break property'
status: partial
Expand Down Expand Up @@ -186,6 +189,7 @@ sections:
status: partial
gaps:
- Preserved spaces in pre and pre-wrap text are stretched too, see CSS 2.1 16.2
- Justification also stretches within a word that is split by an inline element or after a hyphen, see CSS 2.1 16.2
'#justify-symbols':
title: 7.5.2 Handling Symbols and Punctuation
status: n/a
Expand Down
5 changes: 4 additions & 1 deletion Spec/css21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ sections:
status: n/a
visuren.html#display-prop:
title: 9.2.4 The 'display' property
status: supported
status: partial
gaps:
- "'display: none' on a table row or row group is ignored, the row is still laid out and painted"
visuren.html#positioning-scheme:
title: 9.3 Positioning schemes
status: partial
Expand Down Expand Up @@ -857,6 +859,7 @@ sections:
- "The initial value acts as 'left' also when 'direction' is 'rtl'"
- "'justify' stretches preserved white space in 'pre' and 'pre-wrap' text"
- "'right' and 'center' leave out the end padding and border of an inline box at the end of the line, so they stick out past the content edge"
- "'justify' also stretches within a word that is split by an inline element or after a hyphen, e.g. HTML<b>rend</b>erer and non-public"
text.html#decoration:
title: 16.3 Decoration
status: partial
Expand Down
1 change: 1 addition & 0 deletions Spec/html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ sections:
- span, colspan and rowspan with trailing characters, e.g. 2px, count as 1 instead of using the leading digits
- A span with a fraction is rounded instead of cut off, e.g. 1.5 counts as 2
- A rowspan reaching past its row group continues into the next one
- A cell after slots covered by rowspans that start in different rows is placed in one of those slots instead of after them
tables.html#header-and-data-cell-semantics:
title: 4.9.12.2 Forming relationships between data cells and header cells
status: n/a
Expand Down
Loading