Commit graph

330 commits

Author SHA1 Message Date
Josh Matthews
adb75ba114 Revert "Revert "Update harfbuzz, freetype, unicode-script.""
This reverts commit 6b520850f3.
2020-08-10 13:30:12 -04:00
Josh Matthews
6b520850f3 Revert "Update harfbuzz, freetype, unicode-script."
This reverts commit 327fed6084.
2020-08-04 19:16:13 -04:00
Josh Matthews
327fed6084 Update harfbuzz, freetype, unicode-script. 2020-07-31 10:40:27 -04:00
bors-servo
6a3c3a4e18
Auto merge of #26447 - jdm:white-space-2020, r=nox
Layout 2020: Implement basic white-space: pre support

With these changes `<pre>` and `<br>` preserve spaces and force line breaks appropriately.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26440
- [x] There are tests for these changes
2020-07-29 10:29:30 -04: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
Josh Matthews
260347e5dc Simplify control flow of whitespace handling. 2020-07-27 20:06:55 -04:00
Josh Matthews
d8b4dab4e3 Implement basic white-space: pre support for layout 2020. 2020-07-27 20:06:53 -04:00
Manish Goregaokar
5a53fb1271 Adjust absolute positioned box offsets in flow layout 2020-07-27 09:48:37 -07:00
Manish Goregaokar
bc704d8a3d Move AbsoluteBoxOffsets into HoistedSharedFragment 2020-07-27 09:48:37 -07:00
Manish Goregaokar
d476a10773 Create HoistedSharedFragment 2020-07-27 09:48:37 -07:00
Manish Goregaokar
96c0c50874 Allow adjusting box offsets 2020-07-27 09:48:37 -07:00
bors-servo
9864e4ce6c
Auto merge of #27385 - servo:list, r=Manishearth
Add Layout 2020 support for `display: list-item`
2020-07-24 21:18:16 -04:00
Simon Sapin
b91e293819 Add layout support for list markers 2020-07-24 09:31:24 +02:00
Simon Sapin
4a4199c1d6 Don’t parse unspported values of content 2020-07-24 09:31:24 +02:00
Simon Sapin
82e274aec9 Make a bool for display: list-item available to flow box construction 2020-07-23 16:43:57 +02:00
Patrick Walton
362b64aa68 Use the size of the containing block, not the size of the block formatting
context, to place floats in layout 2020.

The containing block for a float is not necessarily the same as the block
formatting context the float is in per CSS 2.1 [1]:

"For other elements, if the element’s position is relative or static, the
containing block is formed by the content edge of the nearest block container
ancestor box."

This shows up in the simplest case:

	<html>
	<body>
	<div style="float: left">Hello</div>
	</body>
	</html>

In this case, the `<html>` element is the block formatting context with inline
size equal to the width of the window, but the `<body>` element with nonzero
inline margins is the containing block for the float. The float placement must
respect the content box of the `<body>` element (i.e. floats must not overlap
the `<body>` element's margins), not that of the `<html>` element.

Because a single block formatting context may contain floats with different
containing blocks, the left and right "walls" of that containing block become
properties of individual floats at the time of placement, not properties of the
float context itself.

Additionally, this commit generalizes the float placement logic a bit to allow
the placement of arbitrary objects, not just floats. This is intended to
support inline layout and block formatting context placement.

This commit updates the `FloatContext` and associated tests only and doesn't
actually wire the context up to the rest of layout, so floats in pages still
aren't actually laid out.

[1]: https://drafts.csswg.org/css2/#containing-block-details
2020-07-22 19:58:28 -07:00
bors-servo
c02da14847
Auto merge of #27339 - Manishearth:flex-align-items, r=pcwalton
flexbox 2020: Implement `align-items` and `align-self`, excluding `baseline`

This PR is based on https://github.com/servo/servo/pull/27334 for ease of testing

`baseline` is tricky and involves keeping track of a "baseline set"

https://drafts.csswg.org/css-flexbox/#flex-baselines

Part of https://github.com/servo/servo/issues/26639
2020-07-21 02:36:48 -04:00
Manish Goregaokar
ba9448e682 flex 2020: Handle positioning flex item based on align-self 2020-07-20 20:16:23 -07:00
Manish Goregaokar
d1b92b68c7 flexbox 2020: Respect the stretchiness of align-self 2020-07-20 14:26:14 -07:00
Manish Goregaokar
63ac4d165c flexbox 2020: Store align_items on FlexContext 2020-07-20 14:26:14 -07:00
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
Manish Goregaokar
6914c51195 Handle flex item box sizing and minmax for flexbox in 2020 2020-07-20 12:22:06 -07:00
bors-servo
32cb62aa1b
Auto merge of #27044 - servo:flexbox, r=nox
First pass at implementing the Flex Layout Algorithm

CC https://github.com/servo/servo/issues/26639
2020-06-23 16:51:02 -04:00
Anthony Ramine
b692318931 Bump rust to 1.46.0-nightly (a8cf39911 2020-06-21)
This fixes a rustfmt reporting bug when the code contains syntax errors.
2020-06-23 19:13:36 +02:00
Simon Sapin
22b60d8b82 Manage side effects when redoing layout for align-self: stretch flex item 2020-06-23 10:26:24 +02:00
Simon Sapin
3e13b3be80 Flexbox: add align-self: stretch 2020-06-23 00:51:51 +02:00
Simon Sapin
01905923db First pass at implementing the Flex Layout Algorithm
https://drafts.csswg.org/css-flexbox/#layout-algorithm
2020-06-23 00:41:27 +02:00
Simon Sapin
080f5bb763 An element establishing a formatting context *is* the containing block for its contents 2020-06-23 00:41:26 +02:00
bors-servo
53263595f1
Auto merge of #26968 - servo:layout-2020-lazy-content-sizes, r=SimonSapin
Compute content sizes lazily in layout 2020
2020-06-19 13:50:29 -04:00
Simon Sapin
42e9d2450e Parallelize BlockContainer::inline_content_sizes 2020-06-19 15:38:15 +02:00
Simon Sapin
5fed956d65 Remove the now single-field Accumulator struct 2020-06-19 15:30:23 +02:00
Simon Sapin
51c388fe1c Rename outer_inline* outside of sizing.rs to outer_inline_content_sizes* 2020-06-19 15:27:33 +02:00
Anthony Ramine
235df94f2e Compute content sizes lazily in layout 2020 2020-06-18 14:11:02 +02:00
Martin Robinson
f3e373bc62 Add animation and transition support for pseudo-elements
This change extends the DocumentAnimationSet to hold animations for
pseudo-elements. Since pseudo-elements in Servo are not in the DOM like
in Gecko, they need to be handled a bit carefully in stylo.  When a
pseudo-element has an animation, recascade the style. Finally, this
change passes the pseudo-element string properly to animation events.

Fixes: #10316
2020-06-16 16:33:55 +02:00
bors-servo
ba5568a0a6
Auto merge of #26921 - mrobinson:animation-set-key, r=jdm
Add DocumentAnimationSet and AnimationSetKey

This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.

---
<!-- 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 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-06-16 03:25:29 -04:00
bors-servo
abc3ed40c9
Auto merge of #26872 - kunalmohan:gpu-canvas-context, r=kvark,jdm
Implement GPUSwapChain and GPUCanvasContext and interface with Webrender

<!-- Please describe your changes on the following line: -->
r?@kvark

---
<!-- 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
- [ ] These changes do not require tests because ___

<!-- 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-06-15 14:22:21 -04:00
bors-servo
24cc72ba85
Auto merge of #26852 - servo:layout-2020-independent-kind, r=SimonSapin
Some more boring stuff to change how we compute content sizes
2020-06-15 14:02:42 -04:00
Anthony Ramine
db80b8e3c1 Make IndependentFormattingContext an enum 2020-06-15 18:09:15 +02:00
Anthony Ramine
07d8c28d4a Make outer_inline and outer_inline_and_percentages free functions
They now take a closure that will compute the content sizes on demand.
2020-06-15 18:09:15 +02:00
Anthony Ramine
d0a1066d2d Remove PositioningContext::create_and_layout_positioned
It has only one call site.
2020-06-15 18:09:15 +02:00
Anthony Ramine
b53959d23d Move IndependentFormattingContext::as_replaced to IndependentFormattingContextContents 2020-06-15 18:09:15 +02:00
Anthony Ramine
b66dd66403 Rename contents to context in AbsolutelyPositionedBox 2020-06-15 18:09:15 +02:00
Martin Robinson
4a3995bb37 Add DocumentAnimationSet and AnimationSetKey
This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.
2020-06-15 10:28:30 +02:00
Kunal Mohan
2c95df73a4 Add WebGPU to Layout-2020 2020-06-14 11:05:36 +05:30
Matthias Deiml
b85a5dac5d Implement visibility for layout_2020 2020-06-14 00:31:37 +02:00
bors-servo
721271dcd3
Auto merge of #26697 - utsavoza:ugo/issue-11681/22-05-2020, r=jdm
Implement CanvasRenderingContext2d.fillText

The PR consists of broadly two main changes:
- Implementation of Canvas2dRenderingContext.font
- Basic implementation of Canvas2dRenderingContext.fillText

Although I am not fully sure about the long term goals for the canvas backend in Servo, I assumed limited scope for font and text handling (should support simple text drawing with font selection) in the current implementation as I believe a more complete implementation would eventually be brought in as a part of #22957.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #11681
- [x] There are tests for these changes
2020-06-12 13:43:51 -04:00
bors-servo
d85c6ee341
Auto merge of #26838 - servo:flexbox, r=nox
Flexbox, the boring parts

I have a local branch starting to implement https://drafts.csswg.org/css-flexbox/#layout-algorithm. It’s not PR-ready yet, but it’s going to be large so here are some of the less interesting parts meaningful by themselves. Landing the module split in particular will help reduce merge conflicts.

CC https://github.com/servo/servo/issues/26639
2020-06-10 17:19:16 -04:00
Utsav Oza
d1241a8d06 Fix ./mach build --release --with-layout-2020 2020-06-10 22:34:24 +05:30