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

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: Rebased 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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 m_titleSetExplicitly = true; 1298 m_titleSetExplicitly = true;
1299 if (!isHTMLDocument() && !isXHTMLDocument()) 1299 if (!isHTMLDocument() && !isXHTMLDocument())
1300 m_titleElement = 0; 1300 m_titleElement = 0;
1301 else if (!m_titleElement) { 1301 else if (!m_titleElement) {
1302 if (HTMLElement* headElement = head()) { 1302 if (HTMLElement* headElement = head()) {
1303 m_titleElement = createElement(titleTag, false); 1303 m_titleElement = createElement(titleTag, false);
1304 headElement->appendChild(m_titleElement); 1304 headElement->appendChild(m_titleElement);
1305 } 1305 }
1306 } 1306 }
1307 1307
1308 if (m_titleElement)
1309 m_titleElement->removeChildren();
1310
1311 updateTitle(title);
1312
1313 if (m_titleElement && m_titleElement->hasTagName(titleTag)) 1308 if (m_titleElement && m_titleElement->hasTagName(titleTag))
1314 toHTMLTitleElement(m_titleElement)->setText(title); 1309 toHTMLTitleElement(m_titleElement)->setText(title);
1310 else
1311 updateTitle(title);
1315 } 1312 }
1316 1313
1317 void Document::setTitleElement(const String& title, Element* titleElement) 1314 void Document::setTitleElement(const String& title, Element* titleElement)
1318 { 1315 {
1319 if (titleElement != m_titleElement) { 1316 if (titleElement != m_titleElement) {
1320 if (m_titleElement || m_titleSetExplicitly) 1317 if (m_titleElement || m_titleSetExplicitly)
1321 // Only allow the first title element to change the title -- others have no effect. 1318 // Only allow the first title element to change the title -- others have no effect.
1322 return; 1319 return;
1323 m_titleElement = titleElement; 1320 m_titleElement = titleElement;
1324 } 1321 }
(...skipping 3945 matching lines...) Expand 10 before | Expand all | Expand 10 after
5270 } 5267 }
5271 5268
5272 FastTextAutosizer* Document::fastTextAutosizer() 5269 FastTextAutosizer* Document::fastTextAutosizer()
5273 { 5270 {
5274 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5271 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5275 m_fastTextAutosizer = FastTextAutosizer::create(this); 5272 m_fastTextAutosizer = FastTextAutosizer::create(this);
5276 return m_fastTextAutosizer.get(); 5273 return m_fastTextAutosizer.get();
5277 } 5274 }
5278 5275
5279 } // namespace WebCore 5276 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/title-text-property-3-expected.txt ('k') | Source/core/html/HTMLTitleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698