Commit graph

126 commits

Author SHA1 Message Date
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
Martin Robinson
ab4bd2a133 Remove DangerousThreadSafeLayoutNode
Remove this trait and replace it by two non-public functions on
ServoThreadSafeLayoutNode. This requires making the iterator not
generic, which simplifies things a little bit as well.
2023-05-12 08:18:31 +02:00
Oriol Brufau
ab2ba273e3 Simplify our setup for font metric queries from style
This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
2023-05-11 21:02:15 +02:00
Martin Robinson
2d31d4301d Eliminate duplicate Layout DOM wrappers
There are duplicate sets of Layout DOM wrappers: one for Layout 2013 and
one for Layout 2020. As part of cleaning up and simplifying the
wrappers, this change parameterizes them on the specific layout data
they contain. This allows them to be shared again. In addition, various
small cleanups are included.

Fixes #29691.
2023-05-05 17:16:38 +02:00
Martin Robinson
72302e2dae Detect body elements during layout
During layout it is often useful, for various specification reasons, to
know if an element is the `<body>` element of an `<html>` element root. There
are a couple places where a brittle heuristic is used to detect `<body>`
elements. This information is going to be even more important to
properly handle `<html>` elements that inherit their overflow property from
their `<body>` children.

Implementing this properly requires updating the DOM wrapper interface.
This check does reach up to the parent of thread-safe nodes, but this is
essentially the same kind of operation that `parent_style()` does, so is
ostensibly safe.

This change should not change any behavior and is just a preparation
step for properly handle `<body>` overflow.
2023-05-04 10:46:27 +02:00
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02:00
Anthony Ramine
e3be136c9b Rename a bunch of style/layout data items
GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
2020-04-06 12:39:52 +02:00
Anthony Ramine
185a402d9c Make DOM own the style and layout data, in an UnsafeCell
The previous Cell was a lie.
2020-04-04 13:10:19 +02:00
Anthony Ramine
6fe294fa5b Make LayoutNodeHelpers::text_content return a cow 2020-03-31 15:02:13 +02:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Simon Sapin
94b19beefb Fix some warnings new in Rust Nightly 2019-11-08 11:45:16 +01:00
Simon Sapin
439ee70bd1 Run rustfmt 2019-08-24 14:11:11 +02:00
Fernando Jiménez Moreno
e344203c11 Only allow UA widgets as children of media elements
Do not allow pseudo-elements for replaced elements
2019-07-22 17:40:15 +02:00
Evgeniy Reizner
6f1df517e0 style: Do not use borrowed types in the selectors::Element trait.
Closes #22972
Closes #23463
2019-06-04 01:04:03 -04:00
Fernando Jiménez Moreno
5a165c6bd8 Move is_connected function from style to layout, where it is used 2019-04-26 11:42:38 +02:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Josh Matthews
49d2ea4f74 Make layout use available image data before querying the image cache. 2018-10-12 21:55:09 -04:00
Víctor Manuel Jáquez Leal
1985f0d75e layout: add media_data() method to ThreadSafeLayoutNode trait 2018-10-08 16:12:00 +02:00
bors-servo
efa2c7334e
Auto merge of #21687 - AnshulMalik:format-script_layout, r=jdm
format script_layout_interface

- [x] `./mach test-tidy` does not report any errors

<!-- 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/21687)
<!-- Reviewable:end -->
2018-09-13 08:28:01 -04:00
paavininanda
25027e476c Current-pixel-density tests passing 2018-09-13 00:23:09 +05:30
Anshul Malik
ae469b016d format script_layout_interface 2018-09-12 12:39:38 +05:30
Emilio Cobos Álvarez
7ab4b21bc3
selectors: Remove the get_ prefix from get_local_name and get_namespace. 2018-02-24 22:45:38 +01:00
Martin Robinson
99eb457fc7 Update WebRender
This allows servo to use the ExternalScrollId API from WebRender fixing
some issues related to duplicate scroll root ids.

Fixes #17176.
Fixes #19287.
Fixes #19648.
2018-02-06 15:10:35 +01:00
Emilio Cobos Álvarez
cd04664fb9
style: Use CascadeFlags for what they're for.
Now that we have an Element around on cascade, we can stop using the cascade
flags mechanism to pass various element-related state, like "is this element the
root", or "should it use the item-based display fixup".

That fixes handwaviness in the handling of those flags from style reparenting,
and code duplication to handle tricky stuff like :visited.

There are a number of other changes that are worth noticing:

 * skip_root_and_item_based_display_fixup is renamed to skip_item_display_fixup:

   TElement::is_root() already implies being the document element, which by
   definition is not native anonymous and not a pseudo-element.

   Thus, you never get fixed-up if your NAC or a pseudo, which is what the code
   tried to avoid, so the only fixup with a point is the item one, which is
   necessary.

 * The pseudo-element probing code was refactored to return early a
   Option::<CascadeInputs>::None, which is nicer than what it was doing.

 * The visited_links_enabled check has moved to selector-matching time. The rest
   of the checks aren't based on whether the element is a link, or are properly
   guarded by parent_style.visited_style().is_some() or visited_rules.is_some().

   Thus you can transitively infer that no element will end up with a :visited
   style, not even from style reparenting.

Anyway, the underlying reason why I want the element in StyleAdjuster is because
we're going to implement an adjustment in there depending on the tag of the
element (converting display: contents to display: none depending on the tag), so
computing that information eagerly, including a hash lookup, wouldn't be nice.
2018-01-23 13:18:54 +01:00
Emilio Cobos Álvarez
104f5c2553
style: Derive debug for CascadeInputs.
It no longer has anything than rules.
2018-01-23 00:57:54 +01:00
Emilio Cobos Álvarez
5ac12b5df4
style: Make the TElement type arrive to the cascade function.
Not super-proud of this one, but it's the easiest way I could think of.

The changeset looks bigger than what it is, because while at it I've rewrapped a
fair amount of functions around to use proper block indentation.

Alternatives are parameterizing Stylist by <E>, which is not fun, or moving the
concrete element from layout_thread to layout, but that implies layout depending
on script, which isn't fun either.

Other alternative is implementing an empty enum and making anon boxes work on
it. It has the advantage of removing the annoying type parameter, but the
disadvantage of instantiating `cascade` twice, which isn't great, and having to
maintain all the boilerplate of a `TElement` implementation that just does
nothing.
2018-01-23 00:57:54 +01:00
Emilio Cobos Álvarez
bc29a16285
layout: Deduplicate Node::fragment_type and FragmentDisplayListBuilding::fragment_type. 2018-01-14 21:45:39 +01:00
Emilio Cobos Álvarez
e32d6f6adf
layout: Remove type parameter from PseudoElementType.
Everyone uses () now.
2018-01-14 21:45:39 +01:00
Emilio Cobos Álvarez
cb2bba8777
style: Remove unused optional display from PseudoElementType definition.
Everyone passes None now.
2018-01-14 21:45:38 +01:00
Emilio Cobos Álvarez
55174991b6
layout: Stop overriding display of the ::-servo-details-content pseudo-element.
We only override it when there's no "open" attribute. But a display: none
pseudo-element is the same as no pseudo-element at all.

This should get the same behavior when iterating children in dom_wrapper.rs
2018-01-14 21:45:37 +01:00
Emilio Cobos Álvarez
8f6455b9df
style: Remove some unneeded indirection.
All TElement's implement Copy, and are just pointers, so the double indirection
is stupid.

I'm going to try to see if removing this double-indirection fixes some
selector-matching performance, and this is a trivial pre-requisite while I wait
for Talos results.
2018-01-10 03:56:34 +01:00
Emilio Cobos Álvarez
f3ea248188
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.
Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.
2018-01-04 14:45:54 +01:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Emilio Cobos Álvarez
6c796b50ec
style: Remove PresentationalHintsSynthesizer.
This is not really an useful abstraction, and I never knew how to spell it.
2017-10-26 11:45:28 +02:00
Xidorn Quan
2dc714f0ac Implement XUL tree pseudo style resolution for stylo. 2017-10-20 14:08:56 +11:00
Emilio Cobos Álvarez
7afe393f23
style: Remove a few unused functions. 2017-10-17 08:57:36 +02:00
Emilio Cobos Álvarez
a11d268468
style: Refactor children handling.
Moving traversal_children away from TNode I can make TNode trivial enough, in
order to share a QuerySelector implementation between Servo and Gecko.
2017-10-17 08:57:35 +02:00
Anthony Ramine
e2dac78d36 Rename LayoutJS<T> to LayoutDom<T> 2017-09-26 09:49:04 +02:00
Alan Jeffrey
fbfb9a80b4 Remove sources of panic when laying out an iframe without a nested browsing context. 2017-09-22 09:04:18 -05:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02: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
Emilio Cobos Álvarez
655c842d2e
style: Cleanup most of the Inner mess.
MozReview-Commit-ID: Ieg2GJT0yUl
2017-07-18 17:34:57 +02:00
Manish Goregaokar
89930e7565 stylo: Switch Gecko over to ServoStyleContext 2017-07-17 18:03:23 -07:00