Commit graph

285 commits

Author SHA1 Message Date
Manish Goregaokar
bb5f351f4a stylo: support transform 2016-11-10 16:38:15 -08:00
Emilio Cobos Álvarez
5f2e7af864
style: Centralize specified url value handling, and refcount urls. 2016-11-10 13:15:21 +01:00
Ravi Shankar
c4fc49c559 Make use of Either<A, B> for LengthOrNone 2016-11-09 13:04:26 +05:30
bors-servo
ef5ca14283 Auto merge of #14084 - mrobinson:scroll_root_2, r=glennw
Don't promote all scrollable regions to stacking contexts

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

Don't promote all scrollable regions to stacking contexts

Instead annotate all flows with their owning ScrollRoots. When
processing the display list items into a flattened display list, we add
PushScrollRoot and PopScrollRoot to signal when scrolling regions start
and end. It is possible for content from different scrolling regions to
intersect and when they do, the stack of scrolling regions is
duplicated.  When these duplicated scrolling regions stacks reach
WebRender, it will scroll them in tandem.

The PushScrollRoot and PopScrollRoot items are currently represented as
StackingContexts in WebRender, but eventually these will be replaced
with special WebRender display items.

---
<!-- 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 #13529 and #13298. (github issue number if applicable).

<!-- 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/14084)
<!-- Reviewable:end -->
2016-11-07 18:49:53 -06:00
Bobby Holley
a2c7a9d0fb Stop using associated types for the concrete TRestyleDamage implementation.
MozReview-Commit-ID: LfaZFCVlIb1
2016-11-07 11:10:48 -08:00
Emilio Cobos Álvarez
2e69143f6b
canvas: Cleanup CanvasData and layout and script messages. 2016-11-07 11:28:40 +01:00
Martin Robinson
ef82d772c1 Don't promote all scrollable regions to stacking contexts
Instead annotate all flows with their owning ScrollRoots. When
processing the display list items into a flattened display list, we add
PushScrollRoot and PopScrollRoot to signal when scrolling regions start
and end. It is possible for content from different scrolling regions to
intersect and when they do, the stack of scrolling regions is
duplicated.  When these duplicated scrolling regions stacks reach
WebRender, it will scroll them in tandem.

The PushScrollRoot and PopScrollRoot items are currently represented as
StackingContexts in WebRender, but eventually these will be replaced
with special WebRender display items.

Fixes #13529.
Fixed #13298.
2016-11-05 18:36:45 +01:00
bors-servo
f7875dad1a Auto merge of #14060 - servo:gfx-azure, r=nox
Remove the direct azure dependencies from gfx, layout and layout_thread.

<!-- 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/14060)
<!-- Reviewable:end -->
2016-11-05 07:26:30 -05:00
Michael Howell
5f320bd2ca Make FlowRef a newtype
This creates a sharp distinction between `Arc<Flow>`s, which may be
owned by anyone, and `FlowRef`s, which may only be owned by the
traversal code. By checking the reference count, we ensure that a `Flow`
cannot be pointed to by `Arc`s and `FlowRef`s simultaneously.

This is not a complete fix for #6503, though it is a necessary start
(enforcing the no-aliasing rule of `FlowRef::deref_mut` will require far
more work).

Fixes #14014
2016-11-04 13:36:04 -07:00
Ms2ger
81ee81cbb0 Remove the direct azure dependencies from gfx, layout and layout_thread.
This does not cover transitive dependencies through canvas_traits, though that
should not be too hard to solve either.
2016-11-04 12:14:42 +01:00
Martin Robinson
cd1c881830 Fold some DisplayList methods into DisplayListBuildState
This makes the API used to build display lists quite a bit simpler and
reduces the amount of auxiliary data structures that need to be passed
around. It is also important preparation work for separating scrolling
areas from stacking contexts.
2016-11-02 11:18:17 +01:00
Ms2ger
a9e3fe75b5 Remove gfx_traits::color. 2016-10-31 18:15:25 +01:00
Martin Robinson
71d285af80 Use a new id type for tracking scrolling areas
This is a step in disassociating scrolling areas from stacking
contexts. Now scroll areas are defined by unique ids, which means that
in the future stacking context will be able to contain more than one.
2016-10-30 21:10:04 +01:00
Martin Robinson
ccb7ab926a Remove concept of Layers from Servo
Layers were a feature of the legacy drawing path. If we re-add them at
some point, it probably makes more sense to make them a product of
display list inspection.

This change also remove a bunch of dead painting code.
2016-10-21 08:38:34 +02:00
Martin Robinson
2219b14be9 Remove the concept of nested stacking contexts from display list builder
With the removal of the legacy rendering path, we don't need to worry
about nested stacking contexts. This change just pushes the
complication to the WebRender conversion step, but a later change will
remove the concept from WebRender as well.

This also helps to prepare for the introduction of ids for particular
scrolling regions, an integral part of multiple ScrollLayers per block.
2016-10-19 12:55:28 +02:00
Martin Robinson
983edb9b0b Remove Class from DisplayItem enum names
This is probably a holdover from the days before namespaced enums. We
can remove this part of the name to avoid a lot of visual noise.
2016-10-18 08:41:01 +02:00
Glenn Watson
acfdfd2fa9 Remove old rendering backend.
This removes paint threads, rust-layers dependency, and changes
optional webrender types to be required.

The use_webrender option has been removed, however I've left
the "-w" command line option in place so that wpt
runner can continue to pass that. Once it's removed from there
we can also remove the -w option.

Once this stage is complete, it should be fine to change the
display list building code to generate webrender display
lists directly and avoid the conversion step.
2016-10-18 10:21:27 +10:00
Patrick Walton
7df456e8ac layout: Rewrite clipping to be a two-phase process that takes physical
border box positions and transforms into account.

Clipping region computation now follows a simple process: (1) in the
parent's coordinate system, parents store appropriate clipping regions
into children; (2) each child moves its clipping region to its own
coordinate system if necessary.

Because clipping region computation is now based on stacking-relative
border box positions and the `transform_rect` method, it can handle
`position: relative` offsets and more types of transforms, such as
scaling.

Improves etsy.com.

Closes #13753.
2016-10-15 14:18:48 -07:00
Martin Robinson
be62ad7117 Integrate stacking contexts into the display list
Integrate stacking contexts into the display list by adding two new
entry types, PushStackingContext and PopStackingContext. This allows us
to eliminate the ugly offsets map that DisplayList used to contain
and seems to speed up display list construction. With this approach
we are able to also completely prune pseudo-stacking contexts from the
final display list and remove their (minimal) overhead from display
list traversal Traversing the display list is also a bit simpler now.

Additionally, this will allow easier editing of the DisplayList to
properly support scrolling roots. The push/pop entries can be
duplicated to clone complex StackingContext trees between layers.
2016-10-13 09:50:45 +02:00
bors-servo
fe6fac4ee2 Auto merge of #13604 - canaltinova:gradient, r=Manishearth
Implement all gradients

<!-- Please describe your changes on the following line: -->
Implementation of all gradients.
r? @Manishearth

---
<!-- 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 #13549 (github issue number if applicable).

<!-- Either: -->
- [ ] 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/13604)
<!-- Reviewable:end -->
2016-10-09 16:40:18 -05:00
Nazım Can Altınova
26c98edd68 Implement parsing of all gradients 2016-10-09 22:53:15 +03:00
bors-servo
dad3b4785a Auto merge of #13589 - splav:SVGElement#12974, r=pcwalton,Ms2ger
Support SVG element

<!-- Please describe your changes on the following line: -->
minimal SVG element implementation
---
<!-- 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 #12974 (github issue number if applicable).

<!-- 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/13589)
<!-- Reviewable:end -->
2016-10-07 17:40:13 -05:00
Alexandrov Sergey
14934a42d7 add SVG fragment (SpecificFragmentInfo::Svg) 2016-10-07 21:41:02 +03:00
Ravi Shankar
5fd398ec06 Change 'image_rendering' enum variants to snake cases 2016-10-07 23:31:30 +05:30
Martin Robinson
066775915c Simplify stacking context collection
Simplify the way that stacking contexts are collected. Instead of
passing the StackingContextId down the tree, pass the parent
StackingContext itself. This will allow future patches to get more
information about the parent stacking context (such as location).

Also remove the return value of collect_stacking_contexts, which was
unused.
2016-09-27 10:48:44 +02:00
Martin Robinson
68ae97fd0e Add support for background-repeat: space and round
This adds support for more background-repeat modes using the legacy
rendering backend.
2016-09-22 13:20:08 +02:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Ms2ger
05e9a9ac86 Pass SharedLayoutContext to DisplayListBuildState::new. 2016-08-23 18:04:33 +02:00
Ms2ger
0cb0c6bc4e Move image fetching methods to SharedLayoutContext. 2016-08-23 16:13:23 +02:00
Manish Goregaokar
466df01e71
Review fixups 2016-08-22 22:45:16 +05:30
Manish Goregaokar
69ada0d7a3 Support multiple backgrounds in servo layout 2016-08-22 22:42:43 +05:30
bors-servo
daee53cb76 Auto merge of #12918 - hsinewu:12902-typedefs, r=Manishearth
12902 typedefs

<!-- Please describe your changes on the following line: -->
Using type alias instead of newtype.
Removing duplicated implementation, it's already inherited.
No more type constructors and foo.0
---
<!-- 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 #12902 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests because it's refactoring.

<!-- 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/12918)
<!-- Reviewable:end -->
2016-08-22 06:01:03 -05:00
hsinewu
ef9a690c9c Refactor: use type alias instead of newtype 2016-08-22 09:36:19 +08:00
Glenn Watson
51cfccf189 Update for webrender API change, and remove webrender specific hack
in display list building.
2016-08-22 07:38:58 +10:00
Anthony Ramine
51768844ed Update euclid to 0.10.1 2016-08-21 03:03:45 +02:00
Emilio Cobos Álvarez
fd3a99ead3
layout: Make the stacking context take into account the children transform when calculating overflow areas.
This only works for simple translations and similar, but I want Patrick to
validate my approach.
2016-08-16 15:34:28 -07:00
Manish Goregaokar
44e33bcdc5
Move Position into its own values module 2016-08-02 15:57:23 +05:30
Cameron McCormack
baa339f4af Store UrlExtraData in {specified,computed}::Image::Url. 2016-07-29 14:22:35 +08:00
bors-servo
a3e8199c97 Auto merge of #12388 - kilobtye:textarea2, r=pcwalton
Let textarea wrap lines

<!-- Please describe your changes on the following line: -->
1. Change textarea's style from white-space: pre to white-space: pre-wrap.
2. Display insertion point when a line is wrapped.

---
<!-- 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 #10053 (github issue number if applicable).

<!-- Either: -->
- [ ] 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/12388)
<!-- Reviewable:end -->
2016-07-26 08:31:49 -05:00
kilobtye
0a86543e6d Let textarea wrap lines 2016-07-26 20:38:11 +08:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Keith Yeung
764b82e21e Make text decorations have the same color as the text if no shadows are present 2016-07-05 14:56:50 +08:00
Matt Brubeck
25a19343b3 Remove REPAINT damage in Fragment::build_display_list
Previously, the code that called this function was responsible for this.
Some code paths neglected to do it.  This moves the damage removal to one
central location.
2016-06-20 13:39:36 -07:00
mrmiywj
46cadfdd2c use less repetitive name 2016-06-12 12:28:07 +08:00
Patrick Walton
041cfe6d0a script: When using WebRender, keep the DOM-side scroll positions for
elements with `overflow: scroll` up to date, and take them into account
when doing hit testing.

Closes #11648.
2016-06-10 18:43:04 -07:00
Patrick Walton
a86f77e36d script: Keep the DOM-side viewport up to date when scrolling happens in
WebRender.

This happens asynchronously, just as it does in non-WebRender mode.

This functionality is a prerequisite for doing proper display-list-based
hit testing in WebRender, since it moves the scroll offsets into Servo
(and, specifically, into the script thread, enabling iframe event
forwarding) instead of keeping them private to WebRender.

Requires servo/webrender_traits#55 and servo/webrender#277.

Partially addresses #11108.
2016-05-31 14:12:51 -07:00
Emilio Cobos Álvarez
37d1c749aa
layout: Correctly calculate the angle for gradients with corners
The previous code assumed that the diagonals of the elements were
perpendicular, which only happens with squares.

tests: layout: Test linear gradient corners
2016-05-31 00:01:22 +02:00
Cullen Rhodes
40acd24e8f Report use statements that use {} with only one entry 2016-05-27 10:18:44 +01:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
bors-servo
cf121ad8df Auto merge of #10895 - mbrubeck:byteindex, r=pcwalton
Use byte indices instead of char indices for text runs

Replace character indices with UTF-8 byte offsets throughout all code dealing with text runs.  This eliminates a lot of complexity when converting from one to the other, and interoperates better with the rest of the Rust ecosystem.

For most code this is just a simple replacement of char indices with byte indices.  In a few places like glyph storage and text fragment scanning, it also lets us get rid of code that existed only to map between bytes and chars.

Also includes some related fixes to text shaping, discovered while working on this conversion.  See the commit messages for details.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10895)
<!-- Reviewable:end -->
2016-04-28 20:22:09 -07:00