Commit graph

327 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2c88248b87
style: Kill -servo-under-display-none.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-17 04:31:15 +02:00
Boris Chiou
a949e2a057 Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
2017-09-13 18:05:14 +08:00
Martin Robinson
0a24c2f03c Use the is_absolute_containing_block method everywhere
This is a better approach than relying on
contains_positioned_fragments, because in the future other properties
will create absolute containing blocks.
2017-08-16 13:32:48 +02:00
Simon Sapin
b5a4b8d6a0 Upgrade to rustc 1.21.0-nightly (13d94d5fa 2017-08-10) 2017-08-15 14:10:44 +02:00
Boris Chiou
191c2a282b Bug 1374233 - Part 2: Add NonNegativeAu.
Add values::computed::NonNegativeAu, so BorderSideWith could be computed
to this non-negative Au, for the following properties:
1. outline-width
2. border-{*}-width
3. column-rule-width
4. -webkit-text-stroke-width

MozReview-Commit-ID: ASHaB2F7VtM
2017-08-04 14:21:57 +08:00
Michael Partheil
b07ebbae6b Replace all uses of the style::stylearc alias with servo_arc.
The alias is left there temporarilly and will be removed completely in a later commit where
also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still
use the old alias).
2017-07-19 09:29:05 +02:00
Manish Goregaokar
808b1f509b stylo: Use ComputedValuesInner instead of ComputedValues when we don't need it 2017-07-17 18:02:25 -07:00
Emilio Cobos Álvarez
deaa935f5b
layout: Stop doing unsafe transmutes between refcell references.
This commit splits the style and layout data in two separate refcells.

These transmutes have been a source of trouble (for example on Android), and
they feel like a hack anyway.

Fixes #16982
2017-05-25 10:31:40 +02:00
cku
f9b370719d Stylo: Pass style list's image_value to gecko. 2017-05-16 02:34:16 +08:00
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07:00
Pu Xingyu
951c050690 Use empty pseudo to cascade only inheritable properties for text
Since for nested inline elements non-inheritable properties are
properly stored in the inline context of an inline fragment, so get
rid of them on the style.
2017-04-01 14:05:11 +08:00
Pu Xingyu
1677d479f6 Use Servo-specific pseudo element for InlineAbsolute fragment 2017-03-31 02:45:09 +08:00
Pu Xingyu
836e554c30 Use Servo-specific pseudo element for InlineBlock fragment 2017-03-31 02:45:09 +08:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Emilio Cobos Álvarez
eaf27ccfa0
style: Kill SharedStyleContext::default_computed_values.
Now that cascade() gets a Device, we can use the default computed values from
there to avoid propagating that state all over the place.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-14 00:49:16 +01:00
Patrick Walton
198662f8cb layout: Replace ConstructionResult::swap_out() with get()
It only actually swaps out in nonincremental mode (which isn't suitable
for real world use), so the name is confusing.
2017-03-03 23:25:02 +01: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
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
Pu Xingyu
f07bfaa974 Remove redundant style_context() method of LayoutContext 2017-02-06 00:44:11 +08:00
bors-servo
c75946c3ed Auto merge of #14978 - shinglyu:inline-flex, r=notriddle
Implemented display: inline-flex

<!-- 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 #14685 (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/14978)
<!-- Reviewable:end -->
2017-01-22 19:57:49 -08:00
Shing Lyu
e31ee04dad Implemented display: inline-flex 2017-01-23 10:30:55 +08:00
Jure Podgoršek
bb91ca616c Tidy up rust code with regard to new rule (no = in beginning of line) 2017-01-06 20:57:16 +01:00
Boris Zbarsky
61f6025dc3 Bug 1298588 part 9, servo piece. Pass through useful default styles to cascade(). r=bholley 2017-01-04 23:13:46 -05:00
Boris Zbarsky
09c74190b9 Bug 1298588 part 8. Pass a SharedStyleContext, not a Stylist, to Legalizer methods. r=bholley 2017-01-04 23:13:45 -05:00
Michael Howell
7c7f76ca75 Fix an outdated comment 2016-12-23 17:23:12 +00:00
Alan Jeffrey
9be4fd56ce Removed util. 2016-12-14 18:04:37 -06:00
Pu Xingyu
07250a7d58 Remove unused replaced size calculation methods
Remove some fields and methods from SpecificFragmentInfo and change
some function signatures.
2016-12-12 18:10:36 +08:00
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