Commit graph

247 commits

Author SHA1 Message Date
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
Matt Brubeck
659305fe0a Use byte indices instead of char indices for text runs
Replace character indices with UTF-8 byte offsets throughout the code dealing
with text shaping and breaking.  This eliminates a lot of complexity when
converting from one to the other, and interoperates better with the rest of
the Rust ecosystem.
2016-04-28 14:32:14 -07:00
Daosheng Mu
b7e05b4a9d Avoid drawing while canvases without contexts. 2016-04-28 07:03:45 +08:00
bors-servo
1fee7185a7 Auto merge of #10810 - mrobinson:displayitem, r=pcwalton
Merge DisplayListEntry into DisplayItem

We don't really need two levels of abstraction for every element in the
DisplayList. This simplifies the complexity of the data structure in
preparation for providing documentation and properly handling scrolling
roots.

<!-- 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/10810)
<!-- Reviewable:end -->
2016-04-26 10:13:00 -07:00
Martin Robinson
05fb2ef6ee Merge DisplayListEntry into DisplayItem
We don't really need two levels of abstraction for every element in the
DisplayList. This simplifies the complexity of the data structure in
preparation for providing documentation and properly handling scrolling
roots.
2016-04-22 10:28:27 -07:00
Josh Matthews
1623114376 Use DOM width/height for canvas display list item. 2016-04-21 23:20:21 -04:00
Patrick Walton
63279c316b layout: Implement support for overflow: scroll in WebRender.
Includes a WebRender upgrade.

Improves Twitter.
2016-04-19 14:13:13 -07:00
Peter
b0ad3ddf5b Updated euclid to version 0.6.5
And updated existing usages of Matrix4 to use Matrix4D<T>
2016-04-17 18:39:49 +01:00
Michael Howell
3c2210c5fc Propogate transformed clipping regions to nested flows.
Fixes #10559
2016-04-13 11:50:50 -07:00
Michael Howell
6c9efbf383 Take transform:translate into account when computing clipping regions.
Note that this only works for translation; a more general fix would
require major changes to how display lists work.

Closes #10431?
2016-04-12 14:39:13 -07:00
Patrick Walton
6a6b688fa8 layout: Make inner scroll wrappers acquire the overflow region of their
contents.

Makes Twitter pages show up when scrolling, if WebRender is not in use.
WebRender does not yet support overflow:scroll.
2016-04-08 18:18:49 -07:00
Per Lundberg
96835c6d6f Renamed style structs.
The idea is to rename all style structs from Foo to ServoFoo, as described out in #10185.
2016-04-08 21:47:36 +03:00
bors-servo
bd2051d06a Auto merge of #10469 - mbrubeck:layout-misc, r=pcwalton
Some minor layout cleanups

* Prevent unnecessary copying in `strip_leading_whitespace_if_necessary`
* Remove unused argument to `adjust_clipping_region_for_children` (silences a compiler warning)

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/10469)
<!-- Reviewable:end -->
2016-04-08 10:10:11 +05:30
Matt Brubeck
cac06e579c Remove unused argument to adjust_clipping_region_for_children 2016-04-07 16:22:51 -07:00
Matt Brubeck
32aad0838e Draw insertion point even for empty input fields
This allows text layout to generate an empty text fragment if the fragment
contains the insertion point for a text input box.
2016-04-07 16:09:35 -07:00
Patrick Walton
1e884ddc69 layout: Allow non-absolutely-positioned elements with overflow: scroll
set to be scrolled.

This makes them establish stacking contexts, which is a CSS 2.1 spec
violation. However, we were already violating the spec here for
absolutely-positioned elements with `overflow: scroll`. It will probably
be easier to fix this spec violation once we either switch entirely to
WebRender or we have multiple layers per stacking context.

Closes #2742.
2016-04-06 17:58:47 -07:00
bors-servo
256b865055 Auto merge of #10407 - mauricioc:issue10403, r=bholley
Move some CSS properties to match Gecko's representation

Fixes #10403. Animation had an extra transition-delay property, which was also moved to Box. Let me know if I should squash the commits.

<!-- 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/10407)
<!-- Reviewable:end -->
2016-04-07 03:18:15 +05:30
Mauricio Collares
8c8090b5cd Move CSS text-shadow property from Effects to InheritedText 2016-04-05 00:21:46 -03:00
Mauricio Collares
4f0558e84f Move CSS image-rendering property from Effects to InheritedBox 2016-04-04 21:36:51 -03:00
Emilio Cobos Álvarez
92f39ea5cf Implement ::selection pseudo-element 2016-03-30 14:28:11 +02:00
Per Lundberg
4cb4cc93e4 Renamed TComputedValues to ComputedValues
This is a followup to #10210, and a continuation of #10185.
2016-03-29 23:30:13 +03:00
bors-servo
639fdd6b12 Auto merge of #10210 - perlun:rename-computedvalues-to-servocomputedvalues, r=SimonSapin
ComputedValues is now ServoComputedValues

This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.

<!-- 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/10210)
<!-- Reviewable:end -->
2016-03-29 18:25:40 +05:30
Paul Rouget
2bbf35f2aa Use black on blue color for default selection color 2016-03-28 18:26:17 +08:00
Paul Rouget
63a0851b94 Selection is blue on Windows and Mac, orange on Linux 2016-03-28 11:11:24 +02:00
Per Lundberg
c2ad084713 ComputedValues is now ServoComputedValues
This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.
2016-03-27 10:55:43 +03:00
bors-servo
bed91b3334 Auto merge of #10176 - mbrubeck:selection-range, r=pcwalton
Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

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/10176)
<!-- Reviewable:end -->
2016-03-26 08:16:20 +05:30
Matt Brubeck
08caf7412f Convert ScannedTextFragment fields into bitflags 2016-03-24 18:33:27 -07:00
Matt Brubeck
6171000875 Highlight selected text in input fields
Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
2016-03-24 18:33:26 -07:00
bors-servo
605842f193 Auto merge of #10155 - bholley:generalize_style_structs, r=SimonSapin
Generalize the style structs

This allows geckolib to pass gecko style structs and have the style system write to them directly, provided we implement all the traits.

<!-- 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/10155)
<!-- Reviewable:end -->
2016-03-25 03:27:33 +05:30
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
Emilio Cobos Álvarez
a02daf7144 canvas: Remove all the canvas layerization infrastructure
It was never complete, and with webrender as a backend the way we render
WebGL contexts has changed a bit.

This should remove quite a bit of overhead.
2016-03-23 18:12:37 +01:00
Patrick Walton
0006c1923a gfx: Allow images to be shipped to the WebRender thread without shipping
over the data as well.

WebRender doesn't need the data, as it acquires it separately.

About a 50%-100% improvement in display list building time on
browser.html.
2016-03-22 14:49:47 -07:00
Patrick Walton
28a71c4820 Make border radii clip their contents.
Needed for browser.html rounded corners.
2016-03-14 18:32:55 -07:00
Martin Robinson
474033c39f Simplify the display list slightly
Now that WebRender uses an Iframe display item, we do not need the Noop
item for the non-WebRender path. We can simply reuse the Iframe display
item. Also remove the layer_id member from the LayeredItem struct, as
it is unused.
2016-03-10 14:33:22 -08:00
Simon Sapin
142610265e Add the -servo-overflow-clip-box property. 2016-03-04 19:47:20 +01:00
Patrick Walton
117e92aefd layout: Minor whitespace cleanup. 2016-03-03 13:09:57 -08:00
Patrick Walton
d3d2dd05f2 layout: Switch display list building from bottom-up to top-down.
This eliminates a lot of allocations and O(n^2) behavior.
2016-03-03 13:09:56 -08:00
Patrick Walton
f4b95dd00b layout: Remove the validate_display_list_geometry debugging tool.
I don't think anyone was using it, and it's incompatible with taking
display lists out of flows.
2016-03-03 13:09:55 -08:00
Patrick Walton
72a52e23e0 layout: Don't call establishes_stacking_context() so much.
That function is expensive because it has to check a lot.
2016-03-03 13:09:54 -08:00