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

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

Issue 161753003: Use more direct Element creation methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | 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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& exceptionState) 706 PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionS tate& exceptionState)
707 { 707 {
708 if (!isValidName(name)) { 708 if (!isValidName(name)) {
709 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + name + "') is not a valid name."); 709 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + name + "') is not a valid name.");
710 return 0; 710 return 0;
711 } 711 }
712 712
713 if (isXHTMLDocument() || isHTMLDocument()) 713 if (isXHTMLDocument() || isHTMLDocument())
714 return HTMLElementFactory::createHTMLElement(isHTMLDocument() ? name.low er() : name, *this, 0, false); 714 return HTMLElementFactory::createHTMLElement(isHTMLDocument() ? name.low er() : name, *this, 0, false);
715 715
716 return createElement(QualifiedName(nullAtom, name, nullAtom), false); 716 return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
717 } 717 }
718 718
719 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& exceptionState) 719 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& exceptionState)
720 { 720 {
721 if (!isValidName(localName)) { 721 if (!isValidName(localName)) {
722 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + localName + "') is not a valid name."); 722 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + localName + "') is not a valid name.");
723 return 0; 723 return 0;
724 } 724 }
725 725
726 RefPtr<Element> element; 726 RefPtr<Element> element;
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 } 1330 }
1331 1331
1332 void Document::setTitle(const String& title) 1332 void Document::setTitle(const String& title)
1333 { 1333 {
1334 // Title set by JavaScript -- overrides any title elements. 1334 // Title set by JavaScript -- overrides any title elements.
1335 m_titleSetExplicitly = true; 1335 m_titleSetExplicitly = true;
1336 if (!isHTMLDocument() && !isXHTMLDocument()) 1336 if (!isHTMLDocument() && !isXHTMLDocument())
1337 m_titleElement = 0; 1337 m_titleElement = 0;
1338 else if (!m_titleElement) { 1338 else if (!m_titleElement) {
1339 if (HTMLElement* headElement = head()) { 1339 if (HTMLElement* headElement = head()) {
1340 m_titleElement = createElement(titleTag, false); 1340 m_titleElement = HTMLTitleElement::create(*this);
Inactive 2014/02/13 17:26:22 This no longer updates m_sawElementsInKnownNamespa
1341 headElement->appendChild(m_titleElement); 1341 headElement->appendChild(m_titleElement);
1342 } 1342 }
1343 } 1343 }
1344 1344
1345 if (m_titleElement && m_titleElement->hasTagName(titleTag)) 1345 if (m_titleElement && m_titleElement->hasTagName(titleTag))
1346 toHTMLTitleElement(m_titleElement)->setText(title); 1346 toHTMLTitleElement(m_titleElement)->setText(title);
1347 else 1347 else
1348 updateTitle(title); 1348 updateTitle(title);
1349 } 1349 }
1350 1350
(...skipping 4097 matching lines...) Expand 10 before | Expand all | Expand 10 after
5448 void Document::defaultEventHandler(Event* event) 5448 void Document::defaultEventHandler(Event* event)
5449 { 5449 {
5450 if (frame() && frame()->remotePlatformLayer()) { 5450 if (frame() && frame()->remotePlatformLayer()) {
5451 frame()->chromeClient().forwardInputEvent(this, event); 5451 frame()->chromeClient().forwardInputEvent(this, event);
5452 return; 5452 return;
5453 } 5453 }
5454 Node::defaultEventHandler(event); 5454 Node::defaultEventHandler(event);
5455 } 5455 }
5456 5456
5457 } // namespace WebCore 5457 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698