Skip to content

Commit

Permalink
Merge r241547 - Web Inspector: don't include accessibility role in DO…
Browse files Browse the repository at this point in the history
…M.Node object payloads

https://bugs.webkit.org/show_bug.cgi?id=194623
<rdar://problem/36384037>

Reviewed by Devin Rousso.

Source/JavaScriptCore:

Remove property of DOM.Node that is no longer being sent.

* inspector/protocol/DOM.json:

Source/WebCore:

Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
first place due to a DOM node tree update (i.e., NodeInserted).

It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
necessary to collect this information in a problematic way when initially pushing the node, as
it will be updated anyway.

No new tests, no change in behavior.

* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):
  • Loading branch information
burg authored and carlosgcampos committed Feb 18, 2019
1 parent 48eeadc commit a1a9eb1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
12 changes: 12 additions & 0 deletions Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
2019-02-13 Brian Burg <bburg@apple.com>

Web Inspector: don't include accessibility role in DOM.Node object payloads
https://bugs.webkit.org/show_bug.cgi?id=194623
<rdar://problem/36384037>

Reviewed by Devin Rousso.

Remove property of DOM.Node that is no longer being sent.

* inspector/protocol/DOM.json:

2019-02-13 Keith Miller <keith_miller@apple.com> and Yusuke Suzuki <ysuzuki@apple.com>

We should only make rope strings when concatenating strings long enough.
Expand Down
1 change: 0 additions & 1 deletion Source/JavaScriptCore/inspector/protocol/DOM.json
Expand Up @@ -65,7 +65,6 @@
{ "name": "shadowRoots", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Shadow root list for given element host." },
{ "name": "templateContent", "$ref": "Node", "optional": true, "description": "Content document fragment for template elements" },
{ "name": "pseudoElements", "type": "array", "items": { "$ref": "Node" }, "optional": true, "description": "Pseudo elements associated with this node." },
{ "name": "role", "type": "string", "optional": true, "description": "Computed value for first recognized role token, default role per element, or overridden role." },
{ "name": "contentSecurityPolicyHash", "type": "string", "optional": true, "description": "Computed SHA-256 Content Security Policy hash source for given element." }
]
},
Expand Down
22 changes: 22 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,25 @@
2019-02-13 Brian Burg <bburg@apple.com>

Web Inspector: don't include accessibility role in DOM.Node object payloads
https://bugs.webkit.org/show_bug.cgi?id=194623
<rdar://problem/36384037>

Reviewed by Devin Rousso.

Accessibility properties are complicated to fetch at all the points where we want to build and push nodes immediately.
Turning on AX often indirectly causes style recalc and layout. This is bad because we are often building nodes in the
first place due to a DOM node tree update (i.e., NodeInserted).

It turns out that DOM.getAccessibilityPropertiesForNode is called every time we display
the computed role in the Elements Tab > Nodes Sidebar > Accessibility Section. So it is not
necessary to collect this information in a problematic way when initially pushing the node, as
it will be updated anyway.

No new tests, no change in behavior.

* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::buildObjectForNode):

2019-02-14 Zalan Bujtas <zalan@apple.com>

[LFC][BFC][MarginCollapse] Replaced boxes don't collapse through their margins
Expand Down
9 changes: 0 additions & 9 deletions Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Expand Up @@ -1594,15 +1594,6 @@ Ref<Inspector::Protocol::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node*
value->setShadowRootType(shadowRootType(shadowRoot.mode()));
}

// Need to enable AX to get the computed role.
if (!WebCore::AXObjectCache::accessibilityEnabled())
WebCore::AXObjectCache::enableAccessibility();

if (AXObjectCache* axObjectCache = node->document().axObjectCache()) {
if (AccessibilityObject* axObject = axObjectCache->getOrCreate(node))
value->setRole(axObject->computedRoleString());
}

return value;
}

Expand Down
4 changes: 3 additions & 1 deletion Source/WebInspectorUI/UserInterface/Models/DOMNode.js
Expand Up @@ -48,7 +48,7 @@ WI.DOMNode = class DOMNode extends WI.Object
this._nodeValue = payload.nodeValue;
this._pseudoType = payload.pseudoType;
this._shadowRootType = payload.shadowRootType;
this._computedRole = payload.role;
this._computedRole = null;
this._contentSecurityPolicyHash = payload.contentSecurityPolicyHash;

if (this._nodeType === Node.DOCUMENT_NODE)
Expand Down Expand Up @@ -586,6 +586,8 @@ WI.DOMNode = class DOMNode extends WI.Object
function accessibilityPropertiesCallback(error, accessibilityProperties)
{
if (!error && callback && accessibilityProperties) {
this._computedRole = accessibilityProperties.role;

callback({
activeDescendantNodeId: accessibilityProperties.activeDescendantNodeId,
busy: accessibilityProperties.busy,
Expand Down

0 comments on commit a1a9eb1

Please sign in to comment.