Commit graph

66 commits

Author SHA1 Message Date
Patrick Walton
5b36d211b4 Add an implementation of the core float and clear placement logic in layout
2020, not yet wired to the rest of layout.

This commit implements an object that handles the 10 rules in CSS 2.1:

https://www.w3.org/TR/CSS2/visuren.html#float-position

The implementation strategy is that of a persistent balanced binary search tree
of float bands. Binary search trees are commonly used for implementing float
positioning; e.g. by WebKit.  Persistence enables each object that interacts
with floats to efficiently contain a snapshot of the float list at the time
that object was laid out. That way, incremental layout can invalidate and start
reflow at any point in a containing block.

This commit features extensive use of
[QuickCheck](https://github.com/BurntSushi/quickcheck) to ensure that the rules
of the CSS specification are followed.

Because this is not yet connected to layout, floats will not actually be laid
out in Web pages yet.

Note that unit tests as set up in Servo currently require types that they
access to be public. Therefore, some internal layout 2020 types that were
previously private have been made public. This is somewhat unfortunate.

Part of #25167.
2020-07-20 12:42:34 -07:00
Emilio Cobos Álvarez
58d51b1e8c
style: Remove unit tests that test non-compliant stuff.
<position> no longer parses three values.
2019-07-23 22:54:11 +02:00
Emilio Cobos Álvarez
ac01c76e5e style: Remove useless unit tests, and fix not-so-useless ones. 2019-05-29 16:14:34 +02:00
Jan Andre Ikenmeyer
f1f409ffb6
Update MPL license to https (part 5) 2018-11-27 19:09:17 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Emilio Cobos Álvarez
46b360cb75
style: Fix unit tests build. 2018-09-03 14:08:14 +02:00
Emilio Cobos Álvarez
fc4998367b
style: Fix / remove unit tests.
Unit tests removed have WPT equivalents.
2018-06-23 20:34:10 +02:00
Emilio Cobos Álvarez
48de556f8c
style: Fixups for css-fonts-4 font-weight. 2018-04-28 10:26:03 +02:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
Gecko Backout
11c64178d8 Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Emilio Cobos Álvarez
3215e36b5b
style: Cleanup the animated value setup.
We have three different enums to represent slightly different things. Reuse them
properly, and kill some code in the animated_properties module while at it.

MozReview-Commit-ID: 5ZAly8f4lWy
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-29 13:20:50 +02:00
Josh Matthews
1297c0ff51 Devirtualize CSS error reporting. 2017-08-24 10:41:06 -07:00
Manish Goregaokar
2ebce54d75 Remove testing feature from style crate 2017-08-07 14:30:31 -07:00
Cameron McCormack
c81d62d36f style: Record on a computed::Context whether we are computing a SMIL animated value. 2017-07-24 20:47:33 +08:00
Alan Jeffrey
caa3585219 Fixed scaling artefacts in paint worklets caused by zoom and hidpi. 2017-07-20 17:25:50 -05:00
Emilio Cobos Álvarez
e374a54050
style: Cleanup the cascade a good bit. 2017-07-20 11:20:37 +02:00
Emilio Cobos Álvarez
fe8638a618
style: More ComputedValuesInner cleanup.
MozReview-Commit-ID: 8rkAP3pMEpD
2017-07-18 17:35:59 +02:00
Manish Goregaokar
8eafe6a3b7 Fix tidy 2017-07-17 19:43:57 -07:00
Simon Sapin
b83afdedc8 Upgrade cssparser to 0.15 2017-06-16 15:05:46 +02:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Hiroyuki Ikezoe
8bfed4cb3c Move ParsingMode into style_traits. 2017-06-14 09:51:36 +09:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Ravi Shankar
10badb3efd Add a truckload of tests for <track-size> and <track-list> 2017-05-18 21:59:25 +05:30
Hiroyuki Ikezoe
b6b3187efa Make ParsingMode bitflags.
assert_parsing_mode_match() is mostly the same as
assert_restyle_hints_match().
2017-05-14 07:15:19 +09:00
Hiroyuki Ikezoe
fcc50ea421 Rename LengthParsingMode to ParsingMode and LengthParsingMode::SVG to PasingMode::AllowUnitlessLength.
We need another flag that represents allow-negative-number for SMIL, so
this enum will also comprise the another parsing mode that allows negative number.
2017-05-14 07:15:19 +09:00
Simon Whitehead
2e3f45b66b Add test cases for transition-duration. 2017-05-13 11:17:53 +09:00
Anthony Ramine
70ec61cf01 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.
2017-05-10 16:56:01 +02:00
Anthony Ramine
f68e2fded9 Propagate quirks mode all the way to ParserContext
The quirks mode is still not properly propagated in geckolib.
2017-04-27 10:41:55 +02:00
Boris Chiou
3a1421491b Bug 1353628 - Part 2: Add unit tests of parsing transition properties.
MozReview-Commit-ID: K5thA20ORPk
2017-04-19 17:42:42 +08:00
J. Ryan Stinnett
6069e44f02 SVG length parsing mode
SVG allows non-zero lengths to be accepted and assumes they are in px.  This
adds this length parsing mode to Servo.

MozReview-Commit-ID: Kxd3x64r9Ye
2017-04-14 17:22:16 +08:00
J. Ryan Stinnett
0936dd24d0 Centralize ParserContext for tests
To simplify adding additional data to `ParserContext`, this moves test usages to
a few shared locations, instead of being spread across many tests.

MozReview-Commit-ID: 1OahV797eq
2017-04-14 17:22:14 +08:00
J. Ryan Stinnett
4574cd8ea6 Pull rule_type into ParserContext
Absorb `rule_type` into the `ParserContext` so that it's easier to pass down to
deeper levels of the parser.

MozReview-Commit-ID: DjBNytLxGKX
2017-04-12 16:40:17 +08:00
streichgeorg
a0d23e3120 Issue #15959: Implemented parsing and serialization of initial-letter property 2017-03-28 18:53:30 +02:00
J. Ryan Stinnett
535959f2a5 Parsing / serialization for CSS contain 2017-03-23 11:29:12 -05:00
Nazım Can Altınova
56b8c1d8b7
Implement parsing/serialization of will-change 2017-03-21 21:09:57 +03:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter. 2017-03-14 00:49:18 +01:00
radhika2896
0138bbcdd1 Require spaces around operators in calc() (fixes #15486) 2017-03-08 14:32:25 +01:00
Karan Singh
3d5b607ba5 Add remaining keyword values of -moz-user-select (fixes #15197) 2017-03-03 16:13:54 +01:00
Nazım Can Altınova
d7c227f614
Fix parsing of ClipRect 2017-02-25 00:10:43 +03:00
bors-servo
d724bffde8 Auto merge of #15612 - UnICorN21:master, r=canaltinova
fixed the wrong behavior of border-spacing

fixed the wrong behavior of border-spacing
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15489.

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15612)
<!-- Reviewable:end -->
2017-02-21 01:09:35 -08:00
Nazım Can Altınova
19978f2087
Fix parsing methods of column-{gap,width} 2017-02-20 21:07:19 +03:00
Huxley
06650f8428 fixed the wrong behavior of border-spacing 2017-02-19 22:59:51 +08:00
Dawing Cho
8f4282ef76 Add rejection of out-of-range values for single-timing-functions 2017-02-15 00:41:54 +00:00
Alberto Leal
09d4751054 Refactor outline-style to accept "auto" value in addition to border-style values.
Fixes https://github.com/servo/servo/issues/15207
2017-02-08 23:13:20 -05:00
Alberto Leal
cf59be7f44 Fix text-overflow serialization.
Fixes https://github.com/servo/servo/issues/15208
2017-01-25 13:16:58 -05:00
Simon Sapin
b5d9210f16 Fix too many parens in @supports serialization. 2017-01-09 19:35:00 +01:00
Hiroyuki Ikezoe
f78cd2caf1 animation-iteration-count property is a number instead of integer. 2017-01-05 09:50:10 +09:00
Sumant Manne
faddb0c3bb Added image-orientation property 2016-12-10 13:43:49 -06:00