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

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
« no previous file with comments | « Source/core/html/HTMLDialogElement.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | 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 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alte rnative. 510 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alte rnative.
511 ec = NotSupportedError; 511 ec = NotSupportedError;
512 return 0; 512 return 0;
513 } 513 }
514 514
515 Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi ld, ExceptionCode& ec) 515 Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi ld, ExceptionCode& ec)
516 { 516 {
517 if (!newChild) { 517 if (!newChild) {
518 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative. 518 // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
519 ec = TYPE_MISMATCH_ERR; 519 ec = TypeMismatchError;
520 return 0; 520 return 0;
521 } 521 }
522 522
523 Node* returnValue = insertAdjacent(where, newChild, ec); 523 Node* returnValue = insertAdjacent(where, newChild, ec);
524 ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || returnValue->isElementNode( )); 524 ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || returnValue->isElementNode( ));
525 return toElement(returnValue); 525 return toElement(returnValue);
526 } 526 }
527 527
528 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml() 528 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in -html-documents.html#insertadjacenthtml()
529 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec) 529 static Element* contextElementForInsertion(const String& where, Element* element , ExceptionCode& ec)
530 { 530 {
531 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) { 531 if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "aft erEnd")) {
532 ContainerNode* parent = element->parentNode(); 532 ContainerNode* parent = element->parentNode();
533 if (parent && !parent->isElementNode()) { 533 if (parent && !parent->isElementNode()) {
534 ec = NoModificationAllowedError; 534 ec = NoModificationAllowedError;
535 return 0; 535 return 0;
536 } 536 }
537 ASSERT_WITH_SECURITY_IMPLICATION(!parent || parent->isElementNode()); 537 ASSERT_WITH_SECURITY_IMPLICATION(!parent || parent->isElementNode());
538 return toElement(parent); 538 return toElement(parent);
539 } 539 }
540 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd")) 540 if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "befo reEnd"))
541 return element; 541 return element;
542 ec = SYNTAX_ERR; 542 ec = SyntaxError;
543 return 0; 543 return 0;
544 } 544 }
545 545
546 void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec) 546 void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, ExceptionCode& ec)
547 { 547 {
548 Element* contextElement = contextElementForInsertion(where, this, ec); 548 Element* contextElement = contextElementForInsertion(where, this, ec);
549 if (!contextElement) 549 if (!contextElement)
550 return; 550 return;
551 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement, AllowScriptingContent, ec); 551 RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, contextElement, AllowScriptingContent, ec);
552 if (!fragment) 552 if (!fragment)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 { 648 {
649 if (equalIgnoringCase(enabled, "true")) 649 if (equalIgnoringCase(enabled, "true"))
650 setAttribute(contenteditableAttr, "true"); 650 setAttribute(contenteditableAttr, "true");
651 else if (equalIgnoringCase(enabled, "false")) 651 else if (equalIgnoringCase(enabled, "false"))
652 setAttribute(contenteditableAttr, "false"); 652 setAttribute(contenteditableAttr, "false");
653 else if (equalIgnoringCase(enabled, "plaintext-only")) 653 else if (equalIgnoringCase(enabled, "plaintext-only"))
654 setAttribute(contenteditableAttr, "plaintext-only"); 654 setAttribute(contenteditableAttr, "plaintext-only");
655 else if (equalIgnoringCase(enabled, "inherit")) 655 else if (equalIgnoringCase(enabled, "inherit"))
656 removeAttribute(contenteditableAttr); 656 removeAttribute(contenteditableAttr);
657 else 657 else
658 ec = SYNTAX_ERR; 658 ec = SyntaxError;
659 } 659 }
660 660
661 bool HTMLElement::draggable() const 661 bool HTMLElement::draggable() const
662 { 662 {
663 return equalIgnoringCase(getAttribute(draggableAttr), "true"); 663 return equalIgnoringCase(getAttribute(draggableAttr), "true");
664 } 664 }
665 665
666 void HTMLElement::setDraggable(bool value) 666 void HTMLElement::setDraggable(bool value)
667 { 667 {
668 setAttribute(draggableAttr, value ? "true" : "false"); 668 setAttribute(draggableAttr, value ? "true" : "false");
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 #ifndef NDEBUG 1076 #ifndef NDEBUG
1077 1077
1078 // For use in the debugger 1078 // For use in the debugger
1079 void dumpInnerHTML(WebCore::HTMLElement*); 1079 void dumpInnerHTML(WebCore::HTMLElement*);
1080 1080
1081 void dumpInnerHTML(WebCore::HTMLElement* element) 1081 void dumpInnerHTML(WebCore::HTMLElement* element)
1082 { 1082 {
1083 printf("%s\n", element->innerHTML().ascii().data()); 1083 printf("%s\n", element->innerHTML().ascii().data());
1084 } 1084 }
1085 #endif 1085 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLDialogElement.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698