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

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

Issue 2292433002: CL for perf tryjob on linux (Closed)
Patch Set: Created 4 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
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return isHTMLDocument() ? name.lower() : name; 622 return isHTMLDocument() ? name.lower() : name;
623 } 623 }
624 624
625 Element* Document::createElement(const AtomicString& name, ExceptionState& excep tionState) 625 Element* Document::createElement(const AtomicString& name, ExceptionState& excep tionState)
626 { 626 {
627 if (!isValidName(name)) { 627 if (!isValidName(name)) {
628 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + name + "') is not a valid name."); 628 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + name + "') is not a valid name.");
629 return nullptr; 629 return nullptr;
630 } 630 }
631 631
632 if (isXHTMLDocument() || isHTMLDocument()) { 632 if (isXHTMLDocument() || isHTMLDocument())
633 if (CustomElement::shouldCreateCustomElement(name)) 633 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th is, 0, &exceptionState, CreatedByCreateElement);
634 return CustomElement::createCustomElementSync(*this, name, exception State);
635 return HTMLElementFactory::createHTMLElement(convertLocalName(name), *th is, 0, CreatedByCreateElement);
636 }
637 634
638 return Element::create(QualifiedName(nullAtom, name, nullAtom), this); 635 return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
639 } 636 }
640 637
641 Element* Document::createElement(const AtomicString& localName, const AtomicStri ng& typeExtension, ExceptionState& exceptionState) 638 Element* Document::createElement(const AtomicString& localName, const AtomicStri ng& typeExtension, ExceptionState& exceptionState)
642 { 639 {
643 if (!isValidName(localName)) { 640 if (!isValidName(localName)) {
644 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + localName + "') is not a valid name."); 641 exceptionState.throwDOMException(InvalidCharacterError, "The tag name pr ovided ('" + localName + "') is not a valid name.");
645 return nullptr; 642 return nullptr;
646 } 643 }
647 644
648 Element* element; 645 Element* element;
649 646
650 if (CustomElement::shouldCreateCustomElement(localName)) { 647 if (CustomElement::shouldCreateCustomElement(localName)) {
651 element = CustomElement::createCustomElementSync(*this, localName, excep tionState); 648 element = CustomElement::createCustomElementSync(*this, localName, &exce ptionState);
652 } else if (V0CustomElement::isValidName(localName) && registrationContext()) { 649 } else if (V0CustomElement::isValidName(localName) && registrationContext()) {
653 element = registrationContext()->createCustomTagElement(*this, Qualified Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); 650 element = registrationContext()->createCustomTagElement(*this, Qualified Name(nullAtom, convertLocalName(localName), xhtmlNamespaceURI));
654 } else { 651 } else {
655 element = createElement(localName, exceptionState); 652 element = createElement(localName, exceptionState);
656 if (exceptionState.hadException()) 653 if (exceptionState.hadException())
657 return nullptr; 654 return nullptr;
658 } 655 }
659 656
660 if (!typeExtension.isEmpty()) 657 if (!typeExtension.isEmpty())
661 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme nt, typeExtension); 658 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme nt, typeExtension);
(...skipping 16 matching lines...) Expand all
678 return qName; 675 return qName;
679 } 676 }
680 677
681 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi cString& qualifiedName, ExceptionState& exceptionState) 678 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi cString& qualifiedName, ExceptionState& exceptionState)
682 { 679 {
683 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti onState)); 680 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti onState));
684 if (qName == QualifiedName::null()) 681 if (qName == QualifiedName::null())
685 return nullptr; 682 return nullptr;
686 683
687 if (CustomElement::shouldCreateCustomElement(qName)) 684 if (CustomElement::shouldCreateCustomElement(qName))
688 return CustomElement::createCustomElementSync(*this, qName, exceptionSta te); 685 return CustomElement::createCustomElementSync(*this, qName, &exceptionSt ate);
689 return createElement(qName, CreatedByCreateElement); 686 return createElement(qName, CreatedByCreateElement);
690 } 687 }
691 688
692 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep tionState) 689 Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi cString& qualifiedName, const AtomicString& typeExtension, ExceptionState& excep tionState)
693 { 690 {
694 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti onState)); 691 QualifiedName qName(createQualifiedName(namespaceURI, qualifiedName, excepti onState));
695 if (qName == QualifiedName::null()) 692 if (qName == QualifiedName::null())
696 return nullptr; 693 return nullptr;
697 694
698 Element* element; 695 Element* element;
699 if (CustomElement::shouldCreateCustomElement(qName)) 696 if (CustomElement::shouldCreateCustomElement(qName))
700 element = CustomElement::createCustomElementSync(*this, qName, exception State); 697 element = CustomElement::createCustomElementSync(*this, qName, &exceptio nState);
701 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont ext()) 698 else if (V0CustomElement::isValidName(qName.localName()) && registrationCont ext())
702 element = registrationContext()->createCustomTagElement(*this, qName); 699 element = registrationContext()->createCustomTagElement(*this, qName);
703 else 700 else
704 element = createElement(qName, CreatedByCreateElement); 701 element = createElement(qName, CreatedByCreateElement);
705 702
706 if (!typeExtension.isEmpty()) 703 if (!typeExtension.isEmpty())
707 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme nt, typeExtension); 704 V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(eleme nt, typeExtension);
708 705
709 return element; 706 return element;
710 } 707 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 return hasValidNamespaceForElements(qName); 953 return hasValidNamespaceForElements(qName);
957 } 954 }
958 955
959 // FIXME: This should really be in a possible ElementFactory class 956 // FIXME: This should really be in a possible ElementFactory class
960 Element* Document::createElement(const QualifiedName& qName, CreateElementFlags flags) 957 Element* Document::createElement(const QualifiedName& qName, CreateElementFlags flags)
961 { 958 {
962 Element* e = nullptr; 959 Element* e = nullptr;
963 960
964 // FIXME: Use registered namespaces and look up in a hash to find the right factory. 961 // FIXME: Use registered namespaces and look up in a hash to find the right factory.
965 if (qName.namespaceURI() == xhtmlNamespaceURI) 962 if (qName.namespaceURI() == xhtmlNamespaceURI)
966 e = HTMLElementFactory::createHTMLElement(qName.localName(), *this, 0, f lags); 963 e = HTMLElementFactory::createHTMLElement(qName.localName(), *this, 0, 0 , flags);
967 else if (qName.namespaceURI() == SVGNames::svgNamespaceURI) 964 else if (qName.namespaceURI() == SVGNames::svgNamespaceURI)
968 e = SVGElementFactory::createSVGElement(qName.localName(), *this, flags) ; 965 e = SVGElementFactory::createSVGElement(qName.localName(), *this, flags) ;
969 966
970 if (e) 967 if (e)
971 m_sawElementsInKnownNamespaces = true; 968 m_sawElementsInKnownNamespaces = true;
972 else 969 else
973 e = Element::create(qName, this); 970 e = Element::create(qName, this);
974 971
975 if (e->prefix() != qName.prefix()) 972 if (e->prefix() != qName.prefix())
976 e->setTagNameForCreateElementNS(qName); 973 e->setTagNameForCreateElementNS(qName);
(...skipping 5073 matching lines...) Expand 10 before | Expand all | Expand 10 after
6050 } 6047 }
6051 6048
6052 void showLiveDocumentInstances() 6049 void showLiveDocumentInstances()
6053 { 6050 {
6054 WeakDocumentSet& set = liveDocumentSet(); 6051 WeakDocumentSet& set = liveDocumentSet();
6055 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6052 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6056 for (Document* document : set) 6053 for (Document* document : set)
6057 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6054 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6058 } 6055 }
6059 #endif 6056 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698