Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLElement.cpp

Issue 2586143004: Blur immediately if an attribute change made an element unfocasable. (Closed)
Patch Set: Update comments and a function name Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 {onwheelAttr, EventTypeNames::wheel}, 419 {onwheelAttr, EventTypeNames::wheel},
420 }; 420 };
421 421
422 for (const auto& name : attrToEventNames) 422 for (const auto& name : attrToEventNames)
423 attributeNameToEventNameMap.set(name.attr.localName(), name.event); 423 attributeNameToEventNameMap.set(name.attr.localName(), name.event);
424 } 424 }
425 425
426 return attributeNameToEventNameMap.get(attrName.localName()); 426 return attributeNameToEventNameMap.get(attrName.localName());
427 } 427 }
428 428
429 void HTMLElement::attributeChanged(const QualifiedName& name,
430 const AtomicString& oldValue,
431 const AtomicString& newValue,
432 AttributeModificationReason reason) {
433 Element::attributeChanged(name, oldValue, newValue, reason);
434 if (reason != AttributeModificationReason::kDirectly)
435 return;
436 if (adjustedFocusedElementInTreeScope() != this)
437 return;
438 if (name == hiddenAttr && !newValue.isNull()) {
439 blur();
440 } else if (name == contenteditableAttr) {
441 // The attribute change may cause supportsFocus() to return false
442 // for the element which had focus.
443 //
444 // TODO(tkent): We should avoid updating style. We'd like to check only
445 // DOM-level focusability here.
446 document().updateStyleAndLayoutTreeForNode(this);
447 if (!supportsFocus())
448 blur();
449 }
450 }
451
429 void HTMLElement::parseAttribute(const QualifiedName& name, 452 void HTMLElement::parseAttribute(const QualifiedName& name,
430 const AtomicString& oldValue, 453 const AtomicString& oldValue,
431 const AtomicString& value) { 454 const AtomicString& value) {
432 if (name == tabindexAttr || name == XMLNames::langAttr) 455 if (name == tabindexAttr || name == XMLNames::langAttr)
433 return Element::parseAttribute(name, oldValue, value); 456 return Element::parseAttribute(name, oldValue, value);
434 457
435 if (name == dirAttr) { 458 if (name == dirAttr) {
436 dirAttributeChanged(value); 459 dirAttributeChanged(value);
437 } else if (name == langAttr) { 460 } else if (name == langAttr) {
438 pseudoStateChanged(CSSSelector::PseudoLang); 461 pseudoStateChanged(CSSSelector::PseudoLang);
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 1215
1193 #ifndef NDEBUG 1216 #ifndef NDEBUG
1194 1217
1195 // For use in the debugger 1218 // For use in the debugger
1196 void dumpInnerHTML(blink::HTMLElement*); 1219 void dumpInnerHTML(blink::HTMLElement*);
1197 1220
1198 void dumpInnerHTML(blink::HTMLElement* element) { 1221 void dumpInnerHTML(blink::HTMLElement* element) {
1199 printf("%s\n", element->innerHTML().ascii().data()); 1222 printf("%s\n", element->innerHTML().ascii().data());
1200 } 1223 }
1201 #endif 1224 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLElement.h ('k') | third_party/WebKit/Source/core/html/HTMLFieldSetElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698