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

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

Issue 107513013: Remove children of title node before updating (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove children before updateTitle for less title update dispatches Created 7 years 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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 m_titleSetExplicitly = true; 1306 m_titleSetExplicitly = true;
1307 if (!isHTMLDocument() && !isXHTMLDocument()) 1307 if (!isHTMLDocument() && !isXHTMLDocument())
1308 m_titleElement = 0; 1308 m_titleElement = 0;
1309 else if (!m_titleElement) { 1309 else if (!m_titleElement) {
1310 if (HTMLElement* headElement = head()) { 1310 if (HTMLElement* headElement = head()) {
1311 m_titleElement = createElement(titleTag, false); 1311 m_titleElement = createElement(titleTag, false);
1312 headElement->appendChild(m_titleElement); 1312 headElement->appendChild(m_titleElement);
1313 } 1313 }
1314 } 1314 }
1315 1315
1316 if (m_titleElement)
1317 m_titleElement->removeChildren();
1318
1316 updateTitle(title); 1319 updateTitle(title);
1317 1320
1318 if (m_titleElement && isHTMLTitleElement(m_titleElement.get())) 1321 if (m_titleElement && isHTMLTitleElement(m_titleElement.get()))
1319 toHTMLTitleElement(m_titleElement)->setText(title); 1322 toHTMLTitleElement(m_titleElement)->setText(title);
1320 } 1323 }
1321 1324
1322 void Document::setTitleElement(const String& title, Element* titleElement) 1325 void Document::setTitleElement(const String& title, Element* titleElement)
1323 { 1326 {
1324 if (titleElement != m_titleElement) { 1327 if (titleElement != m_titleElement) {
1325 if (m_titleElement || m_titleSetExplicitly) 1328 if (m_titleElement || m_titleSetExplicitly)
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after
5249 } 5252 }
5250 5253
5251 FastTextAutosizer* Document::fastTextAutosizer() 5254 FastTextAutosizer* Document::fastTextAutosizer()
5252 { 5255 {
5253 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5256 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5254 m_fastTextAutosizer = FastTextAutosizer::create(this); 5257 m_fastTextAutosizer = FastTextAutosizer::create(this);
5255 return m_fastTextAutosizer.get(); 5258 return m_fastTextAutosizer.get();
5256 } 5259 }
5257 5260
5258 } // namespace WebCore 5261 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/title-text-property-2-expected.txt ('k') | Source/core/html/HTMLTitleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698