Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: Source/core/dom/Document.cpp

Issue 128603002: Inhibit title update when removing children before setting new value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 m_titleSetExplicitly = true; 1299 m_titleSetExplicitly = true;
1300 if (!isHTMLDocument() && !isXHTMLDocument()) 1300 if (!isHTMLDocument() && !isXHTMLDocument())
1301 m_titleElement = 0; 1301 m_titleElement = 0;
1302 else if (!m_titleElement) { 1302 else if (!m_titleElement) {
1303 if (HTMLElement* headElement = head()) { 1303 if (HTMLElement* headElement = head()) {
1304 m_titleElement = createElement(titleTag, false); 1304 m_titleElement = createElement(titleTag, false);
1305 headElement->appendChild(m_titleElement); 1305 headElement->appendChild(m_titleElement);
1306 } 1306 }
1307 } 1307 }
1308 1308
1309 if (m_titleElement) 1309 if (m_titleElement && m_titleElement->hasTagName(titleTag)) {
1310 IgnoreTitleUpdatesWhenChildrenChange inhibitor(toHTMLTitleElement(m_titl eElement));
1310 m_titleElement->removeChildren(); 1311 m_titleElement->removeChildren();
1312 }
1311 1313
1312 updateTitle(title); 1314 updateTitle(title);
1313 1315
1314 if (m_titleElement && m_titleElement->hasTagName(titleTag)) 1316 if (m_titleElement && m_titleElement->hasTagName(titleTag))
1315 toHTMLTitleElement(m_titleElement)->setText(title); 1317 toHTMLTitleElement(m_titleElement)->setText(title);
jochen (gone - plz use gerrit) 2014/01/09 12:17:33 since setText() will also remove the children, wha
davve 2014/01/09 12:31:00 setText() will only remove the children when !(num
1316 } 1318 }
1317 1319
1318 void Document::setTitleElement(const String& title, Element* titleElement) 1320 void Document::setTitleElement(const String& title, Element* titleElement)
1319 { 1321 {
1320 if (titleElement != m_titleElement) { 1322 if (titleElement != m_titleElement) {
1321 if (m_titleElement || m_titleSetExplicitly) 1323 if (m_titleElement || m_titleSetExplicitly)
1322 // Only allow the first title element to change the title -- others have no effect. 1324 // Only allow the first title element to change the title -- others have no effect.
1323 return; 1325 return;
1324 m_titleElement = titleElement; 1326 m_titleElement = titleElement;
1325 } 1327 }
(...skipping 3941 matching lines...) Expand 10 before | Expand all | Expand 10 after
5267 } 5269 }
5268 5270
5269 FastTextAutosizer* Document::fastTextAutosizer() 5271 FastTextAutosizer* Document::fastTextAutosizer()
5270 { 5272 {
5271 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5273 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5272 m_fastTextAutosizer = FastTextAutosizer::create(this); 5274 m_fastTextAutosizer = FastTextAutosizer::create(this);
5273 return m_fastTextAutosizer.get(); 5275 return m_fastTextAutosizer.get();
5274 } 5276 }
5275 5277
5276 } // namespace WebCore 5278 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698