Commit graph

250 commits

Author SHA1 Message Date
Thiago Pontes
206f4ea5b8 use Either type for UrlOrNone
fix test-tidy errors

fix style unit test

use the Parse trait instead of ParseWithContext

fix stylo test and geckolib build

move all specified url parse code to parse trait and remove refs to unused type
2016-11-30 11:43:14 -05:00
Bobby Holley
992f7dddf4 Bug 1317016 - Basic infrastructure for RestyleHint-driven traversal.
MozReview-Commit-ID: 7wH5XcILVmX
2016-11-24 17:07:38 -08:00
Simon Sapin
b203ab2419 Rename selector_impl.rs to selector_parser.rs
This makes it consistent with an upcoming update of the selectors crate.
2016-11-20 15:30:37 +01:00
Simon Sapin
08066800cd Rename selector_matching.rs to stylist.rs 2016-11-20 15:29:09 +01:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
bors-servo
d16f312464 Auto merge of #14136 - stshine:orthogonal-symmetry, r=SimonSapin
style: Add a "start_end()" method to LogicalMargin

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

Add a `LogicalMargin::start_end()` method that receives a `Direction' parameter. This is useful for some layout that is symmetric in inline and block directions, like flexbox.

Part of #14123.

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

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

r? @SimonSapin

<!-- 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/14136)
<!-- Reviewable:end -->
2016-11-10 11:53:05 -06:00
Emilio Cobos Álvarez
5f2e7af864
style: Centralize specified url value handling, and refcount urls. 2016-11-10 13:15:21 +01:00
Pu Xingyu
eb22d33d4e style: Add a "start_end()" method to LogicalMargin
Add a `LogicalMargin::start_end()` method that receives a `Direction'
parameter. This is useful for some layout that is symmetric in inline
and block directions, like flexbox.
2016-11-10 19:17:29 +08:00
bors-servo
959dfe4a4f Auto merge of #14035 - Permutatrix:iss-14030, r=emilio
Don't mark the first/last fragment of an {ib} split as FIRST/LAST_FRAGMENT_OF_ELEMENT.

<!-- Please describe your changes on the following line: -->
This change allows inline margins, borders, and padding to interact correctly with {ib} splits.

---
<!-- 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 #14030
- [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/14035)
<!-- Reviewable:end -->
2016-11-09 19:08:52 -06:00
Pu Xingyu
7f721e1f2c layout: Mark flex items properly during construction
Set the flag of the fragment of children in a flex container according
to the direction of the container. The mark is done on the fragment
because flex item enstablish a stacking context when its z-index is
non-zero ,despite its `position' property.
2016-11-09 08:24:12 +08: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
Permutator
0db5c557f2
Elaborated on enclosing_node in comment, moved existing comments around 2016-11-06 23:34:02 -08: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
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Permutator
fec3a49d43
Don't mark start/end of {ib} split as FIRST/LAST_FRAGMENT_OF_ELEMENT 2016-11-02 20:13:40 -07:00
Daan Sprenkels
66059904b7 Remove extra spaces in function calls and declarations 2016-10-31 18:11:37 +01:00
Bobby Holley
46e29184bd Move core pseudo-element handling to ThreadSafeLayoutElement. 2016-10-28 10:47:57 -07:00
Bobby Holley
97fd61f512 Eliminate untraversed node types from LayoutNodeType.
MozReview-Commit-ID: 926ReI1BSsf
2016-10-27 09:15:33 -07:00
Patrick Walton
ba005a93b8 layout: Minor style cleanup. 2016-10-26 14:14:16 -07:00
Patrick Walton
a1bbc5d5fd layout: Use the new style_for_anonymous_box() function for the
anonymous text child of `<input>`.
2016-10-26 14:14:10 -07:00
Patrick Walton
a7f64f3d33 layout: Remove the old anonymous table object generation code. 2016-10-26 14:14:06 -07:00
Patrick Walton
bc2f5864bc layout: Rewrite the anonymous table object generation code.
This patch introduces a "legalizer", which encapsulates all the
anonymous flow generation logic in one place. The legalizer knows how
to, for example, place adjacent blocks with `display: table-cell` in the
same table row.

Improves etsy.com.

Closes #13782.
2016-10-26 14:14:05 -07:00
Patrick Walton
be252371ea layout: Refactor Flow::from_fragment-style constructors to be
consistent.
2016-10-26 14:04:08 -07:00
Cameron McCormack
47b4648e62 Make list-style-image use UrlOrNone.
MozReview-Commit-ID: 6E82Tq5nrfC
2016-10-16 11:32:57 +08:00
Patrick Walton
773614f84c layout: Rewrite Servo's vertical-align support to match CSS 2.1 §
10.8, and implement `vertical-align: middle` per CSS 2.1 § 10.8.1.

`InlineMetrics` has been split into `InlineMetrics` for fragments and
`LineMetrics` for lines. Both structures' fields have been renamed in
order to more clearly delineate the difference between *space* and
*content*. Vertical positioning of fragments has been reworked to take
margins and borders into account only for replaced content.

This patch fixes the `vertical_align_super_a.html` reftest. Servo now
matches the rendering that Gecko and WebKit produce.

Additionally, this includes a test for the popular inline-block
centering technique described here:
https://s.codepen.io/shshaw/fullpage/gEiDt?#Inline-Block
2016-10-11 12:47:50 -07:00
Bobby Holley
c72fffa8f8 Move children_to_process to layout.
We don't need this for Gecko, and it's hard to implement in that case because
there's nowhere obvious to put it (we don't plan to create TSDs for non-dirty
nodes, and non-dirty nodes can have dirty children which require the
children_to_process atomic). There are various solutions here, but punting is
the easiest.

We'll need to rethink this if/when we need to do a bottom-up traversal for
Gecko.
2016-10-08 18:20:45 -07:00
Alexandrov Sergey
14934a42d7 add SVG fragment (SpecificFragmentInfo::Svg) 2016-10-07 21:41:02 +03:00
Bobby Holley
687e1f701c Rename PrivateStyleData to PersistentStyleData and use AtomicRefCell instead of RefCell as a container.
This allows us to eliminate the unsafe borrows. \o/

MozReview-Commit-ID: 29hpGaWUFQz
2016-10-02 19:19:52 -07:00
Bobby Holley
5bcc4192bf Stop using Ref::map for selected_style and resolved_style.
Same concept as the previous patch.

MozReview-Commit-ID: RFC8s7qQPM
2016-10-02 19:19:52 -07:00
Bobby Holley
18d552a1e9 Stop using Ref::map for style().
It's not possible to implement a Ref::map equivalent method on AtomicRefCell
while having AtomicRefCell implemented on top of RwArc. We could potentially
reimplement AtomicRefCell to be more like RefCell and add a Ref::map equivalent
method, but I (and pcwalton) think we should try just cloning a few extra
Arcs at these callsites instead.

MozReview-Commit-ID: 6H8vAWguO3z
2016-10-02 19:19:52 -07:00
Jonathan Schuster
8500f3c8b8 Style input-text pseudo with user-agent CSS 2016-09-21 21:21:32 -04:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
bors-servo
6191748907 Auto merge of #13012 - servo:shared-layout-context, r=nox
Stop creating a LayoutContext in build_display_list_for_subtree.

<!-- 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/13012)
<!-- Reviewable:end -->
2016-08-24 09:38:31 -05:00
Ms2ger
938569e3c7 Pass SharedLayoutContext to ImageFragmentInfo::new. 2016-08-23 17:32:06 +02:00
Ms2ger
7524e5549f Pass SharedStyleContext to CanvasFragmentInfo::new. 2016-08-23 17:13:11 +02:00
Alexandrov Sergey
3e73475d5b set HAS_NEWLY_CONSTRUCTED_FLOW flag for reconstructed flow'less inline element 2016-08-23 01:45:11 +03:00
Alexandrov Sergey
69769e4493 do not reset pseudo elements style 2016-08-11 10:11:11 +03:00
Emilio Cobos Álvarez
17772d1618
layout: Fix servo layout to take into account possibly unstyled child nodes in the display: none case. 2016-08-10 18:26:22 -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
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
bors-servo
dcc4697dde Auto merge of #11930 - nox:die-util-die, r=SimonSapin
Remove some util stuff

<!-- 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/11930)
<!-- Reviewable:end -->
2016-06-29 15:37:42 -05:00
Anthony Ramine
3041084176 Move util::linked_list to layout 2016-06-29 17:23:04 +02:00
Michael Howell
0dc64daed9 Clean up unnecessary code noise 2016-06-28 15:20:48 -07:00
Ms2ger
2c50318ee7 Move is_image_data to script_layout_interface. 2016-06-20 19:08:11 +02:00
Ms2ger
0d0b268138 Move LayoutNode and related traits to script_layout_interface. 2016-06-20 19:07:54 +02:00
Ms2ger
6b847eb93a Introduce LayoutNodeType and LayoutElementType enums. 2016-06-20 19:02:49 +02:00
Ms2ger
afc7118a67 Introduce a ThreadSafeLayoutNodeHelpers trait for methods to stay in layout. 2016-06-20 19:02:48 +02:00
Ms2ger
5c03dd8eb1 Introduce a script_layout_interface crate and move RestyleDamage to it. 2016-06-20 19:02:36 +02:00
Maciej Skrzypkowski
27b05c58f6 Small performance improvement
node.selection() is not used text_content is equal to 
TextContent::GeneratedContent(content_items)
2016-06-16 08:58:03 +02:00
Ms2ger
6a1722e18d Make layout only depend on script::layout_interface. 2016-06-07 13:46:49 +02:00