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

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

Issue 23886003: Have HTMLElements / SVGElements constructors take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Another Android build fix Created 7 years, 3 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 | Annotate | Revision Log
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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es) 715 PassRefPtr<Element> Document::createElement(const AtomicString& localName, const AtomicString& typeExtension, ExceptionState& es)
716 { 716 {
717 if (!isValidName(localName)) { 717 if (!isValidName(localName)) {
718 es.throwDOMException(InvalidCharacterError); 718 es.throwDOMException(InvalidCharacterError);
719 return 0; 719 return 0;
720 } 720 }
721 721
722 RefPtr<Element> element; 722 RefPtr<Element> element;
723 723
724 if (CustomElement::isValidName(localName) && registrationContext()) 724 if (CustomElement::isValidName(localName) && registrationContext())
725 element = registrationContext()->createCustomTagElement(this, QualifiedN ame(nullAtom, localName, xhtmlNamespaceURI)); 725 element = registrationContext()->createCustomTagElement(*this, Qualified Name(nullAtom, localName, xhtmlNamespaceURI));
726 else 726 else
727 element = createElement(localName, es); 727 element = createElement(localName, es);
728 728
729 if (!typeExtension.isNull() && !typeExtension.isEmpty()) 729 if (!typeExtension.isNull() && !typeExtension.isEmpty())
730 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension); 730 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension);
731 731
732 return element; 732 return element;
733 } 733 }
734 734
735 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState& es) 735 PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionState& es)
736 { 736 {
737 String prefix, localName; 737 String prefix, localName;
738 if (!parseQualifiedName(qualifiedName, prefix, localName, es)) 738 if (!parseQualifiedName(qualifiedName, prefix, localName, es))
739 return 0; 739 return 0;
740 740
741 QualifiedName qName(prefix, localName, namespaceURI); 741 QualifiedName qName(prefix, localName, namespaceURI);
742 if (!hasValidNamespaceForElements(qName)) { 742 if (!hasValidNamespaceForElements(qName)) {
743 es.throwDOMException(NamespaceError); 743 es.throwDOMException(NamespaceError);
744 return 0; 744 return 0;
745 } 745 }
746 746
747 RefPtr<Element> element; 747 RefPtr<Element> element;
748 if (CustomElement::isValidName(qName.localName()) && registrationContext()) 748 if (CustomElement::isValidName(qName.localName()) && registrationContext())
749 element = registrationContext()->createCustomTagElement(this, qName); 749 element = registrationContext()->createCustomTagElement(*this, qName);
750 else 750 else
751 element = createElementNS(namespaceURI, qualifiedName, es); 751 element = createElementNS(namespaceURI, qualifiedName, es);
752 752
753 if (!typeExtension.isNull() && !typeExtension.isEmpty()) 753 if (!typeExtension.isNull() && !typeExtension.isEmpty())
754 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension); 754 CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element .get(), typeExtension);
755 755
756 return element; 756 return element;
757 } 757 }
758 758
759 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, ExceptionState& es) 759 ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS tring& name, ExceptionState& es)
(...skipping 3815 matching lines...) Expand 10 before | Expand all | Expand 10 after
4575 if (!element) 4575 if (!element)
4576 return 0; 4576 return 0;
4577 element->setSize(IntSize(width, height)); 4577 element->setSize(IntSize(width, height));
4578 return element->getContext(type); 4578 return element->getContext(type);
4579 } 4579 }
4580 4580
4581 HTMLCanvasElement* Document::getCSSCanvasElement(const String& name) 4581 HTMLCanvasElement* Document::getCSSCanvasElement(const String& name)
4582 { 4582 {
4583 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, 0).iterat or->value; 4583 RefPtr<HTMLCanvasElement>& element = m_cssCanvasElements.add(name, 0).iterat or->value;
4584 if (!element) { 4584 if (!element) {
4585 element = HTMLCanvasElement::create(this); 4585 element = HTMLCanvasElement::create(*this);
4586 element->setAccelerationDisabled(true); 4586 element->setAccelerationDisabled(true);
4587 } 4587 }
4588 return element.get(); 4588 return element.get();
4589 } 4589 }
4590 4590
4591 void Document::initDNSPrefetch() 4591 void Document::initDNSPrefetch()
4592 { 4592 {
4593 Settings* settings = this->settings(); 4593 Settings* settings = this->settings();
4594 4594
4595 m_haveExplicitlyDisabledDNSPrefetch = false; 4595 m_haveExplicitlyDisabledDNSPrefetch = false;
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 { 5321 {
5322 return DocumentLifecycleNotifier::create(this); 5322 return DocumentLifecycleNotifier::create(this);
5323 } 5323 }
5324 5324
5325 DocumentLifecycleNotifier* Document::lifecycleNotifier() 5325 DocumentLifecycleNotifier* Document::lifecycleNotifier()
5326 { 5326 {
5327 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); 5327 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier());
5328 } 5328 }
5329 5329
5330 } // namespace WebCore 5330 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/CustomElementRegistrationContext.cpp ('k') | Source/core/dom/shadow/InsertionPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698