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

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

Issue 139313009: Remove children of title element before setting new title (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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 m_titleSetExplicitly = true; 1292 m_titleSetExplicitly = true;
1293 if (!isHTMLDocument() && !isXHTMLDocument()) 1293 if (!isHTMLDocument() && !isXHTMLDocument())
1294 m_titleElement = 0; 1294 m_titleElement = 0;
1295 else if (!m_titleElement) { 1295 else if (!m_titleElement) {
1296 if (HTMLElement* headElement = head()) { 1296 if (HTMLElement* headElement = head()) {
1297 m_titleElement = createElement(titleTag, false); 1297 m_titleElement = createElement(titleTag, false);
1298 headElement->appendChild(m_titleElement); 1298 headElement->appendChild(m_titleElement);
1299 } 1299 }
1300 } 1300 }
1301 1301
1302 updateTitle(title);
1303
1304 if (m_titleElement && m_titleElement->hasTagName(titleTag)) 1302 if (m_titleElement && m_titleElement->hasTagName(titleTag))
1305 toHTMLTitleElement(m_titleElement)->setText(title); 1303 toHTMLTitleElement(m_titleElement)->setText(title);
1304 else
1305 updateTitle(title);
1306 } 1306 }
1307 1307
1308 void Document::setTitleElement(const String& title, Element* titleElement) 1308 void Document::setTitleElement(const String& title, Element* titleElement)
1309 { 1309 {
1310 if (titleElement != m_titleElement) { 1310 if (titleElement != m_titleElement) {
1311 if (m_titleElement || m_titleSetExplicitly) 1311 if (m_titleElement || m_titleSetExplicitly)
1312 // Only allow the first title element to change the title -- others have no effect. 1312 // Only allow the first title element to change the title -- others have no effect.
1313 return; 1313 return;
1314 m_titleElement = titleElement; 1314 m_titleElement = titleElement;
1315 } 1315 }
(...skipping 3928 matching lines...) Expand 10 before | Expand all | Expand 10 after
5244 } 5244 }
5245 5245
5246 FastTextAutosizer* Document::fastTextAutosizer() 5246 FastTextAutosizer* Document::fastTextAutosizer()
5247 { 5247 {
5248 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5248 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5249 m_fastTextAutosizer = FastTextAutosizer::create(this); 5249 m_fastTextAutosizer = FastTextAutosizer::create(this);
5250 return m_fastTextAutosizer.get(); 5250 return m_fastTextAutosizer.get();
5251 } 5251 }
5252 5252
5253 } // namespace WebCore 5253 } // 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