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

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

Issue 98373012: Don't set document.title when there is no <head> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « LayoutTests/fast/dom/document-set-title-no-head-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 else if (m_rawTitle.is8Bit()) 1293 else if (m_rawTitle.is8Bit())
1294 m_title = canonicalizedTitle<LChar>(this, m_rawTitle); 1294 m_title = canonicalizedTitle<LChar>(this, m_rawTitle);
1295 else 1295 else
1296 m_title = canonicalizedTitle<UChar>(this, m_rawTitle); 1296 m_title = canonicalizedTitle<UChar>(this, m_rawTitle);
1297 1297
1298 if (!m_frame || oldTitle == m_title) 1298 if (!m_frame || oldTitle == m_title)
1299 return; 1299 return;
1300 m_frame->loader().client()->dispatchDidReceiveTitle(m_title); 1300 m_frame->loader().client()->dispatchDidReceiveTitle(m_title);
1301 } 1301 }
1302 1302
1303 // http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#document .title
davve 2013/12/20 14:39:13 I'm a bit unsure about adding this line. It's usef
jochen (gone - plz use gerrit) 2014/01/03 11:04:45 I think it's fine to leave this in
1303 void Document::setTitle(const String& title) 1304 void Document::setTitle(const String& title)
1304 { 1305 {
1305 // Title set by JavaScript -- overrides any title elements.
1306 m_titleSetExplicitly = true;
1307 if (!isHTMLDocument() && !isXHTMLDocument()) 1306 if (!isHTMLDocument() && !isXHTMLDocument())
1308 m_titleElement = 0; 1307 m_titleElement = 0;
1309 else if (!m_titleElement) { 1308 else if (!m_titleElement) {
1310 if (HTMLElement* headElement = head()) { 1309 if (HTMLElement* headElement = head()) {
1311 m_titleElement = createElement(titleTag, false); 1310 m_titleElement = createElement(titleTag, false);
1312 headElement->appendChild(m_titleElement); 1311 headElement->appendChild(m_titleElement);
1312 } else {
1313 // "If the title element is null and the head element is null, then the attribute must do nothing."
1314 return;
1313 } 1315 }
1314 } 1316 }
1317 m_titleSetExplicitly = true;
1315 1318
1316 if (m_titleElement) 1319 if (m_titleElement)
1317 m_titleElement->removeChildren(); 1320 m_titleElement->removeChildren();
1318 1321
1319 updateTitle(title); 1322 updateTitle(title);
1320 1323
1321 if (m_titleElement && isHTMLTitleElement(m_titleElement.get())) 1324 if (m_titleElement && isHTMLTitleElement(m_titleElement.get()))
1322 toHTMLTitleElement(m_titleElement)->setText(title); 1325 toHTMLTitleElement(m_titleElement)->setText(title);
1323 } 1326 }
1324 1327
(...skipping 3927 matching lines...) Expand 10 before | Expand all | Expand 10 after
5252 } 5255 }
5253 5256
5254 FastTextAutosizer* Document::fastTextAutosizer() 5257 FastTextAutosizer* Document::fastTextAutosizer()
5255 { 5258 {
5256 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d()) 5259 if (!m_fastTextAutosizer && RuntimeEnabledFeatures::fastTextAutosizingEnable d())
5257 m_fastTextAutosizer = FastTextAutosizer::create(this); 5260 m_fastTextAutosizer = FastTextAutosizer::create(this);
5258 return m_fastTextAutosizer.get(); 5261 return m_fastTextAutosizer.get();
5259 } 5262 }
5260 5263
5261 } // namespace WebCore 5264 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/document-set-title-no-head-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698