Attr: Simplify modification callbacks.
authorakling <akling@apple.com>
Sat, 23 Feb 2013 04:47:20 +0000 (04:47 +0000)
committerakling <akling@apple.com>
Sat, 23 Feb 2013 04:47:20 +0000 (04:47 +0000)
commit38de4729b11f05f797bb5844d8cd45ba903a4a7f
treed032857b14e5517c977a68a1e2a1bc568b26691f
parent9433da736236f6411b417580dc4e478915397c0b
Attr: Simplify modification callbacks.
<http://webkit.org/b/110598>

Reviewed by Antti Koivisto.

Instead of Attr being a friend of Element and grabbing at various internal storage and callbacks,
let Attr simply call Element::setAttribute() when its value is changed, and do all that business
from Element.

* dom/Element.h:
* dom/Element.cpp:
(WebCore::Element::setAttributeInternal):

    Call Attr::recreateTextChildAfterAttributeValueChanged() after modifying an attribute value instead
    of doing the modification through the Attr node.

* dom/Attr.h:
* dom/Attr.cpp:
(WebCore::Attr::Attr):
(WebCore::Attr::childrenChanged):

    Added an m_inChildrenChanged flag so we can prevent infinite callback recursion in childrenChanged().

(WebCore::Attr::setValue):

    Call Element::setAttribute() instead of modifying the attribute storage directly.

(WebCore::Attr::recreateTextChildAfterAttributeValueChanged):

    Factored out the "remove all children / create a new text child with attribute value" logic into
    a separate function.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143834 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/Attr.cpp
Source/WebCore/dom/Attr.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h