Index: third_party/WebKit/Source/core/svg/SVGTitleElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp b/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp |
index 062cdb539a6fd0a4641394a655071217b97a5259..3a19dc940210eda4f7042815c0d8c54bc74470bc 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp |
@@ -21,12 +21,15 @@ |
#include "core/svg/SVGTitleElement.h" |
#include "core/SVGNames.h" |
+#include "core/dom/ChildListMutationScope.h" |
#include "core/dom/Document.h" |
+#include "core/dom/Text.h" |
namespace blink { |
inline SVGTitleElement::SVGTitleElement(Document& document) |
: SVGElement(SVGNames::titleTag, document) |
+ , m_ignoreTitleUpdatesWhenChildrenChange(false) |
{ |
} |
@@ -52,8 +55,22 @@ void SVGTitleElement::removedFrom(ContainerNode* rootParent) |
void SVGTitleElement::childrenChanged(const ChildrenChange& change) |
{ |
SVGElement::childrenChanged(change); |
- if (inDocument() && document().isSVGDocument()) |
+ if (inDocument() && document().isSVGDocument() && !m_ignoreTitleUpdatesWhenChildrenChange) |
document().setTitleElement(this); |
} |
+void SVGTitleElement::setText(const String &value) |
fs
2016/03/03 15:49:44
String& (not String &)
hyunjunekim2
2016/03/04 11:29:32
Done.
|
+{ |
+ RefPtrWillBeRawPtr<Node> protectFromMutationEvents(this); |
+ ChildListMutationScope mutation(*this); |
+ |
+ // Avoid calling Document::setTitleElement() during intermediate steps. |
+ m_ignoreTitleUpdatesWhenChildrenChange = !value.isEmpty(); |
fs
2016/03/03 15:49:45
Could also do this as:
{
// ...
Temporary
hyunjunekim2
2016/03/04 11:29:32
Done.
|
+ removeChildren(OmitSubtreeModifiedEvent); |
+ m_ignoreTitleUpdatesWhenChildrenChange = false; |
+ |
+ if (!value.isEmpty()) |
+ appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION); |
+} |
+ |
} // namespace blink |