Commit graph

61 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Manish Goregaokar
b026dae8ac Only apply clip() to positioned elements 2020-07-27 23:26:30 -07:00
Manish Goregaokar
346a0e02d5 Handle clip before we push the stacking context 2020-07-27 19:59:59 -07:00
Manish Goregaokar
07c87b4715 Handle clip property in 2020 2020-07-27 19:59:59 -07:00
Manish Goregaokar
d476a10773 Create HoistedSharedFragment 2020-07-27 09:48:37 -07:00
Matthias Deiml
b85a5dac5d Implement visibility for layout_2020 2020-06-14 00:31:37 +02:00
bors-servo
7eacfa4f0d
Auto merge of #26823 - jdm:single-renderapi, r=asajeffrey
Update webrender

These changes reflect changes in webrender's API that make RenderApiSender and RenderApi objects more challenging to share. This PR moves us to a model where:
* the compositor owns the main RenderApi object
* other threads that need to create transactions or manipulate fonts proxy those operations to the compositor (script/layout use IPC, while other threads use non-IPC channels)
* the webgl thread owns its own independent RenderApi
2020-06-09 19:34:08 -04:00
bors-servo
cb4e3cb16a
Auto merge of #26758 - jdm:stacking-context-transform-zero, r=mrobinson
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
2020-06-09 13:37:30 -04:00
Josh Matthews
75efaa95f5 Proxy all WR interactions for layout/font/script/canvas threads to the compositor
thread. There is now a single RenderApi that is used, and all transactions are serialized
through the compositor.
2020-06-09 13:05:16 -04:00
Josh Matthews
56ff8f41e0 layout2020: Don't create stacking contexts for empty fragments and boxes. 2020-06-09 11:30:17 -04:00
Martin Robinson
89855afa4d layout_2020: Tag fragments with their pseudo content type
This will allow us to answer queries and properly handle animations in
the future for fragments generated for pseudo content.
2020-06-06 17:25:08 +02:00
Martin Robinson
c2875482d6 layout_2020: Implement support for backface-visibility 2020-05-16 09:42:45 +02:00
Simon Sapin
f53ac953d6 Fix incorrect sign background-image rectangle computation 2020-05-15 13:37:09 +02:00
Simon Sapin
1f6efbf9e9 Correctly paint the CSS canvas’ background
https://drafts.csswg.org/css-backgrounds/#special-backgrounds

Fixes https://github.com/servo/servo/issues/25559
Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
2020-05-15 13:37:09 +02:00
Simon Sapin
c7acfc37ed Separate computing a WR reference frame from adding it to the display list 2020-05-15 13:25:35 +02:00
Josh Matthews
af05da574b Use new webrender rounded clip API. 2020-05-12 14:43:41 -04:00
Josh Matthews
eb2f7f7f0a Convert all uses of UpdateResources api to use webrender transactions. 2020-05-11 17:41:56 -04:00
Josh Matthews
8842250033 Update webrender. 2020-05-11 17:41:56 -04:00
Martin Robinson
a637810df3 layout_2020: Add support for transform-style
This requires creating a matching stacking context for every reference
frame and also properly placing those stacking contexts inside them.
2020-05-11 15:03:29 +02:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +02:00
Daniel Alley
61fb84d6a0 Don't send empty canvases to WebRender
If any dimension of a canvas is 0, don't try to render it as it causes
problems inside webrender.
2020-04-03 11:34:04 -04:00
Daniel Alley
814478bee0 Ensure reference frame is popped in layout 2020
closes: #26066
2020-03-31 09:37:08 -04:00
Martin Robinson
ac2f402ae0 layout_2020: Stop throwing away hoisted boxes in nested absolutes
We were previously throwing away some boxes hoisted to containing blocks
for all descendants when they were contained by absolutes. This prevents
panics in existing web platform tests that would otherwise be triggered
by the addition of the `unreachable!` statement.
2020-03-27 17:46:06 +01:00
Martin Robinson
19f4b708b3 layout_2020: Use ArcRefCell to track hoisted fragments
This avoids the use of lookup tables for containing blocks when
constructing the stacking context tree.

This seems to catch some laid-out hoisted fragments that were otherwise
dropped in the previous design. The changes cause one new test to pass
and one to fail. Visual examination of the failing tests reveals that
it's a progression (list markers are appearing when they were previously
not rendered).
2020-03-27 13:02:22 +01:00
bors-servo
4dbe3b30cd
Auto merge of #26037 - mrobinson:arcrefcell-fragment-tree, r=SimonSapin
layout_2020: Use ArcRefCell in the fragment tree

This will allow mutability which is useful for things like animations.

<!-- Please describe your changes on the following line: -->

---
<!-- 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
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should not change behavior.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-03-26 10:23:23 -04:00
Martin Robinson
7cb0069be5 layout_2020: Use ArcRefCell in the fragment tree
This will allow mutability which is useful for things like animations.
2020-03-25 17:57:17 +01:00
bors-servo
acd14672e1
Auto merge of #25888 - ferjm:text.decoration.2020, r=nox
Partial text decoration support for layout 2020

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25166
- [X] There are tests for these changes
2020-03-23 11:18:18 -04:00
Fernando Jiménez Moreno
17948f3b39 Propagate text decoration where needed 2020-03-23 11:13:10 +01:00
Fernando Jiménez Moreno
83fc9943d3 Do not use buggy text_decorations_in_effect 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
689b413bde Add support for text-decoration-style 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
928bd0d1d2 Add support for text-decoration-color 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
107af9e769 Render text-decoration: line-through on layout 2020 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
c87a4dd788 Remove unnecessary fragment rect clone 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
4fd5484e1a Render text-decoration: overline on layout 2020 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
48517bd61a Render text-decoration: underline on layout 2020 2020-03-23 11:10:44 +01:00
Fernando Jiménez Moreno
e3c8597ccb Store required font metrics on TextFragment 2020-03-23 11:10:44 +01:00
Martin Robinson
811c08c5a5 layout_2020: Use the containing block more when calculating scrolling overflow
When calculating scrolling overflow calculation we cannot currently use
the actual containing block in all cases. This change increases the
amount that we do use the containing block.
2020-03-23 10:08:04 +01:00
Martin Robinson
c3b1c92ac1 layout_2020: Paint hoisted positioned fragments in tree order
Instead of painting hoisted position fragments in the order to which
they are hoisted, paint them in tree order and properly incorporate them
into the stacking context.

We do this by creating a placeholder fragment in the original tree position
of hoisted fragments. The ghost fragment contains an atomic id which
links back to the hoisted fragment in the containing block.

While building the stacking context, we keep track of containing blocks
and their children. When encountering a placeholder fragment we look at
the containing block's hoisted children in order to properly paint the
hoisted fragment.

One notable design modification in this change is that hoisted fragments
no longer need an AnonymousFragment as their parent. Instead they are
now direct children of the fragment that establishes their containing block.
2020-03-11 12:47:06 +01:00
Martin Robinson
8de55695e4 Have transforms and filters be CBs for all descendants in layout_2020
This is a feature that was never properly implemented in the previous
layout system. We still need to preserve their in-tree order in the
display list though.
2020-03-02 11:47:00 +01:00
Martin Robinson
80b29380f1 Add layout_2020 support for transformations 2020-02-21 17:07:09 +01:00
Martin Robinson
d03560b0f1 Add layout_2020 support for filters and mix-blend-mode 2020-02-19 10:26:13 +01:00
Martin Robinson
9517190a60 Split stacking context fragments into sections in layout_2020
This allows rendering stacking context content in the proper order. We
also need to add a new pseudo stacking context for atomic inlines in
order to preserve proper rendering order in some cases.
2020-02-17 14:10:03 +01:00
Martin Robinson
4a2787b974 Add initial stacking context paint order support to layout_2020
This adds very rudimentary support for paint order in stacking context.
In particular z-index is now handled properly, apart from issues with
hoisted fragments.
2020-02-17 10:05:19 +01:00
Martin Robinson
843df5b529 Add support for a stacking context pass to layout_2020
This adds an intermediary data structure that allows the display list
builder to move through the fragment tree in stacking context painting
order. Spatial nodes are built during this phase and all display list
items are added to the end of the display list.
2020-02-14 10:57:45 +01:00
Martin Robinson
63aae0178f Improve position:fixed support in layout_2020
This makes it so that position:fixed elements do not scroll with the
rest of the contents, but does not tackle the rest of the issues with
their positioning.
2020-02-11 10:42:35 +01:00
Martin Robinson
20b8edc625 Clean up BoxFragment display list builder in layout_2020
This makes things a big easier to read and will make it easier to add
support for position:fixed.
2020-02-07 14:35:05 +01:00
Martin Robinson
7a5a320d74 Add support for overflow:scroll and overflow:hidden to layout_2020
This adds clipping and interactive scrolling support, but scrolling from
script is still not functional.
2020-01-31 17:30:29 +01:00
Simon Sapin
37ccefbe19 Adress review comments 2020-01-25 07:37:28 +01:00
Simon Sapin
632e731760 Render gradients 2020-01-24 14:20:20 +01:00
Simon Sapin
f39c3ff38b Apply background-clip to background-color 2020-01-24 14:20:20 +01:00