The MDNCompatibility library will be shared between the upcoming
Compatibility Actor and the Compatibility Panel in the inspector.
This library is necessary for tests in Compatibility Panel and
hence is being moved to the devtools/shared looking at it's
requirements in client as well as the devtools/server/actors
Differential Revision: https://phabricator.services.mozilla.com/D75998
Since targetFronts now have isTopLevel and targetType properties, we can directly use
those, as the targetFront is included in the callback parameter.
This patch remove those properties and refactor consumer code.
Differential Revision: https://phabricator.services.mozilla.com/D74651
Since targetFronts now have isTopLevel and targetType properties, we can directly use
those, as the targetFront is included in the callback parameter.
This patch remove those properties and refactor consumer code.
Differential Revision: https://phabricator.services.mozilla.com/D74651
Inspecting pages with many CSS variables makes DevTools Inspector very slow.
For example, try to inspect an element on [youtube.com](https://www.youtube.com/).
One of the stylesheets loaded by youtube.com contains more than 7800 CSS rules (it's 55K lines long). Some of them specify a very large number of CSS variable delcarations on `:root` which will be inherited by all nodes on the page. This is a perf bottleneck for DevTools.
{F2150398}
Whenever an element is selected, its matching CSS declarations show in the Rules view. If the node inherits CSS variables, for **each declaration**, the Rules view checks if the [variables apply to the current declaration](https://searchfox.org/mozilla-central/rev/2bfe3415fb3a2fba9b1c694bc0b376365e086927/devtools/client/inspector/rules/models/element-style.js#403-408,417,424).
This among other expensive operations which are repeated for each declaration. But for CSS variables, it's particularly slow given the frequent [checks with a regular expression](https://searchfox.org/mozilla-central/rev/2bfe3415fb3a2fba9b1c694bc0b376365e086927/devtools/client/inspector/rules/utils/utils.js#292-295) to verify if a CSS declaration's value includes any references to a given CSS variable name.
This patch introduces new functionality. When a `TextProperty` (aka CSS declaration model) is created on the client, the names of CSS variables found in its value are extracted ahead of time into a `Set`. Whenever we want to check if the declaration uses a certain CSS variable name, we check against this pre-compiled list instead of verifying the string value every time. For high volume checks, like the ones done by the `ElementStyle`, this approach proves significantly faster.
Profile without this patch: https://bit.ly/2Yd7khD
Profile with this patch: https://bit.ly/3aMhJTZ
There are still many optimizations that can be done, but the `hasCSSVariable()` method is no longer a performance bottleneck.
Differential Revision: https://phabricator.services.mozilla.com/D73062
The original site issue (https://trello.com/) seems not obvious on nightly
now. (See Bug 1301305 for more details.) So perhaps we could give this a
trial to disable this pref, for the better performance in other cases.
Differential Revision: https://phabricator.services.mozilla.com/D74278
Depends on D62623
`new-root` is no longer a mutation, but an event emitted by the `walker` actor.
Tests watching for mutations should be updated accordingly. They also need to call watchRootNode explicitly.
Differential Revision: https://phabricator.services.mozilla.com/D62624
Depends on D62624
With the previous implementation, an uninitialized document could be returned as a root node.
Here we try to be more explicit and wait for a correct root node. However in some cases a document can remain uninitialized and will never transition to any other state.
If the document is uninitialized but is not currently loading, we should consider it as a valid root node.
Differential Revision: https://phabricator.services.mozilla.com/D62625
Depends on D62623
`new-root` is no longer a mutation, but an event emitted by the `walker` actor.
Tests watching for mutations should be updated accordingly. They also need to call watchRootNode explicitly.
Differential Revision: https://phabricator.services.mozilla.com/D62624
Depends on D61063
I broke this feature while working experimenting for this patch and it was not caught by any test.
Adding a test to avoid regressions.
Differential Revision: https://phabricator.services.mozilla.com/D68849