-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement legacy text alignment (#698)
* Add TextAlign style * Add legacy text-align support to the test generator * Implement legacy text alignment * Fix docs
- Loading branch information
Showing
14 changed files
with
836 additions
and
9 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
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
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,26 @@ | ||
//! Style types for Block layout | ||
use crate::{CoreStyle, Style}; | ||
|
||
/// The set of styles required for a CSS Grid item (child of a CSS Grid container) | ||
pub trait BlockContainerStyle: CoreStyle { | ||
/// Defines which row in the grid the item should start and end at | ||
#[inline(always)] | ||
fn text_align(&self) -> TextAlign { | ||
Style::DEFAULT.text_align | ||
} | ||
} | ||
|
||
/// Used by block layout to implement the legacy behaviour of `<center>` and `<div align="left | right | center">` | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub enum TextAlign { | ||
/// No special legacy text align behaviour. | ||
#[default] | ||
Auto, | ||
/// Corresponds to `-webkit-left` or `-moz-left` in browsers | ||
LegacyLeft, | ||
/// Corresponds to `-webkit-right` or `-moz-right` in browsers | ||
LegacyRight, | ||
/// Corresponds to `-webkit-center` or `-moz-center` in browsers | ||
LegacyCenter, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script src="../../scripts/gentest/test_helper.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css"> | ||
<title> | ||
Test description | ||
</title> | ||
</head> | ||
<body> | ||
|
||
<div id="test-root" style="display: block; width: 200px; height: 200px; text-align: -webkit-center;"> | ||
<div style="max-width: 100px; height: 50px;"></div> | ||
<div style="max-width: 300px; height: 50px;"></div> | ||
</div> | ||
|
||
</body> | ||
</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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script src="../../scripts/gentest/test_helper.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css"> | ||
<title> | ||
Test description | ||
</title> | ||
</head> | ||
<body> | ||
|
||
<div id="test-root" style="display: block; width: 200px; height: 200px; text-align: -webkit-left;"> | ||
<div style="max-width: 100px; height: 50px;"></div> | ||
<div style="max-width: 300px; height: 50px;"></div> | ||
</div> | ||
|
||
</body> | ||
</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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<script src="../../scripts/gentest/test_helper.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css"> | ||
<title> | ||
Test description | ||
</title> | ||
</head> | ||
<body> | ||
|
||
<div id="test-root" style="display: block; width: 200px; height: 200px; text-align: -webkit-right;"> | ||
<div style="max-width: 100px; height: 50px;"></div> | ||
<div style="max-width: 300px; height: 50px;"></div> | ||
</div> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.