Commit ca7cf349 authored by tkent's avatar tkent Committed by Commit bot

Improve performance of HTMLElement::attributeChanged.

Call adjustedFocusedElementInTreeScope() only if the modified attribute can
affect focusability.

BUG=677446

Review-Url: https://codereview.chromium.org/2625903002
Cr-Commit-Position: refs/heads/master@{#442794}
parent 31a3f755
......@@ -430,11 +430,14 @@ void HTMLElement::attributeChanged(const AttributeModificationParams& params) {
Element::attributeChanged(params);
if (params.reason != AttributeModificationReason::kDirectly)
return;
if (adjustedFocusedElementInTreeScope() != this)
return;
// adjustedFocusedElementInTreeScope() is not trivial. We should check
// attribute names, then call adjustedFocusedElementInTreeScope().
if (params.name == hiddenAttr && !params.newValue.isNull()) {
blur();
if (adjustedFocusedElementInTreeScope() == this)
blur();
} else if (params.name == contenteditableAttr) {
if (adjustedFocusedElementInTreeScope() != this)
return;
// The attribute change may cause supportsFocus() to return false
// for the element which had focus.
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment