mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Support text-align: start
and end
This commit is contained in:
parent
5b0c6c9d31
commit
81e8f18662
5 changed files with 59 additions and 4 deletions
|
@ -908,12 +908,12 @@ impl InlineFlow {
|
|||
text_align::T::justify if !is_last_line && text_justify != text_justify::T::none => {
|
||||
InlineFlow::justify_inline_fragments(fragments, line, slack_inline_size)
|
||||
}
|
||||
text_align::T::left | text_align::T::justify => {}
|
||||
text_align::T::left | text_align::T::justify | text_align::T::start => {}
|
||||
text_align::T::center => {
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
slack_inline_size.scale_by(0.5)
|
||||
}
|
||||
text_align::T::right => {
|
||||
text_align::T::right | text_align::T::end => {
|
||||
inline_start_position_for_fragment = inline_start_position_for_fragment +
|
||||
slack_inline_size
|
||||
}
|
||||
|
|
|
@ -1730,8 +1730,7 @@ pub mod longhands {
|
|||
|
||||
${new_style_struct("InheritedText", is_inherited=True)}
|
||||
|
||||
// TODO: initial value should be 'start' (CSS Text Level 3, direction-dependent.)
|
||||
${single_keyword("text-align", "left right center justify")}
|
||||
${single_keyword("text-align", "start end left right center justify")}
|
||||
|
||||
<%self:longhand name="letter-spacing">
|
||||
use values::computed::{ToComputedValue, Context};
|
||||
|
|
|
@ -304,6 +304,7 @@ experimental == rtl_simple.html rtl_simple_ref.html
|
|||
== table_percentage_width_a.html table_percentage_width_ref.html
|
||||
== text_align_complex_a.html text_align_complex_ref.html
|
||||
== text_align_justify_a.html text_align_justify_ref.html
|
||||
experimental == text_align_start_end.html text_align_start_end_ref.html
|
||||
== text_decoration_cached.html text_decoration_cached_ref.html
|
||||
# text_decoration_propagation_a.html text_decoration_propagation_b.html
|
||||
!= text_decoration_smoke_a.html text_decoration_smoke_ref.html
|
||||
|
|
29
tests/ref/text_align_start_end.html
Normal file
29
tests/ref/text_align_start_end.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/ahem.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-size: 25px;
|
||||
}
|
||||
#a, #b {
|
||||
text-align: start;
|
||||
}
|
||||
#c, #d {
|
||||
text-align: end;
|
||||
}
|
||||
#b, #d {
|
||||
direction: rtl;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="a">X</div>
|
||||
<div id="b">X</div>
|
||||
<div id="c">X</div>
|
||||
<div id="d">X</div>
|
||||
</body>
|
||||
</html>
|
||||
|
26
tests/ref/text_align_start_end_ref.html
Normal file
26
tests/ref/text_align_start_end_ref.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="css/ahem.css">
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
font-size: 25px;
|
||||
}
|
||||
#a, #d {
|
||||
text-align: left;
|
||||
}
|
||||
#b, #c {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="a">X</div>
|
||||
<div id="b">X</div>
|
||||
<div id="c">X</div>
|
||||
<div id="d">X</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue