Commit graph

97 commits

Author SHA1 Message Date
Natalia Csoregi
9d85b6aa2f Backed out 4 changesets (bug 1834725) for causing failures on browser_styleeditor_loading_with_containers.js. CLOSED TREE
Backed out changeset 0965e956200a (bug 1834725)
Backed out changeset 4a8151163607 (bug 1834725)
Backed out changeset a56f42223377 (bug 1834725)
Backed out changeset a920356b63eb (bug 1834725)
2024-01-11 19:57:47 +02:00
Alexandre Poirot
6f039e6faa Bug 1834725 - [devtools] Tweak original CSS handling in the Style Editor. r=devtools-reviewers,nchevobbe
* Accept exceptions from `getOriginalURLS` (see next changeset).
* Avoid instantiating an editor for minified stylesheet when we have a functional original stylesheet.
  We were doing that solely for getting their `friendlyName`, whereas we could lazily compute it only when we need it.

Differential Revision: https://phabricator.services.mozilla.com/D187575
2024-01-11 15:27:24 +00:00
Nicolas Chevobbe
a7e4d18af7 Bug 1840987 - [devtools] Don't assume CSS variables always inherit. r=devtools-reviewers,ochameau.
Remove the specific callsites where we were making such assumption, and update
the calls to `InspectorUtils.isInheritedProperty` to pass a document, since it's
now required to check if custom properties inherit.

Differential Revision: https://phabricator.services.mozilla.com/D194630
2023-11-27 18:39:11 +00:00
Nicolas Chevobbe
433c9f4430 Bug 1844055 - [devtools] Make property-toggle checkbox keyboard accessible. r=devtools-reviewers,accessibility-frontend-reviewers,ochameau,morgan.
Differential Revision: https://phabricator.services.mozilla.com/D192059
2023-11-23 11:14:51 +00:00
Nicolas Chevobbe
7aad4369ba Bug 1832213 - Add pretty print button in StyleEditor. r=devtools-reviewers,fluent-reviewers,ochameau.
This adds a similar button to the one we have in the Debugger that users can
click on to pretty print the stylesheet.
We disable the button when the opened file is an original file, as we don't
support pretty printing non CSS files.

The current test for (automatic) pretty printing is updated to check that the
button has the expected states and behaves as it should.

Differential Revision: https://phabricator.services.mozilla.com/D189762
2023-10-04 06:27:46 +00:00
Emilio Cobos Álvarez
6070e00f0a Bug 1850342 - Remove non-standard, un-tested :-moz-loading pseudo-class. r=layout-reviewers,jfkthame
This is technically web-exposed, but if we needed to introduce it for
compat we could always re-introduce it matching false.

Differential Revision: https://phabricator.services.mozilla.com/D186938
2023-08-30 10:38:52 +00:00
Nicolas Chevobbe
70d26c94ef Bug 1838857 - [devtools] Use devtools.editor.tabsize value for space indentation in prettifyCSS. r=devtools-reviewers,ochameau.
We used to only indent with one space when `devtools.editor.expandtab` was true.
Unit test is updated to make sure we do use the pref value now.

Differential Revision: https://phabricator.services.mozilla.com/D181225
2023-06-20 07:42:20 +00:00
Mark Banner
8219a5c503 Bug 1826062 - Automatic fixes for Prettier 2.0.5 upgrade. r=mossop,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,denschub,devtools-reviewers,sparky,owlish
Differential Revision: https://phabricator.services.mozilla.com/D177025
2023-05-20 12:26:49 +00:00
Nicolas Chevobbe
0bdb33bc6d Bug 1824654 - [devtools] Fix computed view location title. r=devtools-reviewers,jdescottes.
Add a `CssLogic.longSource` counterpart to `CssLogin.shortSource`, which returns
the sheet full URL unless it's an inline or constructed stylesheet, and use the
result of this to build the title attribute.

Differential Revision: https://phabricator.services.mozilla.com/D173673
2023-03-28 16:42:44 +00:00
Nicolas Chevobbe
49b7b9c349 Bug 1815159 - [devtools] Add support for @layer and @container rules in Changes panel. r=jdescottes
A test is added to make sure those are displayed properly and that the "Copy Rule"
button gives the expected result.

Differential Revision: https://phabricator.services.mozilla.com/D168952
2023-02-10 14:40:05 +00:00
Nicolas Chevobbe
772bc18d4b Bug 1815159 - [devtools] Use CSS rules classnames instead of CSSRule.type. r=jdescottes.
CSSRule.type is deprecated (see https://developer.mozilla.org/en-US/docs/Web/API/CSSRule/type)
and new type of rules added recently (CSSContainerRule, CSSLayerBlockRule, …) don't
have a dedicated type, which means we can't target them.
Instead of looking into the type property, we should check the name of the class
to properly classify the rule.

Differential Revision: https://phabricator.services.mozilla.com/D168951
2023-02-10 14:40:04 +00:00
Julian Descottes
b0b95baab1 Bug 1811138 - [devtools] Remove require calls to InspectorUtils r=ochameau,perftest-reviewers,sparky
Depends on D167211

Differential Revision: https://phabricator.services.mozilla.com/D167308
2023-02-06 09:47:18 +00:00
Alexandre Poirot
aad605e498 Bug 1792848 - [devtools] Use absolute URLs to import modules in devtools/shared. r=Honza,devtools-backward-compat-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D158643
2022-10-12 15:56:22 +00:00
Alexandre Poirot
23691e0542 Bug 1793396 - [devtools] Use absolute URLs in all usages of loader.lazyRequireGetter. r=Honza
Differential Revision: https://phabricator.services.mozilla.com/D158489
2022-10-03 18:57:13 +00:00
Alexandre Poirot
7f9229d43d Bug 1789201 - [devtools] Expose Services as a global to all DevTools modules. r=perftest-reviewers,nchevobbe,julienw,AlexandruIonescu
This will help transition to ES Modules as this symbol is exposed to them.

$ sed -ie "/require(.Services.)/d" $(git grep -l 'require("Services")' devtools/)
$ sed -ie "/loader.lazyRequireGetter(this, .Services./d" $(git grep -l 'loader.lazyRequireGetter(this, "Services"' devtools/)
+ the edition of builtin-modules.js + eslintrc.js
+ manual eslint fixes
+ removal of devtools-services in the debugger, except for jest tests

Differential Revision: https://phabricator.services.mozilla.com/D156401
2022-09-09 07:22:51 +00:00
Mark Banner
a6855db57e Bug 1330099 - Enable object-shorthand eslint rule. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D153567
2022-08-03 14:57:05 +00:00
Emilio Cobos Álvarez
255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
Emilio Cobos Álvarez
05a8fc5ff9 Bug 1769771 - Differentiate inline from constructed stylesheets in rule view. r=nchevobbe
I think this is worth it, but needs localization changes so splitting
it out.

Differential Revision: https://phabricator.services.mozilla.com/D146683
2022-05-19 22:32:28 +00:00
Nicolas Chevobbe
d0f503f1f1 Bug 1733537 - [devtools] Replace usage of NodeFront#getAllSelectors with a command. r=jdescottes,devtools-backward-compat-reviewers.
`getAllSelectors` was used to retrieve a given nodeFront selector from the top
window (e.g. it would go up through documents).
This doesn't work with nodeFronts in remote frames, as we wouldn't be able to
reach for cross-process parent documents.
This patchs adds a new inspector command that computes the selector, reaching the
different documents.
All usages of `NodeFront#getAllSelectors` are switched to the new command, which
allows us to delete the method and another function that was only used there.
With the new command doing a bit more work, this highlighted some issue in our
codebase. Some consumers were relying on `selectionCssSelectors`, without waiting
for it to be updated when a new node was selected.
As a result a few tests were failing because of this.
So where it's possible and not perf critical, we simply compute the selector again.
We also emit a new event, `selection-css-selectors-updated`, so tests can wait
until it's properly set before doing further actions.

Differential Revision: https://phabricator.services.mozilla.com/D127928
2021-11-04 08:58:05 +00:00
Emilio Cobos Álvarez
1840840bc8 Bug 1723921 - Make devtools use two colons for pseudo-elements consistently. r=jdescottes
With the patch above, some devtools tests failed because we were trying
to call getComputedStyle(node, ":marker") (read: one colon rather than
two).

Using two colons for pseudo-elements is the right thing to do and fixes
it / removes some weird special-cases.

Differential Revision: https://phabricator.services.mozilla.com/D121858
2021-08-07 09:47:15 +00:00
Dorel Luca
00fc23a49d Backed out 2 changesets (bug 1723921) for Mochitest failures in layout/inspector/tests/test_getCSSPseudoElementNames.html. CLOSED TREE
Backed out changeset 5e9348094ee1 (bug 1723921)
Backed out changeset e55c2177bbd2 (bug 1723921)
2021-08-05 18:44:42 +03:00
Emilio Cobos Álvarez
8f8176d86b Bug 1723921 - Make devtools use two colons for pseudo-elements consistently. r=jdescottes
With the patch above, some devtools tests failed because we were trying
to call getComputedStyle(node, ":marker") (read: one colon rather than
two).

Using two colons for pseudo-elements is the right thing to do and fixes
it / removes some weird special-cases.

Differential Revision: https://phabricator.services.mozilla.com/D121858
2021-08-05 15:06:16 +00:00
Emilio Cobos Álvarez
5c9bd32723 Bug 1707597 - Garbage-collect event state bits. r=smaug
We had about 9 gaps / unused bits. I moved the devtools ones at the end
because I think we should be able to remove them (but separate bug).

Differential Revision: https://phabricator.services.mozilla.com/D113365
2021-04-26 15:46:52 +00:00
Jason Laster
5f29a6d696 Bug 1622996 - Refactor devtools codebase to use optional chaining (automated changes). r=jdescottes
Depends on D67084

Differential Revision: https://phabricator.services.mozilla.com/D67537

--HG--
extra : moz-landing-system : lando
2020-03-19 21:13:38 +00:00
Emilio Cobos Álvarez
422bc064f3 Bug 1596800 - Remove document.getBindingParent usage from devtools. r=jdescottes
This removes the concept of shadowAnonymous, which doesn't make a lot of sense,
and re-enables the shadow dom tests which were disabled when we removed the old
style system (as stylo didn't supported shadow DOM yet by then).

This is a change in behavior as you can now remove nodes from shadow DOM (no
reason you weren't able to, before).

Differential Revision: https://phabricator.services.mozilla.com/D53340

--HG--
extra : moz-landing-system : lando
2019-11-18 20:54:10 +00:00
Julian Descottes
222bc5ccde Bug 1593921 - Use eslint-disable-next-line to disable complexity checks in DevTools r=pbro
Using next-line is less error prone for refactorings than wrapping methods with enable/disable blocks.

Differential Revision: https://phabricator.services.mozilla.com/D51782

--HG--
extra : moz-landing-system : lando
2019-11-05 14:29:04 +00:00
Julian Descottes
a399da3be9 Bug 1588773 - Move css-selector.js helpers back to DevTools css-logic.js r=pbro
Depends on D49303

Some methods from css-logic were extracted from the devtools codebase to be used by context-menu files.
This was only needed in order to compute the css-selectors for Inspect Element.
If we use ContentDOMReference instead, those helpers can move back in the devtools codebase
(leaving them in css-selector.js fails the all-files-referenced test for some reason as well)

Differential Revision: https://phabricator.services.mozilla.com/D49330

--HG--
rename : toolkit/modules/tests/chrome/test_findCssSelector.html => devtools/shared/tests/mochitest/test_css-logic-findCssSelector.html
extra : moz-landing-system : lando
2019-10-28 09:11:02 +00:00
Julian Descottes
6261a77787 Bug 1590050 - Preserve markup view selection in iframes after reload r=rcaliman,gl
Depends on D49940

To support this feature we perform two main changes
- the node actor exposes a getAllSelectors method, and the inspector now stores all selectors rather than just one
- the node actor exposes a waitForFrameLoad method, and the walkerFront findNodeFront helper uses it to make sure frames are loaded before querying a selector

Also added a test

Differential Revision: https://phabricator.services.mozilla.com/D49941

--HG--
extra : moz-landing-system : lando
2019-10-28 07:55:14 +00:00
Daisuke Akatsuka
fa5347f328 Bug 1581008: Add inactive CSS message for properties that are impossible to override. r=pbro,fluent-reviewers,flod
Depends on D45624

Differential Revision: https://phabricator.services.mozilla.com/D45625

--HG--
extra : moz-landing-system : lando
2019-09-26 01:53:40 +00:00
Cosmin Sabou
b9c401dc1b Backed out 2 changesets (bug 1581008) for mochitest failures on test_styles-matched.html. CLOSED TREE
Backed out changeset 1208c70dd3bd (bug 1581008)
Backed out changeset d69f8f5f9db4 (bug 1581008)
2019-09-25 11:51:11 +03:00
Daisuke Akatsuka
26d18e0ea4 Bug 1581008: Add inactive CSS message for properties that are impossible to override. r=pbro,fluent-reviewers,flod
Depends on D45624

Differential Revision: https://phabricator.services.mozilla.com/D45625

--HG--
extra : moz-landing-system : lando
2019-09-25 07:45:15 +00:00
Nicolas Chevobbe
925311bc77 Bug 1568779 - Remove editors settings comments in devtools files. r=pbro.
Differential Revision: https://phabricator.services.mozilla.com/D42300

--HG--
extra : moz-landing-system : lando
2019-08-19 12:48:16 +00:00
Victor Porof
b8157dfaaf Bug 1561435 - Format remaining devtools/, a=automatic-formatting, CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35894

--HG--
extra : source : 4722b924e08478f5337ab509718bd66906bf472f
extra : amend_source : a5baa1aab21639fdba44537e3a10b179b0073cb4
2019-07-05 11:29:32 +02:00
Razvan Caliman
0bde9bbef6 Bug 724505 - Map minified CSS to prettyfied CSS. r=gl
Ensure source links for selectors in the Rules view and warning links in Web Console for minified CSS go to the right location in the Style Editor after applying automatic prettification.

This only works for linked stylesheets. [Bug 1169770](https://bugzilla.mozilla.org/show_bug.cgi?id=1169770) needs to be fixed first before this can work correctly on inline minified stylesheets.

This patch augments the `prettifyCSS()` method to generate the mappings necessary to generate a sourcemap from the original to the prettified source. It uses these mappings to translate the cursor position when invoking the Style Editor to be opened at a specific location.

The mappings from the minified to the prettified source are used only until the stylesheet is changed in the Style Editor. Upon editing the source in the Style Editor, the associated mappings are cleared because it's likely they have been rendered invalid.

The updated stylesheet will already be prettified so it bypasses the `prettifyCSS()` method, thus avoiding the need to re-generate mappings. New CSS warnings will be listed in the Web Console which point to the right location in the edited stylesheet (the old warnings no longer point to the right place, but that's an acceptable side-effect). The Rules view in the Inspector also lists selectors with the new positions within the edited stylesheet.

Differential Revision: https://phabricator.services.mozilla.com/D36585

--HG--
extra : moz-landing-system : lando
2019-07-04 17:30:00 +00:00
Patrick Brosset
a365f19d19 Bug 1553451 - Lower the eslint complexity level to 20 for devtools and exlude more complex functions; r=jdescottes
We want to go back to ESLint's default complexity level so that newly introduced code is checked for complexity.
At the same time, to make that work, we're excluding all of the more complex functions for now.
We should fix them: make them less complex, and remove the eslint-disable comment.
See bug 1553449 for more information about this.

Differential Revision: https://phabricator.services.mozilla.com/D32139

--HG--
extra : moz-landing-system : lando
2019-05-23 09:06:16 +00:00
Mihai Alexandru Michis
2ae5a4bb01 Backed out changeset 0f9626b48a66 (bug 1553451) for linting failures. CLOSED TREE 2019-05-23 10:58:22 +03:00
Patrick Brosset
28f446d619 Bug 1553451 - Lower the eslint complexity level to 20 for devtools and exlude more complex functions; r=jdescottes
We want to go back to ESLint's default complexity level so that newly introduced code is checked for complexity.
At the same time, to make that work, we're excluding all of the more complex functions for now.
We should fix them: make them less complex, and remove the eslint-disable comment.
See bug 1553449 for more information about this.

Differential Revision: https://phabricator.services.mozilla.com/D32139

--HG--
extra : moz-landing-system : lando
2019-05-23 07:07:49 +00:00
Razvan Caliman
ff22a40fa6 Bug 1553194 - Remove unrelated code comment from shared/css-logic.js r=pbro
Depends on D32016
The code comment is perhaps a leftover from a file duplication to extract shared methods to `shared/inspector/css-logic.js` from `server/actors/inspector/css-logic.js`.

The comment is confusing because there is no usage of any of the CssLogic terminology within the file.

Differential Revision: https://phabricator.services.mozilla.com/D32017

--HG--
extra : moz-landing-system : lando
2019-05-22 07:35:02 +00:00
Ian Moody
71b7e1fa5d Bug 1539265 - Handle ::marker pseudo-elements in css-logic.js, so their rules show in the rule view. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D25071

--HG--
extra : moz-landing-system : lando
2019-04-02 07:45:31 +00:00
arthur.iakab
cf3b3f1eb5 Backed out 11 changesets (bug 1539265) for causing debugger failures CLOSED TREE
Backed out changeset 8206b880f9ec (bug 1539265)
Backed out changeset be9f5f73bdfe (bug 1539265)
Backed out changeset f78146b8aa17 (bug 1539265)
Backed out changeset 18fa7e971a0d (bug 1539265)
Backed out changeset 6eaf5bdd945c (bug 1539265)
Backed out changeset 3add7d4d4853 (bug 1539265)
Backed out changeset 8015aeb5279d (bug 1539265)
Backed out changeset 19c8e404ac5f (bug 1539265)
Backed out changeset 637a9d6af0f3 (bug 1539265)
Backed out changeset 72bbb4b28932 (bug 1539265)
Backed out changeset 931e98129878 (bug 1539265)
2019-04-02 02:44:43 +03:00
Ian Moody
8e985aa314 Bug 1539265 - Handle ::marker pseudo-elements in css-logic.js, so their rules show in the rule view. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D25071

--HG--
extra : moz-landing-system : lando
2019-04-01 21:45:28 +00:00
Michael Ratcliffe
639bed7bb2 Bug 1509620 - Computed style inspector CSS cascade calculation is wrong r=ladybenko
### Try

https://treeherder.mozilla.org/#/jobs?repo=try&revision=f1bad5e5282812225da95c0ea9e2ef173640b5da

### Summary

!!Comparing numerous complex websites such as github, facebook, cnn etc. the cascade now matchers that of Chrome so we are in a much better place.!!

According to https://www.w3.org/TR/css-cascade-3/#cascading (which platform follows now) and https://www.w3.org/TR/css-cascade-4/#cascading we should now be doing this (descending order):

  - Transition declarations
  - User-Agent & !important
  - User & !important
  - Author & !important
  - CSS Animations, @keyframes
  - Author, normal weight
  - User, normal weight
  - User-Agent, normal weight
  - specificity
  - Sheet Index
  - Rule Line
  - Rule Column

We are only dealing with CSS selectors here so we can safely drop Transition declarations and CSS Animations because their presence here is irrelevant when it comes to the CSS cascade information we display in the computed view.

This leaves us with:

  - User-Agent & !important
  - User & !important
  - Author & !important
  - Author, normal weight
  - User, normal weight
  - User-Agent, normal weight
  - specificity
  - Sheet Index
  - Rule Line
  - Rule Column

### Changes

- References to content stylesheets have been changed to author stylesheet to closely match the technical terms author, user and agent stylesheets.
- Simplified and modernized a bunch of for loops to make the code easier to understand.
- Previous to these changes all matching parent rules were classed as equal e.g. color on the body tag was equal to color on a node's immediate container. We now use the `distance` variable to tell how close a rule is to the current node. This is the highest qualifier in our cascade calculation.
- The `_agentSheet`, `_authorSheet` and `_userSheet` properties are now used to obtain a sheets origin.
- `elementStyle` was renamed to `inlineStyle` in order to correctly identify the rule's origin.
- We used to sort the matchedSelectors to move rules with `STATUS.MATCHED` above `STATUS.PARENT_MATCH` but this is unnecessary now that we have the `distance` property so we no longer do this.
- The `compareTo()` method has been updated to match https://www.w3.org/TR/css-cascade-3/#cascading (which platform follows now) and https://www.w3.org/TR/css-cascade-4/#cascading. It has also been simplified and made far less prone to error.

Differential Revision: https://phabricator.services.mozilla.com/D23711

--HG--
extra : moz-landing-system : lando
2019-03-25 16:32:19 +00:00
Daisuke Akatsuka
2f478513a6 Bug 1114929: Apply line count of comments. r=pbro
Differential Revision: https://phabricator.services.mozilla.com/D24118

--HG--
extra : moz-landing-system : lando
2019-03-20 22:31:14 +00:00
Julian Descottes
e046e9a177 Bug 1502346 - Retrieve ::slotted rules in InspectorUtils getCSSStyleRules;r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D14759

--HG--
extra : moz-landing-system : lando
2018-12-17 21:33:40 +00:00
Razvan Caliman
c9616064f5 Bug 1499049 - (Part 1) Log ancestor rule tree for changes to CSS declarations; r=pbro
⚠️ **To build locally, this change series depends on the [change series](https://phabricator.services.mozilla.com/D4399) which adds the ChangesActor**.
🏋️‍♂️ **To test hands-on, you can download a [custom macOS build](https://queue.taskcluster.net/v1/task/HIiZcwLXTuuSYYjfwEDmmA/runs/0/artifacts/public/build/target.dmg)  (updated Wed, Oct 24) which includes both change series.**

- Introduce ancestorRules getter to StyleRuleActor to get a flattened rule tree with the ancestors of the current rule;
- Introduce CSSRuleTypeName to css-logic helpers to map between CSS rule type and human-readable name;
- Log rule index position with each CSS declaration change to help differentiate between changes to rules with identical selectors at the same level of nesting.

Differential Revision: https://phabricator.services.mozilla.com/D8718

--HG--
extra : moz-landing-system : lando
2018-10-24 17:43:33 +00:00
Patrick Brosset
bb2e382570 Bug 1114932 - Break after commas in CSS selectors r=tromey
Differential Revision: https://phabricator.services.mozilla.com/D9232

--HG--
extra : moz-landing-system : lando
2018-10-22 14:17:27 +00:00
Mark Banner
ceaeb93550 Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D8389

--HG--
extra : moz-landing-system : lando
2018-10-19 12:55:39 +00:00
Gabriel Luong
a567ea6096 Bug 1494162 - Part 19: Backed out changeset 5fd32a2fbc66. r=me 2018-09-28 16:19:30 -04:00
Gabriel Luong
731fa92589 Bug 1494162 - Part 19: Directly import getCssPath, getXpath and findCssSelector. r=pbro 2018-09-28 13:14:34 -04:00
Gabriel Luong
f02c127be2 Bug 1464192 - Part 18: Lazy load modules in the css-logic. r=pbro
--HG--
extra : source : 973fbb5bbadcafcb1b49fe82b452eff4da5b2838
2018-09-28 13:14:34 -04:00