Commit graph

318 commits

Author SHA1 Message Date
Nazım Can Altınova
d7c227f614
Fix parsing of ClipRect 2017-02-25 00:10:43 +03:00
bors-servo
1d13e6a2df Auto merge of #15700 - glennw:zoom-wip-2, r=mbrubeck
Introduce CSSPixel as a replacement for ViewportPx and PagePx.

<!-- 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/15700)
<!-- Reviewable:end -->
2017-02-23 16:01:16 -08:00
Glenn Watson
30ff2f8f0d Introduce CSSPixel as a replacement for ViewportPx and PagePx. 2017-02-24 06:58:10 +10:00
Glenn Watson
ffcb319324 Add support for most of the border-image properties, pass to WR.
This adds support for:
 * border-image (images, not gradients yet)
 * border-image-source
 * border-image-slice
 * border-image-repeat (stretch + repeat only for now)

Remaining work:
 * Connect border-image-outset (WR supports this).
 * border-image-width
2017-02-23 14:15:20 +10:00
Josh Matthews
c890c9143c Make script thread initiate requests for images needed by layout.
In support of this goal, the layout thread collects information about
CSS images that are missing image data and hands it off to the script
thread after layout completes. The script thread stores a list of
nodes that will need to be reflowed after the associated network
request is complete. The script thread ensures that the nodes are
not GCed while a request is ongoing, which the layout thread is
incapable of guaranteeing.

The image cache's API has also been redesigned in support of this
work. No network requests are made by the new image cache, since it
does not possess the document-specific information necessary to
initiate them. Instead, there is now a single, synchronous
query operation that optionally reserves a slot when a cache
entry for a URL cannot be found. This reserved slot is then
the responsibility of the queryer to populate with the contents
of the network response for the URL once it is complete. Any
subsequent queries for the same URL will be informed that the
response is pending until that occurs.

The changes to layout also remove the synchronous image loading
code path, which means that reftests now test the same code
that non-test binaries execute. The decision to take a screenshot
now considers whether there are any outstanding image
requests for layout in order to avoid intermittent failures in
reftests that use CSS images.
2017-02-22 14:19:35 -05:00
Emilio Cobos Álvarez
0c102e2350
style: Unbox a bunch of color properties.
This builds on https://github.com/servo/rust-cssparser/pull/118.
2017-02-14 20:18:31 +01:00
Manish Goregaokar
6b0d3902de Factor out ClipRect type into values; use Either for clip
MozReview-Commit-ID: C3R1erJdiID
2017-02-09 15:09:35 -08:00
bors-servo
368af6f861 Auto merge of #15357 - dashed:gh-15207, r=Wafflespeanut,emilio
Refactor outline-style to accept "auto" value in addition to border-style values.

Fixes https://github.com/servo/servo/issues/15207

Refactored as per https://github.com/servo/servo/issues/15207#issuecomment-275171590 .

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

- [x] Correct refactor? I'd appreciate any feedback on this.
- [x] ~~~proper borderstyle value for `outline-style: auto;`?~~~ ~~~(EDIT: deferred to a `FIXME`)~~~ (EDIT2: it is now solid for behaviour parity with firefox)
- [x] squash pending PR review
- [x] mako code review

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

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

<!-- 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/15357)
<!-- Reviewable:end -->
2017-02-08 21:10:57 -08:00
Alberto Leal
09d4751054 Refactor outline-style to accept "auto" value in addition to border-style values.
Fixes https://github.com/servo/servo/issues/15207
2017-02-08 23:13:20 -05:00
Pu Xingyu
336aa795b4 Remove cached thread local context from LayoutContext
Remove cached thread local context from LayoutContext, use LayoutContext for
assign_inline_sizes(), and simplify the parallel flow traversal code.
2017-02-08 08:47:54 +08:00
Matt Brubeck
b3820c1296 Convert text-orientation to a Gecko-only property
Remove incomplete and buggy support for text-orientation in Servo.
Make the property values align with Gecko and the latest draft of CSS
Writing Modes Level 3.
2017-01-27 21:12:38 -08:00
Emilio Cobos Álvarez
4639940dfe
Revert "Revert "frame-resize refactor""
This reverts commit 6ead3952a3.
2017-01-24 22:20:39 +01:00
Matt Brubeck
6ead3952a3 Revert "frame-resize refactor"
This reverts commit bca565a1a3.
2017-01-23 16:44:56 -08:00
bors-servo
7e2329ea4e Auto merge of #15129 - cynicaldevil:iframe-resize, r=emilio
Refactor to send iframe resize messages directly from layout thread to constellation

<!-- 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 #14682.
<!-- Either: -->

r? @jdm
passing tests:
tests/wpt/mozilla/tests/css/matchMedia.html, tests/wpt/mozilla/tests/mozilla/window_resize_not_triggered_on_load.html, tests/wpt/mozilla/tests/mozilla/iframe/resize_after_load.html, tests/wpt/mozilla/tests/css/meta_viewport_resize.html

<!-- 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/15129)
<!-- Reviewable:end -->
2017-01-23 06:08:02 -08:00
Nikhil Shagrithaya
bca565a1a3 frame-resize refactor 2017-01-23 19:12:16 +05:30
bors-servo
3ab514302f Auto merge of #14979 - mrobinson:scroll-roots-when-necessary, r=emilio
Only create scrolling overflow regions when necessary

Only create scroll roots for overflow regions when the overflow region
is actually larger than the container size. This prevents creating
scrolling roots for elements that do not have overflow scroll as a
side-effect of the way their height and width is defined. For example,
tables should never respect overflow:scroll since their height and
width should always be large enough to prevent overflow. This also
decreases the size and complexity of the display list in many other
circumstances.

As part of this change, transformed overflow calculation is moved from
display list construction to layout. This should mean that overflow is
handled more accurately earlier.

Fixes #14574.

<!-- 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 #14574 (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/14979)
<!-- Reviewable:end -->
2017-01-17 07:18:42 -08:00
Martin Robinson
44b24de60f Only create scrolling overflow regions when necessary
Only create scroll roots for overflow regions when the overflow region
is actually larger than the container size. This prevents creating
scrolling roots for elements that do not have overflow scroll as a
side-effect of the way their height and width is defined. For example,
tables should never respect overflow:scroll since their height and
width should always be large enough to prevent overflow. This also
decreases the size and complexity of the display list in many other
circumstances.

As part of this change, transformed overflow calculation is moved from
display list construction to layout. This should mean that overflow is
handled more accurately earlier.

Fixes #14574.
2017-01-17 09:47:43 -05:00
Michael Howell
cef4ebed20 Preserve the un-truncated version of fragments
Fixes #14952
2017-01-12 22:02:53 +00:00
bors-servo
f674a9db8b Auto merge of #14938 - servo:gfx-traits, r=nox
Various cleanup around gfx_traits.

<!-- 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/14938)
<!-- Reviewable:end -->
2017-01-10 07:02:23 -08:00
Martin Robinson
29876d2703 Rework the way scroll roots are collected
Collect scroll roots during the collect_stacking_context phase instead
of during display list construction. This will be useful in order to
collect containing block scroll roots as well as to give scroll roots
sequential ids in the future. This change also pulls stacking context
children out of the StackingContext struct itself, which should reduce
very slightly the memory used by the finished display list. This also
simplifies the DisplayListBuilder because it no longer has to maintain
a stack of ScrollRootIds and StackingContextIds and can instead just
rely on the program stack.
2017-01-10 13:33:08 +01:00
Ms2ger
5d2a68033a Replace gfx_traits::ScrollPolicy by webrender_traits::ScrollPolicy. 2017-01-10 09:45:53 +01:00
Martin Robinson
f3577e41c1 Move some methods from display_list_builder.rs
These methods are not only used during display list construction, so
they are a better fit for the flow structs themselves. This does
not introduce any behavior change, but should make it easier to fix
2017-01-09 12:33:23 +01:00
Nazım Can Altınova
2e9d4df223 Move transform related properties from effects to box. 2016-12-26 16:04:57 +03:00
Nazım Can Altınova
aeb5d34394 Move perspective and perspective-origin properties from effects to box. 2016-12-23 19:01:32 +03:00
bors-servo
9d2b98e6f8 Auto merge of #14598 - DominoTree:master, r=canaltinova
Fix linear gradient's specified form #13892

<!-- Please describe your changes on the following line: -->
WIP for #13892

---
<!-- 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 #13892  (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/14598)
<!-- Reviewable:end -->
2016-12-16 15:11:29 -08:00
Nick Price
5d56946bc2 Maintain Corner type, add None type to AngleOrCorner 2016-12-16 17:49:15 -05:00
bors-servo
5357f05ff7 Auto merge of #14509 - canaltinova:position, r=Manishearth
Implement background-position-x/y

<!-- Please describe your changes on the following line: -->
This is a WIP PR. Just HorizontalPosition / VerticalPosition implementations are complete. I would like to get early feedbacks about this architecture. Here's some architectural topics to consider:

- I created `HorizontalPosition` and `VerticalPosition` structs for this and used them in `Position` as well. We have decided to split `Keyword` enum, but we need them as unified for `PositionComponent` enum. So I didn't split but I can split it if we prefer to change PositionComponent as well.
- If we prefer Keyword enum like this, we can create a SubPosition(or something like this) instead of HorizontalPosition/VerticalPosition enums since only difference is 2 lines in `parse` functions. We can create a `parse_horizontal` and `parse_vertical` instead and a lot of code duplication can be cleared.
- I couldn't find a good way to use HorizontalPosition/VerticalPosition's parse functions in `Position`'s parse function. It is a bit more complicated. I'm open to suggestions :)
- I don't know much about logical keywords so do I need to do something different? I placed some comments where logical keywords are processing.

Any advice about these?

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

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

<!-- 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/14509)
<!-- Reviewable:end -->
2016-12-15 12:15:06 -08:00
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
Nazım Can Altınova
ed806efade Make background-position a shorthand instead of a longhand 2016-12-15 01:36:30 +03:00
Pu Xingyu
b0de105bb0 Various fixes
Fix the behavior of block-direction margins of replaced element both
as block level or inline level, and no longer query fragment info when
building display list for canvas.
2016-12-12 18:10:39 +08:00
Martin Robinson
f090d00c09 Don't scroll background and borders of overflow:scroll blocks
We want them to be children of the parent scrolling root instead of the
scrolling root of the particular block they belong to. Also, we adjust
the scroll root to only include the content region.
2016-12-06 14:08:17 -10:00
Cameron McCormack
830cc88283 Support cursor property url() values in stylo. r=manishearth
MozReview-Commit-ID: 6herzaXUz4i
2016-11-21 14:48:59 +08:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
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