Bug 1539265 - Add a few optimisations for ::marker pseudos. r=jdescottes

Where there is existing for ::before and ::after.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ian Moody 2019-04-01 21:45:44 +00:00
Родитель d246bee618
Коммит 76dd66e399
4 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -12,6 +12,7 @@ const Services = require("Services");
const {
isAfterPseudoElement,
isBeforePseudoElement,
isMarkerPseudoElement,
isNativeAnonymous,
} = require("devtools/shared/layout/utils");
const Debugger = require("Debugger");
@ -389,7 +390,7 @@ class JQueryEventCollector extends MainEventCollector {
// If jQuery is not on the page, if this is an anonymous node or a pseudo
// element we need to return early.
if (!jQuery || isNativeAnonymous(node) ||
if (!jQuery || isNativeAnonymous(node) || isMarkerPseudoElement(node) ||
isBeforePseudoElement(node) || isAfterPseudoElement(node)) {
if (checkOnly) {
return false;

Просмотреть файл

@ -188,7 +188,9 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
get numChildren() {
// For pseudo elements, childNodes.length returns 1, but the walker
// will return 0.
if (isBeforePseudoElement(this.rawNode) || isAfterPseudoElement(this.rawNode)) {
if (isMarkerPseudoElement(this.rawNode) ||
isBeforePseudoElement(this.rawNode) || isAfterPseudoElement(this.rawNode)
) {
return 0;
}

Просмотреть файл

@ -17,6 +17,7 @@ loader.lazyRequireGetter(this, "isAfterPseudoElement", "devtools/shared/layout/u
loader.lazyRequireGetter(this, "isAnonymous", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isBeforePseudoElement", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isDirectShadowHostChild", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isMarkerPseudoElement", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isNativeAnonymous", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isShadowHost", "devtools/shared/layout/utils", true);
loader.lazyRequireGetter(this, "isShadowRoot", "devtools/shared/layout/utils", true);
@ -536,7 +537,8 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
*/
inlineTextChild: function({ rawNode }) {
// Quick checks to prevent creating a new walker if possible.
if (isBeforePseudoElement(rawNode) ||
if (isMarkerPseudoElement(rawNode) ||
isBeforePseudoElement(rawNode) ||
isAfterPseudoElement(rawNode) ||
isShadowHost(rawNode) ||
rawNode.nodeType != Node.ELEMENT_NODE ||

Просмотреть файл

@ -638,6 +638,7 @@ exports.isShadowHost = isShadowHost;
function isDirectShadowHostChild(node) {
// Pseudo elements and native anonymous elements are always part of the anonymous tree.
if (
isMarkerPseudoElement(node) ||
isBeforePseudoElement(node) ||
isAfterPseudoElement(node) ||
isNativeAnonymous(node)) {