diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-05-08 03:09:26 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-05-10 16:56:01 +0200 |
commit | 70ec61cf01907c064c53563b46ea361b6a0348fe (patch) | |
tree | 0b36cbf101952b9b9f6b349f5d82c4aca01450b7 /components/script/layout_wrapper.rs | |
parent | 0040160b38bfef8f4a8c99bf3a0ad85f0b415d4d (diff) | |
download | servo-70ec61cf01907c064c53563b46ea361b6a0348fe.tar.gz servo-70ec61cf01907c064c53563b46ea361b6a0348fe.zip |
Refactor Position
A specified position is now a struct made of two values of different types,
the first one being PositionComponent<X>, and the second one PositionComponent<Y>.
A position component is represented by the new enum PositionComponent<Side>,
with the three values Center, Length(LengthOrPercentage), and
Side(Side, Option<LengthOrPercentage>).
Side keywords are represented by the X and Y enums, which don't include a value
for the center keyword anymore. They are accompanied by the Side trait, which
allows us to determine whether a side keyword is "left" or "top".
This refactor simplified the parsing and serialisation code and exposed bugs in it,
where it would reject valid <position> values followed by arbitrary tokens,
and where it would fail to prefer "left" to "right" when serialising positions
in basic shapes.
Diffstat (limited to 'components/script/layout_wrapper.rs')
0 files changed, 0 insertions, 0 deletions