Index: Source/core/html/HTMLTitleElement.cpp |
diff --git a/Source/core/html/HTMLTitleElement.cpp b/Source/core/html/HTMLTitleElement.cpp |
index fc50fdc83c2fa64a66f3baf86492d44b4e87217b..8e6ca9aa5348cb9bccdf3d7bd69fe7e535ee3bbd 100644 |
--- a/Source/core/html/HTMLTitleElement.cpp |
+++ b/Source/core/html/HTMLTitleElement.cpp |
@@ -37,6 +37,7 @@ using namespace HTMLNames; |
inline HTMLTitleElement::HTMLTitleElement(Document& document) |
: HTMLElement(titleTag, document) |
+ , m_ignoreTitleUpdatesWhenChildrenChange(false) |
{ |
setHasCustomStyleCallbacks(); |
ScriptWrappable::init(this); |
@@ -65,7 +66,7 @@ void HTMLTitleElement::removedFrom(ContainerNode* insertionPoint) |
void HTMLTitleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) |
{ |
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); |
- if (inDocument() && !isInShadowTree()) |
+ if (inDocument() && !isInShadowTree() && !m_ignoreTitleUpdatesWhenChildrenChange) |
document().setTitleElement(text(), this); |
} |
@@ -90,15 +91,12 @@ void HTMLTitleElement::setText(const String &value) |
if (numChildren == 1 && firstChild()->isTextNode()) |
toText(firstChild())->setData(value); |
else { |
- // We make a copy here because entity of "value" argument can be Document::m_title, |
- // which goes empty during removeChildren() invocation below, |
- // which causes HTMLTitleElement::childrenChanged(), which ends up in Document::setTitleElement(). |
- String valueCopy(value); |
- |
- if (numChildren > 0) |
+ if (numChildren > 0) { |
+ IgnoreTitleUpdatesWhenChildrenChange inhibitor(this); |
jochen (gone - plz use gerrit)
2014/01/09 12:17:33
here you can then set the bool directly and don't
|
removeChildren(); |
+ } |
- appendChild(document().createTextNode(valueCopy.impl()), IGNORE_EXCEPTION); |
+ appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION); |
} |
} |