Commit graph

2603 commits

Author SHA1 Message Date
bors-servo
83a8891bd4 Auto merge of #18893 - emilio:bye-can-be-fragmented, r=SimonSapin
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.

Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.

<!-- 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/18893)
<!-- Reviewable:end -->
2018-01-05 05:11:00 -06:00
Pyfisch
8a57bff59d Remove mention of some old issues
* #228 was done (confirmed by mbrubeck)
* #2012 fixed TODO item
* servo/webrender#28 (zoom does work)
2018-01-04 20:31:41 +01:00
Emilio Cobos Álvarez
f3ea248188
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.
Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.
2018-01-04 14:45:54 +01:00
Pyfisch
83bce468ea Format parts of layout
Formats the following files:
* components/layout/display_list_builder.rs
* components/layout/webrender_helpers.rs

Remove outdated options from rustfmt.toml.
Configure rustfmt to place binary operators
at the end of line (to match ./mach test-tidy).
2018-01-03 21:49:47 +01:00
Pyfisch
b3b49e3ff0 Implement correct corner clipping for background color
Add one regression ref test.

See also #19649
2018-01-03 16:16:35 +01:00
bors-servo
691bff86b6 Auto merge of #19651 - pyfisch:background-placement, r=emilio
Unify background placement code

Merges the implementations for background-image placement
from gradients and images. Add missing parts and fix bugs.

Now supported are the CSS properties:

* background-attachment (except for local value, see #19650)
* background-clip
* background-origin
* background-position-x/y
* background-repeat
* background-size

It should be noted that backgrounds are not clipped to
rounded border corners.
(This was done before but worked only in simple cases)
See: #19649

This solves the following issues:
closes #19626
closes #16657
closes #19482 (examples from http://lea.verou.me/css3patterns/ are rendered perfectly but the round border is completely ignored now)
closes #19577

- `./mach build -d` does not report any errors
- `./mach test-tidy` does not report any errors

I enabled a few tests with the first commit but I have written about a dozen manual tests I will try to turn into ref tests either before or after this patch lands.

@bors-servo try

The relationship between the different inputs is visualized in this flowchart:
![flowchart-background](https://user-images.githubusercontent.com/2781017/34394430-5a06c72c-eb59-11e7-9d51-3d23e2215f07.png)

<!-- 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/19651)
<!-- Reviewable:end -->
2018-01-02 08:47:24 -06:00
Pyfisch
cf12e27364 Test with fixes for background repeat: spaced
Test the interaction between background-repeat: spaced
and CSS borders. Fix tile_image_axis() function.
2018-01-02 13:57:32 +01:00
bors-servo
1ce6d8ea2d Auto merge of #19652 - pyfisch:issue18435, r=emilio
Fix division by zero in gradient stop calculation

Check if total_length is zero and return 0.0 instead
of NaN in this case.

Closes #18435

<!-- 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
- [x] These changes fix #18435 (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [x] These changes do not require tests because simple bugfix/no idea for good test

<!-- 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. -->

<!-- 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/19652)
<!-- Reviewable:end -->
2018-01-01 09:38:07 -06:00
Pyfisch
4d84acda19 Remove solved FIXMEs about border radii 2017-12-29 22:21:21 +01:00
Pyfisch
94f3e3353d Fix division by zero in gradient stop calculation
Check if total_length is zero and return 0.0 instead
of NaN in this case.

Closes #18435

Regression test for crash.
2017-12-28 21:18:49 +01:00
Pyfisch
3b3d4a9853 Unify background placement code
Merges the implementations for background-image placement
from gradients and images. Add missing parts and fix bugs.

Now supported are the CSS properties:

* background-attachment (except for local value)
* background-clip
* background-origin
* background-position-x/y
* background-repeat
* background-size

It should be noted that backgrounds are not clipped to
rounded border corners.
2017-12-28 20:14:31 +01:00
bors-servo
7aae164fcd Auto merge of #19622 - tigercosmos:x2, r=shinglyu
pretty print tree

<!-- Please describe your changes on the following line: -->
```
│  │  │  │  │  │  │         floatspec-out=L 0px R 0px
│  │  │  │  │  │  │         overflow=Overflow { scroll: TypedRect(0px×0px at (0px,0px)), paint: TypedRect(0px×0px at (0px,0px)) }
│  │  │  │  │  │  │         damage=BUBBLE_ISIZES
│  │  │  │  │  │  │  └─ ↑↑ Fragment for block:
│  │  │  │  │  │  │  │         SpecificFragmentInfo::Table(2671) []
│  │  │  │  │  │  │  │         border_box=LogicalRect(H LTR, i0px×b0px, @ (i0px,b0px))
│  │  │  │  │  │  │  │         damage=REPOSITION | STORE_OVERFLOW | BUBBLE_ISIZES | REFLOW_OUT_OF_FLOW | REFLOW
│  │  │  │  ├─ Block(1268a9710)
│  │  │  │  │         sc=StackingContextId(0)
│  │  │  │  │         pos=LogicalRect(H LTR, i720px×b36px, @ (i152px,b2636.883333333333px))
│  │  │  │  │         floatspec-in=L 0px R 0px
│  │  │  │  │         floatspec-out=L 0px R 0px
│  │  │  │  │         overflow=Overflow { scroll: TypedRect(750px×36px at (-15px,0px)), paint: TypedRect(750px×36px at (-15px,0px)) }
│  │  │  │  │         children=1
│  │  │  │  │         damage=BUBBLE_ISIZES
│  │  │  │  │  ├─ ↑↑ Fragment for block:
│  │  │  │  │  │         SpecificFragmentInfo::Generic(2673) []
│  │  │  │  │  │         border_box=LogicalRect(H LTR, i720px×b36px, @ (i0px,b0px))
│  │  │  │  │  │         border_padding=LogicalMargin(H LTR, i:0px..0px b:6px..0px)
│  │  │  │  │  │         damage=REPOSITION | STORE_OVERFLOW
│  │  │  │  │  ├─ Block(128554f10)
│  │  │  │  │  │         sc=StackingContextId(0)
│  │  │  │  │  │         pos=LogicalRect(H LTR, i750px×b30px, @ (i0px,b6px))
│  │  │  │  │  │         floatspec-in=L 0px R 0px
│  │  │  │  │  │         floatspec-out=L 0px R 0px
│  │  │  │  │  │         overflow=Overflow { scroll: TypedRect(750px×30px at (-15px,0px)), paint: TypedRect(750px×30px at (-15px,0px)) }
│  │  │  │  │  │         children=6
│  │  │  │  │  │         damage=BUBBLE_ISIZES
│  │  │  │  │  │  ├─ ↑↑ Fragment for block:
│  │  │  │  │  │  │         SpecificFragmentInfo::Generic(2361) []
│  │  │  │  │  │  │         border_box=LogicalRect(H LTR, i750px×b30px, @ (i-15px,b0px))
│  │  │  │  │  │  │         margin=LogicalMargin(H LTR, i:-15px..-15px b:0px..0px)
│  │  │  │  │  │  │         damage=REPOSITION | STORE_OVERFLOW
│  │  │  │  │  │  ├─ TableWrapperFlow: Block(128555410)
│  │  │  │  │  │  │         sc=StackingContextId(0)
│  │  │  │  │  │  │         pos=LogicalRect(H LTR, i750px×b0px, @ (i-15px,b0px))
│  │  │  │  │  │  │         floatspec-in=L 0px R 0px
│  │  │  │  │  │  │         floatspec-out=L 0px R 0px
│  │  │  │  │  │  │         overflow=Overflow { scroll: TypedRect(0px×0px at (0px,0px)), paint: TypedRect(0px×0px at (0px,0px)) }
│  │  │  │  │  │  │         children=1
│  │  │  │  │  │  │         damage=BUBBLE_ISIZES
```

---
<!-- 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 #12675 (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. -->

<!-- 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/19622)
<!-- Reviewable:end -->
2017-12-25 07:56:42 -06:00
tigercosmos
43c94d3445 pretty print tree 2017-12-23 14:40:06 +08:00
Yati Sagade
aa48a2c2e3 Paint worklets: Implement timeout for worklet painter threads
When a paint worklet thread takes too long, we would like to move on,
since we have a ~16ms budget for rendering @60fps. At the moment, there
is no provision in the paintworklet spec to signal such timeouts to the
developer. ajeffrey opened an [issue][1] for this, but it got punted to
v2 of the spec. Hence we are silently timing out unresponsive paint
scripts.

The timeout value is chosen to be 10ms by default, and can be overridden
by setting the `dom.worklet.timeout_ms` pref.

In the absence of such a timeout, the reftest in this commit would fail
by timing out the testrunner itself, since the paint script never
returns. From my discussions with ajeffrey, this should do until we spec
out a way to signal timeouts to the script developer.

Since we did not have a better way to trigger a timeout than a busy
waiting loop (which would hog one core of the test machine until the
timeout was reached), we decided to implement a test only blocking
sleep, available to the PaintWorkletGlobalScope. Since
`dom.worklet.enabled` enables worklets in general, we also decided to
have another pref `dom.worklet.blockingsleep.enabled`, which, in
addition to `dom.worklet.enabled`, would be required for the blocking
sleep to be available.

This fixes #17370.

[1]: https://github.com/w3c/css-houdini-drafts/issues/507
2017-12-22 10:47:23 +01:00
Nazım Can Altınova
9882d0bae5 style: Move text-align outside of the mako file. 2017-12-18 11:58:06 -06:00
bors-servo
dbfcb7bc39 Auto merge of #19568 - pyfisch:background-origin-gradients1, r=mbrubeck
layout: background-origin attribute for gradients

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.

<!-- 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

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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. -->

<!-- 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/19568)
<!-- Reviewable:end -->
2017-12-15 15:54:59 -06:00
Pyfisch
b0492f53af layout: background-origin attribute for gradients
Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.
2017-12-15 22:16:58 +01:00
bors-servo
53968fef61 Auto merge of #19565 - mbrubeck:base, r=emilio
Turn flow::base and friends into methods

This feels more idiomatic in modern Rust, and replaces code like this:

`flow::base(&**root_flow).restyle_damage`

with this:

`root_flow.base().restyle_damage`.

---
- [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 are refactoring only

<!-- 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/19565)
<!-- Reviewable:end -->
2017-12-15 12:44:50 -06:00
bors-servo
6ee8e6a168 Auto merge of #19554 - pyfisch:tiled-gradients1, r=mbrubeck
layout: support tiled gradients

Use background-size, background-position properties to render
CSS gradients.

Some cleanup in display_list_builder.rs related to gradient
calculations.

Adds two wpt tests for tiled gradients.

Note: For now even gradients with background-repeat: no-repeat
are repeated. Sometimes the gradient is not repeated everywhere.

Resolves partially #19482. (See the mentioned website for example gradients with these features)
See also: #16657 and #10412

Some glitches can be seen in the attached file. I am unsure what the exact intended semantics of [`push_gradient`](https://doc.servo.org/webrender_api/struct.DisplayListBuilder.html#method.push_gradient) are and want to ask the webrender team before building in "workarounds" for the missing gradients.
![half-rhombes](https://user-images.githubusercontent.com/2781017/33958051-b16f964a-e043-11e7-8218-b28388e2cf8d.png)

<!-- 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/19554)
<!-- Reviewable:end -->
2017-12-14 13:20:34 -06:00
Matt Brubeck
c60cfc5a9f Turn flow::base and friends into methods 2017-12-14 12:16:45 -06:00
Matt Brubeck
fd664ec72f Make layout depend on style/servo feature
This fixes an error when running commands like `./mach check -p layout`.
2017-12-14 10:34:43 -06:00
Pyfisch
9502e9f42a layout: support tiled gradients
Use background-size, background-position properties to render
CSS gradients.

Some cleanup in display_list_builder.rs related to gradient
calculations.

Adds two wpt tests for tiled gradients.

Note: For now even gradients with background-repeat: no-repeat
are repeated. Sometimes the gradient is not repeated everywhere.

Enable vars-background-shorthand-001.html CSS test.
2017-12-14 09:25:30 +01:00
Emilio Cobos Álvarez
03f3521216
style: Use more Box<[]> and Box<str> for quotes. 2017-12-14 04:05:25 +01:00
CYBAI
b9b91b33be style: Move outline-style outside of mako 2017-12-13 11:41:59 +08:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
bors-servo
fd785f2424 Auto merge of #19522 - KiChjang:remove-border-collapse-field, r=emilio
Remove border_collapse field in InternalTable

This field doesn't seem to serve a purpose after #18252.

<!-- 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/19522)
<!-- Reviewable:end -->
2017-12-08 16:02:09 -06:00
Simon Sapin
e17697fb0e Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender 2017-12-08 14:32:28 +01:00
Keith Yeung
3465b2f14d Remove border_collapse field in InternalTable 2017-12-08 04:51:58 -08:00
Simon Sapin
76270ad6c1 Update app_units and webrender 2017-12-08 01:09:38 +01:00
Bastien Orivel
4b16ff7236 Bump string_cache, html5ever and xml5ever 2017-12-07 20:37:38 +01:00
Glenn Watson
58473cfdcd Update WR (AA improvements, many optimizations) 2017-12-07 15:08:31 +10:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Bastien Orivel
6f8ba39dce Update smallvec to 0.6 2017-12-05 12:03:20 +01:00
Boris Chiou
3a38e815ec Implement Servo_ParseTransformIntoMatrix.
DOMMatrix needs to convert a specified transform list into a matrix, so
we could rewrite to_transform_3d_matrix by generics for both specified
and computed transform lists.

Besides, we have to update the test case because we use Transform3D<f64> to
compute the matrix, instead of Transform3D<f32>, so the result will be
the same as that in Gecko. Using 0.3 may cause floating point issue
because (0.3f32 as f64) is not equal to 0.3 (i.e. floating point precision
issue), so using 0.25 instead.
2017-11-28 10:08:12 +08:00
Dzmitry Malyshau
8922280b91 WR update to 4595561c49939cb21be9554c1b85c244508bde73 2017-11-23 14:51:11 -05:00
Emilio Cobos Álvarez
8de554f334
style: Move property allowance tests to PropertyId::parse_into.
It's not only more consistent (since we have a proper ParserContext there), but
also fixes a bunch of bugs where Gecko accidentally exposes and allows setting
internal state because of conversions from nsCSSPropertyID to PropertyId.

This adds the extra complexity of caring about aliases for longer, but that's
probably not a big deal in practice, since we also have PropertyDeclarationId.

MozReview-Commit-ID: C2Js8PfloxQ
2017-11-21 14:26:16 +01:00
Emilio Cobos Álvarez
7ea98a577b
style: Remove unused argument in element_needs_traversal. 2017-11-17 16:56:26 +01:00
Glenn Watson
cdc163533c Update WR (opaque image optimizations, property binding optimizations) 2017-11-17 10:38:04 +10:00
Emilio Cobos Álvarez
4927786d90
style: Implement css(dimension) and derive ToCss for a bunch of stuff.
For css(dimension), it'd be nice to derive(Parse) too, I think...
2017-11-12 16:22:45 +01:00
Emilio Cobos Álvarez
e4d6296f3f
layout: Fixup indentation of ThreadSafeLayoutNodeHelpers::flags.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-11-10 13:13:19 +01:00
Glenn Watson
b1ec2b260a Update WR (dotted border fix, better AA for split primitives) 2017-11-10 08:17:32 +10:00
Glenn Watson
3007bfe815 Update WR (blur and subpixel text optimizations, recording fix) 2017-11-07 14:48:53 +10:00
Manish Goregaokar
6631594e28
Replace old transform code with new generic code 2017-11-02 14:30:04 -07:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
bors-servo
b6475cf433 Auto merge of #19057 - mrobinson:update-wr-sticky-api, r=glennw
Update WR to use the new sticky positioning API

<!-- 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 do 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. -->

<!-- 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/19057)
<!-- Reviewable:end -->
2017-10-30 15:58:07 -05:00
Martin Robinson
f37fa0cf6d Update WR to use the new sticky positioning API 2017-10-30 10:15:30 +01:00
Connor Brewster
deb932784e style: Move text-overflow outside of mako 2017-10-27 23:09:05 -05:00
Glenn Watson
47544b2d28 Update WR (line decorations, pre-mul borders, mac fonts) 2017-10-26 07:37:14 +10:00
bors-servo
347176df25 Auto merge of #19002 - emilio:kill-more-mako, r=jdm
style: Move background-repeat and mask-repeat outside of mako.

<!-- 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/19002)
<!-- Reviewable:end -->
2017-10-24 12:02:05 -05:00
Martin Robinson
5937f62352 Wait as late as possible to assign ClipIds
This will allow Servo to create ClipScrollNodes later during display
list construction, which will be necessary once rounded rectangles
are removed from the LocalClip structure. Instead of keeping track
of the ClipId of each ClipScrollNode, we keep track of its index in an
array of ClipScrollNodes. This will allow us to access them without a
hash lookup.
2017-10-24 16:28:07 +02:00