Remove devtools/shared/layout/utils.js isNativeAnonymous/isAnonymous and switch
callsites to directly use node.isNativeAnonymous getter.
On the client rename isAnonymous into isNativeAnonymous so it's consistent
with the platform implementation.
Differential Revision: https://phabricator.services.mozilla.com/D271553
The RDP method can be called for a Node actor whose underlying node
doesn't have the scrollIntoViewMethod (e.g. a Text or a Comment).
We also now use the same method between the context menu entry and the keyboard
shortcut to bail out when scrollIntoView isn't supported by the selected node,
which means that we allow scrolling into view pseudo elements.
There was no test for the context menu entry, so we add one in browser_inspector_menu-06-other.js
Differential Revision: https://phabricator.services.mozilla.com/D243905
When there's a mutation and the client sees that the currently selected node
isn't connected anymore, a detached-front event is emitted with a node we think
is the parent node of the removed node, and select it.
Unfortunately, we were picking the first node who was mutated as the one we
should select, without checking that this mutation was the one triggered by the
node removal.
The fix is pretty simple: only pick a parent node if the currently selected node
is in the list of removed nodes from the mutation.
We're not adding a specific test for it, the next patch on the queue (for Bug 1173057),
has a test which was failing intermittently without this fix.
Differential Revision: https://phabricator.services.mozilla.com/D216667
Toolbox's Selection instance listens for `mutations` walkerFront event in order to detect if the selected node
was removed from the DOM tree, and in such case, emits a `detached-front` event that can be consumed by
the markup view.
But, when an iframe gets removed and EFT (or Fission for a remote iframe) is enabled we don't get the `mutations` event.
To fix this, we add a `onTargetDestroyed` method to `Selection`, that we call from the toolbox.
This fixes the browser_inspector_delete-selected-node-* tests when EFT is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D127224
Currently, we do leak the Toolbox/Inspector and some Documents when
closing the toolbox.
So that these classes are kept in memory, while not nullifying all its references
to client classes.
By adding these few nullications we can at least avoid leaking the fronts and commands.
(also fix a failure due to null markup.walker in browser_rules_add-rule-with-menu.js)
Differential Revision: https://phabricator.services.mozilla.com/D125535
Currently, we do leak the Toolbox/Inspector and some Documents when
closing the toolbox.
So that these classes are kept in memory, while not nullifying all its references
to client classes.
By adding these few nullications we can at least avoid leaking the fronts and commands.
(also fix a failure due to null markup.walker in browser_rules_add-rule-with-menu.js)
Differential Revision: https://phabricator.services.mozilla.com/D125535
By returning the shadow root as the parentNode of some elements, the breadcrumbs could no longer
display the chain of elements correctly, because shadowRoot.parentNode is null.
This changeset:
- returns the host actor ID as part of the shadowRoot form
- adds a parentOrHost convenience method on the node form
- uses said method in selection and breadcrumbs when walking up the ancestor chain
I don't think we should unconditionally return the host element as the parentNode of the
shadow root, because that is too disconnected from the reality.
MozReview-Commit-ID: JLeDb4VuT1q
Both reason and isSlotted arguments of setNodeFront are optional, switching to an
object argument avoids weird calls such as setNodeFront(front, null, true) in favor
of a more explicit setNodeFront(front, { isSlotted: true });
MozReview-Commit-ID: A6nziH3QQYe
With shadow dom support, a node front can be represented twice in the
markup view, once as a "slotted" version inserted in a <slot> element
and once a regular element.
We should be able to know if the selection was made on the regular or
on the slotted version.
MozReview-Commit-ID: CUpREkL0TzL
The markup view will now inline a textnode in its container if and only if:
- the text node is the only child (pseudo elements included)
- the text node length is smaller than a predefined limit
If a container is expanded, its text nodes will now always be rendered in full,
no longer as a short version with an ellipsis. When selecting or navigating on
a textnode, the layout will no longer be modified on the fly.
MozReview-Commit-ID: HcDMqjbOesN
The markup view will now inline a textnode in its container if and only if:
- the text node is the only child (pseudo elements included)
- the text node length is smaller than a predefined limit
If a container is expanded, its text nodes will now always be rendered in full,
no longer as a short version with an ellipsis. When selecting or navigating on
a textnode, the layout will no longer be modified on the fly.
MozReview-Commit-ID: HcDMqjbOesN