mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +01:00
layout: Implement overflow-wrap
/word-wrap
per CSS-TEXT § 6.2.
This property is used by approximately 55% of page loads. To implement the line breaking behavior, the "breaking strategy" has been cleaned up and abstracted. This should allow us to easily support other similar properties in the future, such as `text-overflow` and `word-break`.
This commit is contained in:
parent
1be7d7cced
commit
6943ddb93e
8 changed files with 356 additions and 139 deletions
|
@ -199,3 +199,4 @@ fragment=top != ../html/acid2.html acid2_ref.html
|
|||
!= border_black_ridge.html border_black_groove.html
|
||||
== text_indent_a.html text_indent_ref.html
|
||||
== word_spacing_a.html word_spacing_ref.html
|
||||
== overflow_wrap_a.html overflow_wrap_ref.html
|
||||
|
|
22
tests/ref/overflow_wrap_a.html
Normal file
22
tests/ref/overflow_wrap_a.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Tests that `overflow-wrap: break-word` breaks words if it needs to, but only when
|
||||
necessary. -->
|
||||
<link rel="stylesheet" type="text/css" href="css/ahem.css">
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
}
|
||||
section {
|
||||
word-wrap: break-word;
|
||||
width: 300px;
|
||||
color: purple;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<section>X XXXXXX</section>
|
||||
</body>
|
||||
</html>
|
||||
|
28
tests/ref/overflow_wrap_ref.html
Normal file
28
tests/ref/overflow_wrap_ref.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- Tests that `overflow-wrap: break-word` breaks words if it needs to, but only when
|
||||
necessary. -->
|
||||
<style>
|
||||
section, nav {
|
||||
background: purple;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
}
|
||||
section {
|
||||
width: 100px;
|
||||
top: 0;
|
||||
height: 100px;
|
||||
}
|
||||
nav {
|
||||
top: 100px;
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<section></section><nav></nav>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue