and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
Source-Repo: https://github.com/servo/servo
Source-Revision: 0d6d6a05009606dfbbfc9765d7dc2c745c18f6a5
Several issues are addressed in this commit:
* Inline flows now bubble up their absolute descendants instead of
making the inline flow the containing block for them. (In the future,
we will need to make the inline flow *sometimes* be the containing
block for them, but for now it improves sites to unconditionally
bubble up.)
* Fragments now look at their inline fragment context to determine
whether they are positioned.
* Inline flows now push the stacking-relative position of the absolute
containing block down to their inline-block fragments.
* Inline absolute hypothetical fragments can be containing blocks.
* Fixes the logic in
`containing_block_range_for_flow_surrounding_fragment_at_index`. The
condition to determine whether fragments are positioned was inverted!
* `Descendants`/`AbsDescendants` has been refactored in order to become
more friendly to inline absolute containing blocks in the future.
Improves the inline position of the green drop-down arrow in the Google
SERPs. (The block position is still wrong.)
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: d654841288ad6c7d4f8d7da3c68d04ef7df2c241
There were two bugs here: (1) relative position applied to
scanned/unscanned text fragments independently of the container element
that applied that relative position, causing double-counting; (2)
relative position applied to inline block fragments independently of the
wrapped block itself, causing double-counting.
Closes#7067.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 0bfde427e6a77d09d75b5a6e228c7b25f063395f
This patch makes Servo unconditionally strip whitespace before text run
scanning (assuming that the `white-space` property allows it). Whitespace
stripping during reflow is now only used for handling whitespace at the ends of
lines; reflow now never attempts to handle ignorable whitespace.
Many CSS tests pass now. There are some new failures, however.
The following reference tests now fail due to a pre-existing bug whereby
whitespace is used to calculate the position of inline hypothetical boxes for
elements with `display: inline; position: absolute`:
* `absolute-replaced-height-036.htm`
* `vertical-align-sub-001.htm`
* `vertical-align-super-001.htm`
The following reference tests fail due to a pre-existing bug whereby we don't
handle `font-size: 0` properly in inline reflow:
* `font-size-zero-1.htm`
* `font-size-zero-2.htm`
The following reference test fails due to the fact that it relied on our
incorrect insertion of whitespace to make room for the black background:
* `inline-formatting-context-007.htm`
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 7dc83e7820df43b1b617ae8dcf661398b0bd0842
The failing `float-applies-to-*` CSS 2.1 tests never really should have
been passing in the first place; they depend on floats inside
fixed-layout tables working properly, which they don't.
Closes#6078.
Closes#6709.
Closes#6858.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 1ddef2997abf51716835017225b282f8a9077cce
Fixes jumpiness on many pages; e.g. the WPT results pages.
For some reason, this would not reproduce with an automated test.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 94cd76df61c1ea14199c9683603b548377aced3b
It's not quite done but can probably be reviewed anyway.
I still need to finish up a few of the ToCss impls, I just got lazy and wanted to make sure things worked.
The computation of the used values is definitely not right, I'm going to investigate that.
Source-Repo: https://github.com/servo/servo
Source-Revision: acbca7b3aaf18866f7a1a79d9684149897bf4305
Fixes jumpiness on lots of Web sites.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: bbcd42773342a587a8515f34bdc3ca69a380c0a8
I wrote this patch that makes the test from #6542 render as expected but I am not confident it is actually the right fix. Should the padding be included in the 'ascent' metric for images, or am I just introducing a bug that happens to offset the one I'm trying to fix?
Source-Repo: https://github.com/servo/servo
Source-Revision: 0688488a7fd3caee423968b33d6c19d79f94d29a
`LOCAL_CONTEXT_KEY` is currently a `Cell<*mut LocalLayoutContext>`. The use
of the raw pointer means that the `LocalLayoutContext` is not dropped when
the thread dies; this leaks FreeType instances and probably other
things. There are also some unsafe getter functions in `LayoutContext`
(`font_context`, `applicable_declarations_cache` and
`style_sharing_candidate_cache`) that @eddyb says involve undefined
behaviour.
This changeset changes `LOCAL_CONTEXT_KEY` to
`RefCell<Option<Rc<LocalLayoutContext>>>`. This fixes the leak and also
results in safe getters.
(Fixes #6282.)
Source-Repo: https://github.com/servo/servo
Source-Revision: 0dec64caf01c98d10e72b73e35b994127c23e81f
Part of #6224
I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`
Source-Repo: https://github.com/servo/servo
Source-Revision: f6fe1953343a417b62fb310a380af7c6973849b0
* Stop double-counting border and padding for inline-block fragments.
(Test case: `inline_block_border_intrinsic_size_a.html`.)
* Take clearance into account when determining intrinsic widths of
blocks containing floats.
Improves the Amazon headers.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 7b87085c1880c60aa3be5b3ec4572a0d93fd5537
* Fix queries involving stacking contexts
* The code was double accumulating stacking context origins.
* Handle queries of inline elements.
* The node addresses being compared were incorrect (CharacterData vs. Span)
* Handle ScriptQuery reflows correctly.
* The layout task was skipping the compute absolute positions traversal, so failed before window.onload.
Source-Repo: https://github.com/servo/servo
Source-Revision: 5f6a740190e1e5912d84162c92c6b79365df165a
NodeTypeId is supposed to reflect the WebIDL inheritance hierarchy.
All of Text/ProcessingInstruction/Comment inherit from CharacterData,
which inherits from Node. There should be a CharacterDataTypeId value
that differentiates between those, instead.
r? @jdm
cc @yichoi
Source-Repo: https://github.com/servo/servo
Source-Revision: 5b0c6c9d31973aabdb820f16237e1a7c2a6524ad
This add some properties to the style system and a new flow type, but the larger issues of dealing with fragmentation in the flow tree is still an open question.
Source-Repo: https://github.com/servo/servo
Source-Revision: 1e150140bd12624ad357e3168fb496079fb8ec7c
--HG--
rename : servo/components/layout/table_caption.rs => servo/components/layout/multicol.rs
* Simpler image cache API for clients to use.
* Significantly fewer threads.
* One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
* 4 threads for decoder worker tasks.
* Removed ReflowEvent hacks in script and layout tasks.
* Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
* Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
* Add reflow batching for when multiple images load quickly.
* Reduces the number of paints loading wikipedia from ~95 to ~35.
* Reasonably simple to add proper prefetch support in a follow up PR.
* Async loaded images always construct Image fragments now, instead of generic.
* Image fragments support the image not being present.
* Simpler implementation of synchronous image loading for reftests.
* Removed image holder.
* image.onload support.
* image NaturalWidth and NaturalHeight support.
* Updated WPT expectations.
Source-Repo: https://github.com/servo/servo
Source-Revision: ac0645c2363b5a6ea3930b0857b3a27f1b6d033f
This allows things like `<sup><span>Foo</span></sup>` to work and
improves Wikipedia.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: d7b6961104b517a22e01c192d4bb6a7ad5934ce8
Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)
Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
Reconstructed from #5138 via raw diffing.
r? @SimonSapin
Source-Repo: https://github.com/servo/servo
Source-Revision: fd1bb49a65dd998c8ef9890a1576aaf62ddfdba1
Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)
Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
Moved from #4544, because Critic.
Fixes#4544.
Source-Repo: https://github.com/servo/servo
Source-Revision: 5cd6316addc1acf145ed3220719387ef6ef08d2f
Also introduce a clear() function to layout data which will be used to clear items such as compositor layouts.
Clear the layout data when a node becomes display:none.
Source-Repo: https://github.com/servo/servo
Source-Revision: 65454e51c806c7d91c869a7b4afce872b4eeea57
Inline fragments that are part of a text run don't have interior borders.
So don't draw interior borders or include them when calculating positioning.
Fixes https://github.com/servo/servo/issues/4658, where multiple text nodes that are adjacent have distinct borders.
r? @Ms2ger, @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: b2f099026a8c649daf063dc7e119a514c2680697
Prior to incremental layout, the code would remove the existing
construction result. However, with incremental layout the construction result
is cloned rather than removed. This change ensures that the previous
construction result is cleared when an element's display type
changes to none.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8ad3c5aeb65e473a4c099b12e9439dfc556024f8
Ready for review.
Final link step on android fails, but we know how to fix it and will add it to this branch soon.
Source-Repo: https://github.com/servo/servo
Source-Revision: 2cc08f289ab909de44fa09a07b2c43b70ce379b9
--HG--
rename : servo/ports/gonk/build.rs => servo/support/rust-task_info/build.rs
This patch also makes Servo not crash when
`generated_containing_block_rect()` is called on a list item (as, for
example, GitHub does), and for good measure I added the fix to other
flows as well.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 221a343883f510c7743908136438f5ed40bd17ed
Only the one-value syntax is supported for now.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: c8e68fa45c43856f7ffbdde25b6e68571ad288bf
Content of the canvas is drawn, tests/html/test_canvas.html now works.
Source-Repo: https://github.com/servo/servo
Source-Revision: da400a7a453eacf6f3089cc07e5dc61f385a0909
This was making `box-shadow` not show up in many cases, in particular,
but the effects were not limited to that.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 499d17f564d699e5e290e8a3859f64e7536827a7
`str::to_string()` goes through a `Formatter`, `str::into_string()` is a direct copy and is apparently 5× faster.
This is a rebase of the boring and bitrot-prone parts of #4366.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9857ea26cb9ee262654bee97322dbbf373486bff
`caption-side` is used by 4% of pages by number of loads.
r? @mbrubeck
Source-Repo: https://github.com/servo/servo
Source-Revision: 6eb9ae1eff2d26c52ad2ac59eec703bd7e8ae867
The exact rendering is ill-spec'd. Some things are ugly (especially the
width and height of list style images) but they are infrequently used
and I believe this implementation matches the spec. Numeric lists are
not supported yet, since they will require a separate layout pass.
The implementation is a subclass of `BlockFlow`, on advice from Robert
O'Callahan.
r? @SimonSapin
Source-Repo: https://github.com/servo/servo
Source-Revision: 112ef5c484e821aa4869aeaf12a12146f2424fe0
Fixes#3918
Can be tested in `tests/html/textarea.html`. Also implemented some content reflecting IDL attributes for HTMLTextAreaElement while I was in there.
There are some major problems with TextInput when Multiple is enabled that I haven't addressed here, but I'm prepared to open up a follow-up issue.
Source-Repo: https://github.com/servo/servo
Source-Revision: a369dcfa01f5ad7634469f3a3b652d7f650129a0
Attempt to solve #3690
I've re-rolled the changes from https://github.com/servo/servo/pull/2610, and then doen the necessary updates to get this to compile with the current snapshot of rust.
The documentation for values I've added in the bitflag are missing, because I don't know what is the appropriate text.
Source-Repo: https://github.com/servo/servo
Source-Revision: e13873bba1782580db4abe46e883b08da829cbb6
This is the last PR and most of the work for the maze solver and RoboHornet.
r? @glennw
cc @cgaebel
Source-Repo: https://github.com/servo/servo
Source-Revision: 035ff19e4a5995989c5fd34928af2a6690bb8062
These were showing up really high in the maze solver profile.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 9f248378f06d4de7c0df01b64e93edcc4de208cf
Avoids total reflow of the entire document on the maze solver.
I have tested Wikipedia reflow and it still works.
r? @cgaebel
Source-Repo: https://github.com/servo/servo
Source-Revision: c20bb66aef28e922c46aa69c9faaa94d83269e73
These should have no effect on functionality.
r? @metajack
Source-Repo: https://github.com/servo/servo
Source-Revision: 4bdd9a5ec02526b9a407b23dcbf95cc570e6fa56
This is a grab bag of performance improvements that significantly improve style recalculation, layout, and painting on a few static pages.
Let me know if you'd like me to split this PR up.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: 156ca98236a57ee52ff5b68741bc7783ba073612
This also enables incremental reflow by default. \o/
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: f6941b35e3b945f4a6dcd2cf03daa345ad2bcaed
This also adds some extra debugging infrastructure which I found useful tracking
this bug down. A regression in the br reftests is also uncovered by this patch,
which I'll work on fixing next.
EDIT: nevermind. no regression, I just tested that before a rebase.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: b86344b697f814b982e52f4a72c26d58c915c37b
This implements fragment merging, in order to incrementally reflow linebroken
text. This makes the `whitespace_pre.html` reftest pass with incremental reflow
turned on with `-i`.
Source-Repo: https://github.com/servo/servo
Source-Revision: f3066c70da80306f68833814025deb589d6eeb2a
This patch switches FlowRefs to using the Deref and DerefMut traits, instead of
the custom `get` and `get_mut` functions.
Source-Repo: https://github.com/servo/servo
Source-Revision: 6a11ee89de82abae9d6607a6c2890692df5259eb
This also hides the not-yet-working parts of incremental reflow behind a runtime
flag. As I get the failing reftests passing, I'll send pull requests for them one
by one.
Source-Repo: https://github.com/servo/servo
Source-Revision: 56989b8dec4aa95a3b484d45f15b23f9b3daaf13
http://dbaron.org/css/intrinsic/
Column spans are not yet supported.
This effectively adds support for percentage widths, and it also fixes
many bugs, improving the layout of Google and Wikipedia.
r? @SimonSapin
Source-Repo: https://github.com/servo/servo
Source-Revision: e2d7777c41135b71293c195d2a9d7a1bc2afd0ca
This implements a general framework for legacy presentational attributes
to the DOM and style calculation, so that adding more of them later will
be straightforward.
Source-Repo: https://github.com/servo/servo
Source-Revision: 0aeecfc41d5f0c637960fcddf87cc2db3e5efeea
75% improvement in style recalc for Guardians of the Galaxy.
Source-Repo: https://github.com/servo/servo
Source-Revision: 8077edc0622b04aeb26d42ced86ea285c9cac0e7
We push down clipping areas during absolute position calculation. This
makes display items into a flat list, improving cache locality. It
dramatically simplifies the code all around.
Because we need to push down clip rects even for absolutely-positioned
children of non-absolutely-positioned flows, this patch alters the
parallel traversal to compute absolute positions for
absolutely-positioned children at the same time it computes absolute
positions for other children. This doesn't seem to break anything either
in theory (since the overall order remains correct) or in practice. It
simplifies the parallel traversal code quite a bit.
See the relevant Gecko bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=615734
r? @mrobinson
Source-Repo: https://github.com/servo/servo
Source-Revision: fd70b366aeada7f8cb4b2457c04fd07f0ea9b143
This patch puts in the initial framework for incremental reflow. Nodes' styles
are no longer recalculated unless the node has changed.
I've been hacking on the general problem of incremental reflow for the past
couple weeks, and I've yet to get a full implementation that actually passes all
the reftests + wikipedia + cnn. Therefore, I'm going to try to land the different
parts of it one by one.
This patch only does incremental style recalc, without incremental flow
construction, inline-size bubbling, reflow, or display lists. Those will be coming
in that order as I finish them.
At least with this strategy, I can land a working version of incremental reflow,
even if not yet complete.
r? @pcwalton
Source-Repo: https://github.com/servo/servo
Source-Revision: 85b277655f07db1cb99c4d3dee93804735ed0470
Although the computed `display` property of elements with `position:
absolute` is `block`, `position: absolute; display: inline` can still
behave differently from `position: absolute; display: block`. This is
because the hypothetical box for `position: absolute` can be at the
position it would have been if it had `display: inline`. CSS 2.1 §
10.3.7 describes this case in a parenthetical:
"The static-position containing block is the containing block of a
hypothetical box that would have been the first box of the element if
its specified 'position' value had been 'static' and its specified
'float' had been 'none'. (Note that due to the rules in section 9.7 this
hypothetical calculation might require also assuming a different
computed value for 'display'.)"
To handle this, I had to change both style computation and layout. For
the former, I added an internal property
`-servo-display-for-hypothetical-box`, which stores the `display` value
supplied by the author, before the computed value is calculated. Flow
construction now uses this value.
As for layout, implementing the proper behavior is tricky because the
position of an inline fragment in the inline direction cannot be
determined until height assignment, which is a parallelism hazard
because in parallel layout widths are computed before heights. However,
in this particular case we can avoid the parallelism hazard because the
inline direction of a hypothetical box only affects the layout if an
absolutely-positioned element is unconstrained in the inline direction.
Therefore, we can just lay out such absolutely-positioned elements with
a bogus inline position and fix it up once the true inline position of
the hypothetical box is computed. The name for this fix-up process is
"late computation of inline position" (and the corresponding fix-up for
the block position is called "late computation of block position").
This improves the header on /r/rust.
r? @glennw
Source-Repo: https://github.com/servo/servo
Source-Revision: f7d2fb6ff86afff7a5b674f751af9370a5a6b142
So far the changes to layout seem fairly well-contained; I think this is worth integrating to give us a browser that is easier to dogfood (and allows us to work on things like form submission much easier), especially since the long-term viability of WebComponents-as-forms is not assured.
Source-Repo: https://github.com/servo/servo
Source-Revision: f80096069592b864221abe112eaf2ecb6c444fda