Files
sousa-gecko/devtools/shared/dom-node-filter-constants.js
Nicolas Chevobbe 5a817f04d4 Bug 1996608 - [devtools] Display ::view-transition* pseudo elements in markup view. r=devtools-reviewers,ochameau.
This handles all the anonymous content pseudo elements for view transition.
Those elements are a bit different from the pseudo elements we had to handle
until now.
First, they don't have a special nodeName (e.g. for `::before`, we have a `_moz_generated_content_before`
nodeName).
Instead, they have a type attribute, and a name attribute (except `::view-transition`).
So we need to check the type attribute to see if those elements are view transition
pseudo elements.
Those elements also have a common root, `<div type=":-moz-snapshot-containing-block">`
that we don't want to display in the markup view, as its' not exposed in CSS, it's
just an implementation detail.
To handle that, we add a new walker filter result, `FILTER_ACCEPT_CHILDREN`, that
will not be returned, but will have its children evaluated.
This impact the `WalkerActor#rawParentNode` function as we don't want to return
nodes that would have been ignored.

A few test cases are added to make sure the pseudo elements are properly displayed
in the markup view, in the breadcrumb and in the highlighter status bar.

Differential Revision: https://phabricator.services.mozilla.com/D270294
2025-11-13 14:02:43 +00:00

27 lines
737 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
module.exports = {
FILTER_ACCEPT: 1,
FILTER_REJECT: 2,
FILTER_SKIP: 3,
FILTER_ACCEPT_CHILDREN: 4,
SHOW_ALL: 0xffffffff,
SHOW_ELEMENT: 0x00000001,
SHOW_ATTRIBUTE: 0x00000002,
SHOW_TEXT: 0x00000004,
SHOW_CDATA_SECTION: 0x00000008,
SHOW_ENTITY_REFERENCE: 0x00000010,
SHOW_ENTITY: 0x00000020,
SHOW_PROCESSING_INSTRUCTION: 0x00000040,
SHOW_COMMENT: 0x00000080,
SHOW_DOCUMENT: 0x00000100,
SHOW_DOCUMENT_TYPE: 0x00000200,
SHOW_DOCUMENT_FRAGMENT: 0x00000400,
SHOW_NOTATION: 0x00000800,
};