Commit graph

1803 commits

Author SHA1 Message Date
bors-servo
5e83b3f83b Auto merge of #12571 - servo:selectors-generic-atom_, r=bholley
Update to selectors 0.8.2 (generic over atoms)

This removes the `[replace]` override in geckolib and therefore unblocks https://github.com/servo/servo/pull/12391.

This includes the `gecko_string_cache` redesign discussed in https://github.com/servo/servo/pull/12548.

r? @bholley

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require new tests because refactor

<!-- 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/12571)
<!-- Reviewable:end -->
2016-08-09 12:02:55 -05:00
Simon Sapin
fdb2071b2d Update to selectors 0.8.2 2016-08-09 18:18:38 +02:00
bors-servo
2420dc4a3e Auto merge of #12760 - splav:inline_split_fixes#12699, r=notriddle
Inline split fixes#12699

<!-- Please describe your changes on the following line: -->
Fix fragment splitting algorithm to set FIRST/LAST_FRAGMENT_OF_ELEMENT flag correctly, account for border_padding for border_box and set zero border_padding between for new fragments.

---
<!-- 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 #12699 (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/12760)
<!-- Reviewable:end -->
2016-08-09 11:05:57 -05:00
Ravi Shankar
a04028eede Prefer length and percentage for word spacing 2016-08-09 17:53:40 +05:30
Alexandrov Sergey
0b68fb3cb5 reset border_padding between, account for border_padding in border_box and reset *_FRAGMENT_OF_ELEMENT flag for splitted fragments 2016-08-08 19:51:57 +03:00
Alexandrov Sergey
ba0a670876 reduce max_inline_size inside breaking strategy by border_padding 2016-08-08 19:45:32 +03:00
Pu Xingyu
2c2c60e44d layout: Freeze flex item properly
Fix the currently logic that a item will freeze if it should
grow(shrink) and its basesize is less(more) than its min(max) size. Also
fix the divide by zero error when an item should shrink but it has zero
length and zero min size.
2016-08-08 10:34:02 +08:00
bors-servo
414204c909 Auto merge of #12712 - servo:rustup, r=Ms2ger
Update Rust to 1.12.0-nightly (545a3a94f 2016-08-04)

<!-- 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/12712)
<!-- Reviewable:end -->
2016-08-05 07:46:27 -05:00
Anthony Ramine
f88302ebf3 Update Rust to 1.12.0-nightly (545a3a94f 2016-08-04) 2016-08-05 14:45:32 +02:00
bors-servo
0fc0db67c6 Auto merge of #12680 - Manishearth:basic-shape, r=SimonSapin
style: Add support for parsing and serialization of <basic-shape>s

Still WIP: I still need to use this somewhere and make serialization minimal. I'm not sure if I should do either in this PR.
The only other browser that handles basic shapes doesn't serialize correctly either (https://bugzilla.mozilla.org/show_bug.cgi?id=1290864), so that's not something we need to get done now.

As far as using this somewhere, I have the following options:

 - Merge this now, work on using it in stylo in a followup.
 - Just write extensive unit tests for parsing/serialization for now (stylo in a followup)
 - Use this for clip-path in stylo only (which I intend to do anyway, just not sure if I should do it in this PR)
 - Use this for clip-path in Servo (I'd rather not do this; this would be a huge change requiring a lot more layout knowledge than I currently have)

Thoughts? Review? @SimonSapin @bholley

<!-- 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/12680)
<!-- Reviewable:end -->
2016-08-05 06:27:24 -05:00
Emilio Cobos Álvarez
6d67525172
style: Refactor TRestyleDamage and TNode to accept/provide a "style source"
In the Gecko case, this style source would be the style context. In the servo
case, it will be always the computed values.

We could optimise this further in the case of stylo (from three FFI calls to
one) if we use an API of the form CalcAndStore(node, new_cv). But that would
imply borrowing the data twice from Servo (we also have borrow_data_unchecked
fwiw, but...).
2016-08-03 13:31:11 -07:00
bors-servo
15947f8f73 Auto merge of #12330 - stshine:flexitem, r=pcwalton
Implement flexible box layout for row container

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

This pull requests implements basic flexible box layout for row container.
It  has implemented most basic flexbox features, including grow, shrink, multi-line, *reverse properties, and alignment under `justify-content`, `align-items`, `align-self`, `align-content`.

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

r? @pcwalton

<!-- 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/12330)
<!-- Reviewable:end -->
2016-08-03 09:24:31 -05:00
Pu Xingyu
60e2f44a19 Add Minor fixes and tests 2016-08-03 21:10:35 +08:00
Glenn Watson
db8c3ef727 Update cargo.lock for wr2, pin ipc-channel. 2016-08-03 10:44:10 +02:00
Manish Goregaokar
44e33bcdc5
Move Position into its own values module 2016-08-02 15:57:23 +05:30
Ms2ger
247c86f887 Remove unused inline_size_of_preceding_{left,right}_floats fields from BlockFlow. 2016-08-01 13:56:24 +02:00
bors-servo
7f1ecddd31 Auto merge of #12667 - samlh:patch-1, r=emilio
Remove dead code from table_cell.rs

<!-- 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: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./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 no functional change

<!-- 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/12667)
<!-- Reviewable:end -->
2016-07-31 01:46:47 -05:00
Samuel Harrington
6c2faa2a20 Remove dead code from table_cell.rs 2016-07-30 23:33:31 -07:00
bors-servo
8a09a0369f Auto merge of #12642 - notriddle:textarea_height, r=asajeffrey
Use explicit height of inline-block fragments

When an explicit height is used for inline-block fragments, the line spacing algorithm should use that for the height above the baseline, instead of the intrinsic one.

---

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12492 (github issue number if applicable).
- [X] There are tests for these changes

<!-- 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/12642)
<!-- Reviewable:end -->
2016-07-29 13:53:13 -05:00
Cameron McCormack
baa339f4af Store UrlExtraData in {specified,computed}::Image::Url. 2016-07-29 14:22:35 +08:00
Michael Howell
afbd047695 Use explicit height of inline-block fragments
Fixes #12492
2016-07-28 16:04:53 -07:00
bors-servo
944d371b8f Auto merge of #12563 - emilio:stylo, r=bholley,jdm,pcwalton
stylo: Improve restyling performance

This commit adds hooks to the Servo style traversal to avoid traversing all the
DOM for every restyle. Additionally it changes the behavior of the dirty flag to
be propagated top down, to prevent extra overhead when an element is dirtied.

This commit doesn't aim to change the behavior on Servo just yet, since Servo does extra job when dirtying the node related with DOM revision counters that might be necessary.

CC @asajeffrey for the DOM revision counters stuff. When a node is dirty, do all its descendants really need to increment the revision counter, or is this an unintended effect? My intuition is that this is hurting performance quite a lot for servo.

r? @bholley

<!-- 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] These changes do not require tests because no geckolib tests 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/12563)
<!-- Reviewable:end -->
2016-07-27 17:56:26 -05:00
bors-servo
b374582e23 Auto merge of #12593 - adamncasey:table-row-cell-height, r=pcwalton
Fix table vertical alignment (middle, bottom)

<!-- Please describe your changes on the following line: -->
Fixes table cell vertical alignment (middle, bottom, not yet baseline) when the row contains cells of differing heights.

Moved the work done earlier by @notriddle into a separate public function on TableCellFlow. This function is then called by TableRowFlow once the cell's block size has been calculator.

---

<!-- 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 #12531 (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/12593)
<!-- Reviewable:end -->
2016-07-26 20:17:02 -05:00
Eduard Burtescu
3d8eab424c Update Rust to 1.12.0-nightly (9316ae515 2016-07-24) 2016-07-26 19:35:51 +02: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
Adam Casey
b1debc40be Fix table vertical alignment (middle, bottom, not yet baseline) with differing height cells
Includes reftest for this behaviour
Patch fixes margin-collapse-clear-002,3,8,9
2016-07-26 13:05:10 +01:00
Emilio Cobos Álvarez
d81fe27b11
style: Avoid propagating the restyle flag all through the dom when a node gets dirty.
This puts us in pair with stylo.
2016-07-25 10:50:04 -07:00
Pu Xingyu
62dd3f4df4 Refator 'box-sizing' calculation into a method
The 'box_sizing_boundary()' method return the border_padding width in
certain direction if fragment has property 'box-sizing: border-box'. The
'border_padding' field should be initialized before.
2016-07-25 20:59:04 +08:00
Pu Xingyu
7df5974456 Rename enum 'Mode' to 'Direction'
Rename the 'Mode' enum to 'Direction' and move it to 'model.rs', thus it
can be used to indicate logical direction.
2016-07-24 14:58:02 +08:00
Pu Xingyu
a70d2bbed8 Flex elements in a row flex container
Iterate over the items, create lines from them, resolve flex lengths
against them, set their inline size and margin lengths, and align them
according to 'justify-content', 'align-content' and 'align-self'.
2016-07-23 01:07:22 +08:00
Pu Xingyu
bc8d22a5e7 Make the width of block customizable by its parent
Add a 'IS_FLEX' flag to bitflags of block flow, and when it is set, the
block will use the inline size and margins set by its parent.
2016-07-22 16:06:59 +08:00
Pu Xingyu
05cf52cb0b Filter abs-pos children and sort by 'order' field
As the flexbox spec change in May 2016, the absolutely positioned
children painting order no longer follow the `order` property, thus we
can simply filter them out.

Also sort items by the order field of 'FlexItem', no longer do two
vtable lookups in each compare.
2016-07-22 16:06:59 +08:00
Pu Xingyu
196d19a311 Add 'get_flex_line()' method to flex flow
The method returns 'Option<FlexLine>', can be used to obtain a line in
flex container.
2016-07-22 16:06:59 +08:00
Pu Xingyu
87a041d416 Add FlexLine and its method for flex resolving
Add the 'FlexLine' struct to represent a line in flex container, and the
'flex_resolve()' method for flex lengths resolving.
2016-07-22 16:06:59 +08:00
Pu Xingyu
bf5805f2a6 Add flags 'is_wrappable' and 'cross_reverse'
These 'is_wrappable' flag can be used to determine if a flex flow can be
multi-line. The 'is_reverse' flag is replaced by 'main_reverse' and
'cross_reverse' since flex flow can go reverse individually in main and
cross direction.
2016-07-22 16:06:59 +08:00
Pu Xingyu
5da880e2c2 Extend fields of FlexItem and add methods
Extend fields of `FlexItem` struct with values that are necessary to
resolve flexible lengths, and the 'order' property. Add other methods
for size computing to make the code more modular.
2016-07-22 16:06:14 +08:00
Emilio Cobos Álvarez
0b67b218d0
style: Add a new Timer structure to the shared style context, and basic infrastructure for controlling animations. 2016-07-20 09:05:53 -07:00
Simon Sapin
6d0e48f6cc Remove some type aliases that are now just re-exports. 2016-07-20 08:42:47 +02:00
Simon Sapin
5c70dfab01 Have a concrete SelectorImpl type everywhere in the style crate.
It is conditionally compiled to one implementation or the other
(Gecko or Servo) with `#[cfg(…)]`.
2016-07-20 08:42:46 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Alan Jeffrey
62e95c5a61 All our Cargo.toml files should contain an MPL-2.0 license field. 2016-07-14 10:26:34 -05:00
bors-servo
9b01a4cc97 Auto merge of #12382 - stshine:anonymous-block, r=SimonSapin
layout: Clear non-inherited properties on anonymous block

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

This is one of my pull requests that imlement basic flexible box layout.
This pull request adds a `modify_style_for_anonymous_flow()` function to use initial values for non-inherited properties and parent values for inherited properties as the flow style. It also set border and outline to zero and set the display property from the parameter. This function may also be reused to modify style of anonymous table object in the future.
Part of code comes from `cascade_anonymous()` from @SimonSapin .

---
<!-- 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 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/12382)
<!-- Reviewable:end -->
2016-07-11 16:19:52 -07: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
bors-servo
27542e4165 Auto merge of #12371 - stshine:flex-block-flow, r=notriddle
Treat flex flow as block in float calculation

<!-- Please describe your changes on the following line: -->
This is on of my pull requests that implement basic flexible box layout.
Currently call `is_block_like()` on flex flow returns false. This would fix some errors in tests, for example 'flexbox-justify-content-horiz-001b.htm'.

---
<!-- 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 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/12371)
<!-- Reviewable:end -->
2016-07-11 09:31:03 -07:00
Ms2ger
9f13278b77 Move arc_ptr_eq to style. 2016-07-11 12:13:12 +02:00
Emilio Cobos Álvarez
383ba964ab
layout: text: Don't consider the REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES if the fragment can wrap text.
This was making us fall in a loop where the start split was empty, but we didn't
ignore it because the current fragment had this flag, but then we treated it
differently depending on the white_space property.

Not totally sure this is the proper fix, but it makes sense to me. In case it
is:

Fixes #12369.
2016-07-10 15:34:57 -07:00
Pu Xingyu
2aeed833e6 Treat flex flow as block in float calculation 2016-07-10 16:34:12 +08:00
Michael Howell
c11f85947e Correct negative margins in centered table cells
Fixes @AelitaBot queue viewer page
2016-07-06 10:02:33 -07:00
bors-servo
b577d66ec3 Auto merge of #12233 - KiChjang:underline-color, r=emilio
Make text decorations have the same color as the text if no shadows are present

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because according to @SimonSapin, making reftests against underlines are impossible

<!-- 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/12233)
<!-- Reviewable:end -->
2016-07-06 01:05:13 -07:00