| OLD | NEW |
| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 AttributeModificationParams& params) { | 429 void HTMLElement::attributeChanged(const AttributeModificationParams& params) { |
| 430 Element::attributeChanged(params); | 430 Element::attributeChanged(params); |
| 431 if (params.reason != AttributeModificationReason::kDirectly) | 431 if (params.reason != AttributeModificationReason::kDirectly) |
| 432 return; | 432 return; |
| 433 if (adjustedFocusedElementInTreeScope() != this) | 433 // adjustedFocusedElementInTreeScope() is not trivial. We should check |
| 434 return; | 434 // attribute names, then call adjustedFocusedElementInTreeScope(). |
| 435 if (params.name == hiddenAttr && !params.newValue.isNull()) { | 435 if (params.name == hiddenAttr && !params.newValue.isNull()) { |
| 436 blur(); | 436 if (adjustedFocusedElementInTreeScope() == this) |
| 437 blur(); |
| 437 } else if (params.name == contenteditableAttr) { | 438 } else if (params.name == contenteditableAttr) { |
| 439 if (adjustedFocusedElementInTreeScope() != this) |
| 440 return; |
| 438 // The attribute change may cause supportsFocus() to return false | 441 // The attribute change may cause supportsFocus() to return false |
| 439 // for the element which had focus. | 442 // for the element which had focus. |
| 440 // | 443 // |
| 441 // TODO(tkent): We should avoid updating style. We'd like to check only | 444 // TODO(tkent): We should avoid updating style. We'd like to check only |
| 442 // DOM-level focusability here. | 445 // DOM-level focusability here. |
| 443 document().updateStyleAndLayoutTreeForNode(this); | 446 document().updateStyleAndLayoutTreeForNode(this); |
| 444 if (!supportsFocus()) | 447 if (!supportsFocus()) |
| 445 blur(); | 448 blur(); |
| 446 } | 449 } |
| 447 } | 450 } |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 | 1215 |
| 1213 #ifndef NDEBUG | 1216 #ifndef NDEBUG |
| 1214 | 1217 |
| 1215 // For use in the debugger | 1218 // For use in the debugger |
| 1216 void dumpInnerHTML(blink::HTMLElement*); | 1219 void dumpInnerHTML(blink::HTMLElement*); |
| 1217 | 1220 |
| 1218 void dumpInnerHTML(blink::HTMLElement* element) { | 1221 void dumpInnerHTML(blink::HTMLElement* element) { |
| 1219 printf("%s\n", element->innerHTML().ascii().data()); | 1222 printf("%s\n", element->innerHTML().ascii().data()); |
| 1220 } | 1223 } |
| 1221 #endif | 1224 #endif |
| OLD | NEW |