diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2020-07-06 18:44:59 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2020-07-20 12:42:34 -0700 |
commit | 5b36d211b4c9c289c7884abf170f4e2702863fae (patch) | |
tree | c2f678097b2d759cff3a28030035eb7ce417b026 /python/servo | |
parent | 48bf169101dfe6d185d869cefe483cec16384c52 (diff) | |
download | servo-5b36d211b4c9c289c7884abf170f4e2702863fae.tar.gz servo-5b36d211b4c9c289c7884abf170f4e2702863fae.zip |
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.
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/testing_commands.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index ec3a74ffdfa..f5784ce4f4d 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -222,7 +222,7 @@ class MachCommands(CommandBase): @CommandArgument('--nocapture', default=False, action="store_true", help="Run tests with nocapture ( show test stdout )") @CommandBase.build_like_command_arguments - def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, **kwargs): + def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, with_layout_2020=False, **kwargs): if test_name is None: test_name = [] @@ -255,7 +255,6 @@ class MachCommands(CommandBase): self_contained_tests = [ "background_hang_monitor", "gfx", - "layout_2013", "msg", "net", "net_traits", @@ -263,6 +262,10 @@ class MachCommands(CommandBase): "servo_config", "servo_remutex", ] + if with_layout_2020: + self_contained_tests.append("layout_2020") + else: + self_contained_tests.append("layout_2013") if not packages: packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit"))) - set(['.DS_Store']) packages |= set(self_contained_tests) @@ -298,7 +301,11 @@ class MachCommands(CommandBase): if nocapture: args += ["--", "--nocapture"] - err = self.run_cargo_build_like_command("bench" if bench else "test", args, env=env, **kwargs) + err = self.run_cargo_build_like_command("bench" if bench else "test", + args, + env=env, + with_layout_2020=with_layout_2020, + **kwargs) if err: return err |