Commit graph

66 commits

Author SHA1 Message Date
Simon Sapin
84fed1a62f Add missing try!() around write!()
Fixes "unused result" warning.
2016-08-18 15:43:09 +02:00
David Raifaizen
3831c0650c Adding support for correct shorthand serialization 2016-08-16 22:28:51 -04:00
Emilio Cobos Álvarez
9e88a495c8
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units. 2016-08-16 10:58:16 -07:00
Michael Howell
ad4b9aab45 Rebuild the writing_mode with cached style reuse
Fixes #11818
2016-08-12 15:24:56 -07:00
Manish Goregaokar
d1e45f78af
Add serialize_four_sides, use for serializing BorderRadius 2016-08-02 19:22:03 +05:30
Manish Goregaokar
2580c1dc6e
Add InsetRect, move BorderRadius to basic_shape.rs 2016-08-02 15:57:20 +05:30
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
4b7060554b Rename ComputedValuesStruct to ComputedValues.
Doing this in a separate commit avoids mixups
with the ComputedValues trait that the previous commit removed.
2016-07-20 08:42:45 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
bors-servo
d28f2b8904 Auto merge of #12361 - stshine:blockify-flex-item, r=pcwalton
Blockify elements in a flex container

<!-- Please describe your changes on the following line: -->
The is one of my pull requests that implement basic flexible box layout.
As the spec stated in https://drafts.csswg.org/css-flexbox/#flex-items ,
A inline-level child of a flex container should be converted to its block equivalent, according to CSS2.1 § 9.7.

---
<!-- 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 flexbox is not actually implemented yet.

<!-- 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/12361)
<!-- Reviewable:end -->
2016-07-18 11:21:04 -07:00
Shing Lyu
f754cacbd5 Only restyle viewport-relative nodes on viewport size change 2016-07-18 11:01:42 +08:00
Pu Xingyu
d40e6c5738 Clear non-inherited properties on anonymous block
Add a modify_style_for_anonymous_flow() function to use initial values
for non-inherited properties and parent values for inherited properties
as the block style. It also set border and outline to zero and set the
display property from the parameter.
2016-07-12 07:17:31 +08:00
Pu Xingyu
6d0756512d Blockify elements in a flex container
A inline-level child of a flex container should be converted to its
block equivalent. according to CSS2.1 § 9.7.
2016-07-12 07:13:25 +08:00
bors-servo
0d76cf8e5c Auto merge of #11948 - stshine:flex-shorthand-properties, r=emilio
Support 'flex' and 'flex-flow' shorthand properties

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

Support the `flex` and `flex-flow` shorthand properties in
servo. Currently they are marked as experimental, so they are added to
`__dir__.ini`.
Thanks SimonSapin and jdm for help :)

---
<!-- 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] 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11948)
<!-- Reviewable:end -->
2016-07-05 20:08:07 -07:00
Cameron McCormack
fd09035c65 Disable align-items in geckolib. 2016-07-05 17:34:57 -07:00
bors-servo
b0a8ce5341 Auto merge of #12178 - frewsxcv:prefs, r=emilio
Refactor `util::prefs` operations to be methods on static struct.

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

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12178)
<!-- Reviewable:end -->
2016-07-03 08:19:04 -07:00
Corey Farwell
22928f50ac Refactor util::prefs operations to be methods on static struct. 2016-07-02 16:43:39 -04:00
Emilio Cobos Álvarez
30963dd74d
style: remove is_servo(), as_servo() and as_servo_mut()
This commit adds a need_index prop to the style system, and autogenerates
iterators, and a get_xxx_mod(i) function from a get_xxx_prop() and
get_xxx_at(index) functions.

This allows us to (finally!) take rid of the as_servo() hack. There are a few
unimplemented clones, but I'm just too lazy for that right now.
2016-07-01 14:22:53 -07:00
Emilio Cobos Álvarez
ba53c4ea8d
style: Add a generic way to deal with lists of values, ditch all uses of as_servo in style/animations.rs 2016-07-01 14:22:52 -07:00
Emilio Cobos Álvarez
07da4e4ea2
style: Simplify generation of need_clone methods in servo 2016-07-01 10:03:02 -07:00
Emilio Cobos Álvarez
bc4e670c5a
style: Add a temporary workaround for geckolib animations.
With needs_borrow we will be able to remove this, though we'll have to implement
clone_ and borrow_ methods for a bunch of properties.
2016-07-01 10:02:14 -07:00
Emilio Cobos Álvarez
2faaf952c7
style: Make CASCADE_PROPERTY a real static array.
Why wasn't this done before?
2016-06-30 13:27:33 -07:00
Pu Xingyu
7badba01ea Support flexbox shorthand properties
Support the `flex` and `flex-flow` shorthand properties in
servo. Currently they are marked as experimental, so they are added to
'__dir__.ini'.

Thanks SimonSapin and jdm for help :)
2016-06-30 12:56:25 +08:00
Emilio Cobos Álvarez
2d566ef0ef
style: Fix parsing and add generated keyframes 2016-06-28 15:20:59 +00:00
Emilio Cobos Álvarez
9cf2e52d36
tidy: Clean up warnings and tidy lints. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
18f09289ce
style: Inline a few functions that are just another function call 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
6a362ae8e8
style: Refactor all the animated properties to use the style system properly 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
60192bb830
style: Refactor to pass animations cleanly, land animation-name parsing as experimental 2016-06-28 15:09:53 +00:00
Simon Sapin
f3d6859ab7 Replace usage of std::intrinsics::discriminant_value in properties.mako.rs 2016-06-28 06:46:40 +02:00
Ms2ger
f82cf3da12 Merge AuExtensionMethods and LocalToCss. 2016-06-23 15:39:56 +02:00
Simon Sapin
00b6210519 Make the style crate almost build on stable Rust.
`discriminant_value` will need to be replaced with something else later.
2016-06-22 15:44:13 +02:00
Simon Sapin
ea73c8efac Make it possible to build the style_traits crate with a stable compiler.
Testing this on CI to make sure we don’t regress it is blocked on #11806
2016-06-22 15:40:53 +02:00
bors-servo
f0b3d1e77d Auto merge of #11417 - stshine:flex-longhand-properties, r=mbrubeck
Support remaining longhand flexbox style properties for servo

- [x] `./mach build -d` does not report any errors
- [X] `./mach test-tidy --faster` does not report any errors
- [X] There are tests for these changes

Add the remaining longhand CSS properties of flexbox for servo,
including `flex-wrap`, `flex-grow`, `flex-shrink`, `justify-content`,
`align-items`, `align-self` and `align-content`.

Tests for the remaining longhand properties are also enabled. Test for
default value of `align-self` is modified because the new default value
for this property is "auto" is current flexbox CR.

<!-- 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/11417)
<!-- Reviewable:end -->
2016-05-31 21:44:06 -05:00
Pu Xingyu
f4b8f9766c Fixup for align-self and tests
This is a fixup for `align-self`, the computed value of which should now
properly inherit `align-items` value of its parent. Additional passed
tests is also removed from ini folder. Fixup for geckolib errors.
2016-06-01 00:15:28 +08:00
bors-servo
73b4042bb3 Auto merge of #11412 - heycam:text-deco, r=mbrubeck
Support remaining text-decoration related properties in geckolib

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 --faster` 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 mostly it's geckolib-only, and the servo-relevant changes should be covered by existing tests

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

----

Not sure if there's a better way to do the loop in the text-decoration(-line) longhand parsing, having all of the guts in the loop condition is a bit awkward.

r? @mbrubeck

<!-- 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/11412)
<!-- Reviewable:end -->
2016-05-25 20:35:50 -05:00
Cameron McCormack
0580e1854e Support text-decoration-line and the text-decoration shorthand in geckolib. 2016-05-26 11:06:37 +10:00
David Raifaizen
f6bbeae67f Removing unnecessary field from serialization css enum 2016-05-25 09:25:36 +02:00
David Raifaizen
3dafd558c5 Changing update_inline_style to process multiple declarations at once to handle shorthand serialization better 2016-05-25 09:25:35 +02:00
David Raifaizen
f38607967e Fixing python to_css codegen error 2016-05-25 09:25:34 +02:00
Simon Sapin
dc829da07e Less cloning and dynamic dispatch. 2016-05-25 09:25:33 +02:00
David Raifaizen
7d7aac212b Shorthand serialization now takes iterators instead of array slice as argument 2016-05-25 09:25:32 +02:00
David Raifaizen
be2f70393f Adding more efficient way of determining if PropertyDeclaration is important 2016-05-25 09:25:31 +02:00
David Raifaizen
51e642e875 Converted serialization methods to implement the to_css trait, writing to string buffers to save string allocations for every result 2016-05-25 09:25:29 +02:00
David Raifaizen
0985d7563f Making fixes based on suggestions from nox and SimonSapin 2016-05-25 09:24:10 +02:00
David Raifaizen
feff32c4ab For Shorthand impl, added to_name method and copied serialize_shorthand
from cssstyledeclaration.rs file

For PropertyDeclaration impl, added shorthands method to get the shorthands associated
with the current longhand

For PropertyDeclarationBlock impl, added serialize algorithm
2016-05-25 09:24:04 +02:00
Cameron McCormack
bb85f5faf0 Add an extra data field to ParserContext.
This will be used for passing Gecko-specific information through
the CSS parser in stylo.
2016-05-24 12:12:10 +10:00
Bobby Holley
b521c293dc Add string_cache override for geckolib based on gecko atoms.
The work in these patches is based on Ms2ger's gecko-atom crate.
2016-05-18 11:33:38 -07:00
bors-servo
2c674d0397 Auto merge of #11192 - perlun:remove-unused-imports, r=Manishearth
Removed unused imports

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #11185
- [X] These changes do not require tests because it only removes dead code.

----

This fixes #11185.

<!-- 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/11192)
<!-- Reviewable:end -->
2016-05-15 15:41:16 -07:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00