| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 429 void HTMLElement::attributeChanged(const AttributeModificationParams& params) { |
| 430 const AtomicString& oldValue, | 430 Element::attributeChanged(params); |
| 431 const AtomicString& newValue, | 431 if (params.reason != AttributeModificationReason::kDirectly) |
| 432 AttributeModificationReason reason) { | |
| 433 Element::attributeChanged(name, oldValue, newValue, reason); | |
| 434 if (reason != AttributeModificationReason::kDirectly) | |
| 435 return; | 432 return; |
| 436 if (adjustedFocusedElementInTreeScope() != this) | 433 if (adjustedFocusedElementInTreeScope() != this) |
| 437 return; | 434 return; |
| 438 if (name == hiddenAttr && !newValue.isNull()) { | 435 if (params.name == hiddenAttr && !params.newValue.isNull()) { |
| 439 blur(); | 436 blur(); |
| 440 } else if (name == contenteditableAttr) { | 437 } else if (params.name == contenteditableAttr) { |
| 441 // The attribute change may cause supportsFocus() to return false | 438 // The attribute change may cause supportsFocus() to return false |
| 442 // for the element which had focus. | 439 // for the element which had focus. |
| 443 // | 440 // |
| 444 // TODO(tkent): We should avoid updating style. We'd like to check only | 441 // TODO(tkent): We should avoid updating style. We'd like to check only |
| 445 // DOM-level focusability here. | 442 // DOM-level focusability here. |
| 446 document().updateStyleAndLayoutTreeForNode(this); | 443 document().updateStyleAndLayoutTreeForNode(this); |
| 447 if (!supportsFocus()) | 444 if (!supportsFocus()) |
| 448 blur(); | 445 blur(); |
| 449 } | 446 } |
| 450 } | 447 } |
| 451 | 448 |
| 452 void HTMLElement::parseAttribute(const QualifiedName& name, | 449 void HTMLElement::parseAttribute(const AttributeModificationParams& params) { |
| 453 const AtomicString& oldValue, | 450 if (params.name == tabindexAttr || params.name == XMLNames::langAttr) |
| 454 const AtomicString& value) { | 451 return Element::parseAttribute(params); |
| 455 if (name == tabindexAttr || name == XMLNames::langAttr) | |
| 456 return Element::parseAttribute(name, oldValue, value); | |
| 457 | 452 |
| 458 if (name == dirAttr) { | 453 if (params.name == dirAttr) { |
| 459 dirAttributeChanged(value); | 454 dirAttributeChanged(params.newValue); |
| 460 } else if (name == langAttr) { | 455 } else if (params.name == langAttr) { |
| 461 pseudoStateChanged(CSSSelector::PseudoLang); | 456 pseudoStateChanged(CSSSelector::PseudoLang); |
| 462 } else { | 457 } else { |
| 463 const AtomicString& eventName = eventNameForAttributeName(name); | 458 const AtomicString& eventName = eventNameForAttributeName(params.name); |
| 464 if (!eventName.isNull()) | 459 if (!eventName.isNull()) { |
| 465 setAttributeEventListener( | 460 setAttributeEventListener( |
| 466 eventName, createAttributeEventListener(this, name, value, | 461 eventName, |
| 467 eventParameterName())); | 462 createAttributeEventListener(this, params.name, params.newValue, |
| 463 eventParameterName())); |
| 464 } |
| 468 } | 465 } |
| 469 } | 466 } |
| 470 | 467 |
| 471 DocumentFragment* HTMLElement::textToFragment(const String& text, | 468 DocumentFragment* HTMLElement::textToFragment(const String& text, |
| 472 ExceptionState& exceptionState) { | 469 ExceptionState& exceptionState) { |
| 473 DocumentFragment* fragment = DocumentFragment::create(document()); | 470 DocumentFragment* fragment = DocumentFragment::create(document()); |
| 474 unsigned i, length = text.length(); | 471 unsigned i, length = text.length(); |
| 475 UChar c = 0; | 472 UChar c = 0; |
| 476 for (unsigned start = 0; start < length;) { | 473 for (unsigned start = 0; start < length;) { |
| 477 // Find next line break. | 474 // Find next line break. |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 | 1212 |
| 1216 #ifndef NDEBUG | 1213 #ifndef NDEBUG |
| 1217 | 1214 |
| 1218 // For use in the debugger | 1215 // For use in the debugger |
| 1219 void dumpInnerHTML(blink::HTMLElement*); | 1216 void dumpInnerHTML(blink::HTMLElement*); |
| 1220 | 1217 |
| 1221 void dumpInnerHTML(blink::HTMLElement* element) { | 1218 void dumpInnerHTML(blink::HTMLElement* element) { |
| 1222 printf("%s\n", element->innerHTML().ascii().data()); | 1219 printf("%s\n", element->innerHTML().ascii().data()); |
| 1223 } | 1220 } |
| 1224 #endif | 1221 #endif |
| OLD | NEW |