aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko/pseudo_element.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-237/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* style: Rustfmt servo/. r=zrhoffmanEmilio Cobos Álvarez2023-11-241-3/+3
| | | | | | | | $ find servo -name '*.rs' | xargs rustup run nightly rustfmt Depends on D179380 Differential Revision: https://phabricator.services.mozilla.com/D179381
* style: Basic implementation of Custom Highlight APIJan-Niklas Jaeschke2023-11-061-1/+19
| | | | | | | | | | | | Added WebIDL interfaces as per spec, added some necessary changes to support maplike and setlike structures to be accessed from C++. Added `::highlight(foo)` pseudo element to CSS engine. Implemented Highlight as new kind of `Selection` using `HighlightType::eHighlight`. This implies Selections being added/removed during runtime (one `Selection` object per highlight identifier), therefore a dynamic container for highlight `Selection` objects was added to `nsFrameSelection`. Also, the painting code queries the highlight style for highlight Selections. Implementation is currently hidden behind a pref `dom.customHighlightAPI.enabled`. Differential Revision: https://phabricator.services.mozilla.com/D164203
* style: Remove ThinBoxedSliceEmilio Cobos Álvarez2023-06-091-1/+0
| | | | | | | | | | | | | | | | | | | The only remaining consumers are ::-moz-tree pseudo-elements (we used to use ThinBoxedSlice for other data structures in the past). Those are not particularly performance sensitive so I think just double-boxing is fine. In the future, if we wanted to avoid the double indirection, we could probably use the "thin" crate (https://docs.rs/thin) or similar, which stores the length of the slice along with the allocation, making the pointer thin in all configurations, much like "ThinArc" does: https://searchfox.org/mozilla-central/rev/1ce2eea39442190a71a1f8f650d098f286bf4a01/servo/components/servo_arc/lib.rs#891 In practice though, I don't think it's particularly worth it for this specific case. Differential Revision: https://phabricator.services.mozilla.com/D134672
* style: Correctly report animation status of pseudo-elements that are not ↵Emilio Cobos Álvarez2023-06-091-2/+3
| | | | | | | | | | | | | | | | | | stored in the parent element We allow animating pseudo-elements like ::-moz-progress-bar (and we treat them like regular elements). Ideally we should store animations for these in the parent element as well, so they survive reframes and such. But treating them as regular elements right now means that we do animate them, but we never update animations for them correctly because wrapper.rs assumed them to be non-animatable. Since it seems reasonable to keep allowing the animations to happen, let's just correct the update code and add a test. Differential Revision: https://phabricator.services.mozilla.com/D131794
* style: Remove layout.css.file-selector-button.enabled pref.Emilio Cobos Álvarez2021-02-261-6/+1
| | | | | | | | On by default since bug 1662478 (Firefox 82) Depends on D101289 Differential Revision: https://phabricator.services.mozilla.com/D101290
* style: Remove the moz-focus-outer code.Emilio Cobos Álvarez2021-02-261-3/+0
| | | | | | | This pseudo does nothing and we successfully removed it in bug 1655859 (firefox 81). Differential Revision: https://phabricator.services.mozilla.com/D101289
* style: Rename ::file-chooser-button to ::file-selector-button, and enable it ↵Emilio Cobos Álvarez2021-02-261-3/+3
| | | | | | | | in all channels. See https://github.com/w3c/csswg-drafts/issues/5049 Differential Revision: https://phabricator.services.mozilla.com/D88995
* style: Rustfmt recent changes.Emilio Cobos Álvarez2020-06-041-5/+7
|
* style: Implement the ::file-chooser-button pseudo-element.Emilio Cobos Álvarez2020-06-041-5/+6
| | | | | | | | | | | As per https://github.com/w3c/csswg-drafts/issues/5049. Don't enable it unconditionally just yet, as the name may change. I had to move some rules in forms.css because otherwise you get specificity conflicts. Differential Revision: https://phabricator.services.mozilla.com/D76214
* style: Make ::-moz-focus-outer a no-op, and remove it on Nightly.Emilio Cobos Álvarez2020-06-041-1/+7
| | | | | | | | | | | | | | | See https://bugzilla.mozilla.org/show_bug.cgi?id=932410#c2 for the context for which this pseudo-element was added. In the previous patch, I had to special-case range appearance because of this pseudo-class, but that patch makes this pseudo-class completely redundant, as now all form controls, themed and unthemed, display outlines, unless the native theme displays a focus indicator on its own. Remove the special case, and make ranges use outlines like everything else rather than this bespoke pseudo-element. Differential Revision: https://phabricator.services.mozilla.com/D74734
* style: Add ::marker when checking may_have_animations() during traversal.Boris Chiou2020-06-041-0/+6
| | | | | | | | | | | | | | | | | When unhidding a ::marker element, we construct its generated item, and then call StyleNewSubtree() on this generated item. During traversal, we may update any animation related values in Gecko_UpdateAnimations(), which may update the base styles for animation properties. The test case is an animation segment from "null" to "inital" value. We replace the "null" value with the base style value for the specific animation property, so we can do interpolation properly. (e.g. opacity: "null => initial" becomes "1.0 => initial") If we don't update the animation related values in Gecko_UpdateAnimations after generating ::marker, we may do interpolation from "null" to "initial", which causes a panic. Differential Revision: https://phabricator.services.mozilla.com/D73408
* style: Fix number input so that it honors overflow-clip-box-block.Emilio Cobos Álvarez2020-04-161-6/+0
| | | | | | | | | | | | | | | | This never worked, but it's more visible with the new form controls which have more padding. Make the anonymous div and co a pseudo-element, so that they inherit from the <input> properly in all cases. This works for non-number inputs because the editor root is a direct child of the <input>, but it doesn't for number inputs because there's a flex wrapper in between. This way overflow-clip-box: inherit does what we want. Reset the padding in the inline direction, as the padding for <input type=number> applies to the arrow boxes as well, and thus we'd double-apply it. Differential Revision: https://phabricator.services.mozilla.com/D65271
* style: Fix cascade order of shadow parts.Emilio Cobos Álvarez2019-11-301-0/+6
| | | | | | | This moves the shadow cascade order into the cascade level, and refactors the code a bit for that. Differential Revision: https://phabricator.services.mozilla.com/D49988
* style: Fix formatting of recent changes.Emilio Cobos Álvarez2019-08-151-2/+3
|
* style: Use `static_prefs::pref!`.Nicholas Nethercote2019-08-151-5/+2
| | | | | | | | | | It's much nicer. One nice thing about this is that the new code is subject to the existing threadedness checking, which identified that several of these should be atomic because they're accessed off the main thread. Differential Revision: https://phabricator.services.mozilla.com/D40792
* style: Restrict properties that apply to ::marker for now.Emilio Cobos Álvarez2019-07-081-7/+12
| | | | Differential Revision: https://phabricator.services.mozilla.com/D31680
* style: restrict CSS properties for '::cue'.Alastor Wu2019-07-081-0/+1
| | | | | | | | According to the spec [1], only those CSS properties listed on the spec can be applied on the `::cue`. [1] https://www.w3.org/TR/webvtt1/#the-cue-pseudo-element Differential Revision: https://phabricator.services.mozilla.com/D34262
* style: Invalidate style for ::selection.violet2019-06-251-0/+6
| | | | | | | | | | | | This patch invalidates the style for `::selection`, which will restore the behavior before the regression. However, it's still not quite correct, because repaint is not triggered. Given that `::selection` requires some major change to implement https://github.com/w3c/csswg-drafts/issues/2474, we can address this problem later. Differential Revision: https://phabricator.services.mozilla.com/D35305
* style: Refactor the selector parser to make implementing ::part() easier.Emilio Cobos Álvarez2019-05-071-7/+5
| | | | | | | | | | | | | | | ::slotted() is already weird in the sense that it supports a pseudo-element afterwards (so ::slotted(*)::before is valid for example). ::part() is weirder because you are supposed to allow stuff like ::part(foo):hover, ::part(foo):hover::before, etc. In order to avoid making the already-complex parse_compound_selector more complex, shuffle stuff so that we pass the progress of our current compound selector around, and is the parsing code for each selector which decides whether it's ok to parse at the given point. Differential Revision: https://phabricator.services.mozilla.com/D27158
* style: Fix Gecko and Servo builds, and appease tidy.Emilio Cobos Álvarez2019-03-271-1/+10
|
* style: Add support for the ::marker pseudo element on list items. Alias ↵Mats Palmgren2019-03-271-1/+3
| | | | | | | :-moz-list-bullet/number to that in the parser. Bug: 205202 Reviewed-by: emilio
* style: Include anon boxes in CSSPseudoElementType, to remove ↵Emilio Cobos Álvarez2019-02-231-1/+1
| | | | | | | | | | | | | | ComputedStyle::mPseudoTag. This is more consistent with what the Rust bits of the style system do, and removes a pointer from ComputedStyle which is always nice. This also aligns the Rust bits with the C++ bits re. not treating xul pseudos as anonymous boxes. See the comment in nsTreeStyleCache.cpp regarding those. Can't wait for XUL trees to die. Differential Revision: https://phabricator.services.mozilla.com/D19002
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* style: Cargo fix + ./mach fmt.Emilio Cobos Álvarez2018-11-101-3/+1
|
* style: Allow ::slotted()::placeholder.Emilio Cobos Álvarez2018-11-101-5/+9
| | | | Differential Revision: https://phabricator.services.mozilla.com/D11132
* `cargo fix --edition --features gecko`Simon Sapin2018-11-101-7/+7
|
* Reorder importsPyfisch2018-11-061-1/+1
|
* style: Support ::before / ::after on ::slotted pseudos.Emilio Cobos Álvarez2018-11-051-0/+8
| | | | | | | See https://github.com/w3c/csswg-drafts/issues/3150 for the issue that would expand this to all pseudos. Differential Revision: https://phabricator.services.mozilla.com/D9994
* style: Remove PseudoElement::inherits_all.Emilio Cobos Álvarez2018-10-191-9/+0
| | | | | | | | | I plan to change servo to use all: inherit on its UA sheet. I hope the patch below should make it good enough performance-wise. And also, it's probably broken so I don't think it's worth supporting it specially. Differential Revision: https://phabricator.services.mozilla.com/D8686
* Format style component.chansuke2018-09-091-1/+3
|
* style: Accept unknown webkit pseudo-element.Xidorn Quan2018-09-031-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D4186
* style: Make tree pseudo-element prefix not case-sensitive.Xidorn Quan2018-09-031-0/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D4185
* style: Remove the concept of 'canonical' pseudos.Emilio Cobos Álvarez2018-08-081-9/+0
| | | | | | | | | | | | | | | | | | | | We only have this so that ::-moz-placeholder keeps serializing as ::-moz-placeholder, but I don't think anybody really cares. Edge aliases ::-webkit-input-placeholder to ::-ms-input-placeholder at parse time as well, as can be seen in: ``` let s = document.createElement('style'); s.innerHTML = `input::-webkit-input-placeholder { color: red };`; document.body.appendChild(s); document.body.innerHTML = s.sheet.cssRules[0].cssText; ``` And I think this is more consistent with what we do for CSS properties that are aliases. Differential Revision: https://phabricator.services.mozilla.com/D2595
* style: Shrink selectors::Component to 24 bytes.Cameron McCormack2018-08-081-0/+1
| | | | | | | This saves about 37 KiB of memory across the UA style sheets. Bug: 1475197 Reviewed-by: emilio
* style: Push visited style computation a bit further down.Emilio Cobos Álvarez2018-07-241-7/+5
| | | | | | Bug: 1474959 Reviewed-by: xidorn MozReview-Commit-ID: 1DILenWIw4D
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-4/+9
| | | | | | | | | | This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
* style: Optimize serialization of identifiers of length <= 16 🐉🐲Emilio Cobos Álvarez2018-02-071-1/+2
| | | | | | | Much like we optimize to_ascii_lowercase. This also fixes a bug in Servo where attr() rules with an unknown namespace prefix are parsed, which is wrong.
* style: Make input[type=number] pseudo-elements accessible to chrome.Emilio Cobos Álvarez2018-02-051-5/+15
| | | | | | Bug: 1433389 Reviewed-by: jwatt MozReview-Commit-ID: 2ycajPYd3CV
* style: Use CascadeFlags for what they're for.Emilio Cobos Álvarez2018-01-231-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* style: Make all keywords CamelCase for consistency.Emilio Cobos Álvarez2017-12-061-2/+2
| | | | This prevents confusion and paves the ground for derive(Parse) of them.
* style: Tidy up PseudoElement::should_exist.Emilio Cobos Álvarez2017-11-081-4/+3
| | | | MozReview-Commit-ID: Enr1NHONmtp
* Bump bitflags to 1.0 in every servo crateBastien Orivel2017-10-301-6/+4
|
* Make tree pseudos not precomputed since they are not really anonymous boxes.Xidorn Quan2017-10-201-2/+2
|
* Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest ↵Gecko Backout2017-10-191-4/+6
| | | | | | failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE Backs out https://github.com/servo/servo/pull/18809
* Update bitflags to 1.0 in every servo crateBastien Orivel2017-10-191-6/+4
| | | | | It still needs dependencies update to remove all the other bitflags versions.
* stylo: Remove a lot of the restyle damage related complexity.Emilio Cobos Álvarez2017-08-201-2/+14
| | | | | | | | | | The only reason why we had the `existing_style_for_style_damage` bit is to apply some optimizations that we don't have anymore. I still want to reintroduce a few of them, at least for the non-eager pseudo-element case... But I think I won't need this at all. This allows us to remove a fair amount of Gecko code too.
* style: Don't perform parent display-based style fixups on most pseudos.Cameron McCormack2017-08-051-0/+7
|
* Make sure we don't recreate boxes just because we have a ::first-line.Boris Zbarsky2017-07-281-0/+6
| | | | Servo part of part 5 of the fix for Gecko bug 1324619. r=emilio
* Don't reconstruct the layout object when going from no pseudo to pseudo with ↵Boris Zbarsky2017-07-281-0/+17
| | | | | | no content for ::before and ::after. Fixes Gecko bug 1376073. r=emilio