-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Implement
text-align: match-parent
At computed-value time, this is converted to whatever the parent's computed value is. So it behaves a little like `inherit`, except that an inherited start/end value uses the parent's start/end, which might be different from the child's.
- Loading branch information
Showing
8 changed files
with
154 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -523,6 +523,7 @@ | |
"end", | ||
"left", | ||
"right", | ||
"match-parent", | ||
"-libweb-center", | ||
"-libweb-left", | ||
"-libweb-right" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Tests/LibWeb/Ref/expected/css/css-text/text-align-match-parent-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<style> | ||
.left { text-align: left; } | ||
.center { text-align: center; } | ||
.right { text-align: right; } | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<div class="left">Left</div> | ||
<div class="left">Left</div> | ||
</div> | ||
<div> | ||
<div class="center">Center</div> | ||
<div class="center">Center</div> | ||
</div> | ||
<div> | ||
<div class="right">Right</div> | ||
<div class="right">Right</div> | ||
</div> | ||
<div> | ||
<div class="right">Right</div> | ||
<div class="right">Right</div> | ||
</div> | ||
<div> | ||
<div class="center">Center</div> | ||
<div class="center">Center</div> | ||
</div> | ||
<div> | ||
<div class="left">Left</div> | ||
<div class="left">Left</div> | ||
</div> | ||
</body> |
38 changes: 38 additions & 0 deletions
38
Tests/LibWeb/Ref/input/css/css-text/text-align-match-parent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<link rel="match" href="../../../expected/css/css-text/text-align-match-parent-ref.html" /> | ||
<style> | ||
.outer-start { text-align: start; } | ||
.outer-end { text-align: end; } | ||
.outer-center { text-align: center; } | ||
.ltr { direction: ltr; } | ||
.rtl { direction: rtl; } | ||
.inner { text-align: match-parent; } | ||
</style> | ||
</head> | ||
<body> | ||
<div class="outer-start ltr"> | ||
<div class="inner ltr">Left</div> | ||
<div class="inner rtl">Left</div> | ||
</div> | ||
<div class="outer-center ltr"> | ||
<div class="inner ltr">Center</div> | ||
<div class="inner rtl">Center</div> | ||
</div> | ||
<div class="outer-end ltr"> | ||
<div class="inner ltr">Right</div> | ||
<div class="inner rtl">Right</div> | ||
</div> | ||
<div class="outer-start rtl"> | ||
<div class="inner ltr">Right</div> | ||
<div class="inner rtl">Right</div> | ||
</div> | ||
<div class="outer-center rtl"> | ||
<div class="inner ltr">Center</div> | ||
<div class="inner rtl">Center</div> | ||
</div> | ||
<div class="outer-end rtl"> | ||
<div class="inner ltr">Left</div> | ||
<div class="inner rtl">Left</div> | ||
</div> | ||
</body> |
6 changes: 6 additions & 0 deletions
6
...s/LibWeb/Text/expected/wpt-import/css/css-text/text-align/text-align-match-parent-002.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Harness status: OK | ||
|
||
Found 1 tests | ||
|
||
1 Pass | ||
Pass CSS Text Test: text-align - computed value for match-parent on the root element |
23 changes: 23 additions & 0 deletions
23
Tests/LibWeb/Text/input/wpt-import/css/css-text/text-align/text-align-match-parent-002.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>CSS Text Test: text-align - computed value for match-parent on the root element</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-text/#valdef-text-align-match-parent"> | ||
<meta name="assert" content="'text-align: match-parent' on the root element with 'direction: rtl' should compute to 'start'."> | ||
<script src="../../../resources/testharness.js"></script> | ||
<script src="../../../resources/testharnessreport.js"></script> | ||
<style> | ||
html { | ||
text-align: match-parent; | ||
direction: rtl; | ||
} | ||
#log { | ||
direction: ltr; | ||
text-align: start; | ||
} | ||
</style> | ||
<div id="log"></div> | ||
<script> | ||
test(() => { | ||
assert_equals(getComputedStyle(document.documentElement).textAlign, 'start'); | ||
}); | ||
</script> |