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

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

Issue 22320009: Don't come undone when undoing the editing of a Custom Element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Resolve conflicts. Created 7 years, 4 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 | « LayoutTests/fast/dom/custom/type-extension-undo-assert-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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ASSERT(!type.isEmpty()); 127 ASSERT(!type.isEmpty());
128 element->setAttribute(HTMLNames::isAttr, type); 128 element->setAttribute(HTMLNames::isAttr, type);
129 setTypeExtension(element, type); 129 setTypeExtension(element, type);
130 } 130 }
131 131
132 void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type) 132 void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type)
133 { 133 {
134 if (!element->isHTMLElement() && !element->isSVGElement()) 134 if (!element->isHTMLElement() && !element->isSVGElement())
135 return; 135 return;
136 136
137 if (CustomElement::isCustomTagName(element->localName())) 137 if (element->isCustomElement()) {
138 return; // custom tags take precedence over type extensions 138 // This can happen if:
139 // 1. The element has a custom tag, which takes precedence over
140 // type extensions.
141 // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an
142 // element but tries to overwrite its attribute list.
143 return;
144 }
145
146 // Custom tags take precedence over type extensions
147 ASSERT(!CustomElement::isCustomTagName(element->localName()));
139 148
140 if (CustomElementRegistrationContext* context = element->document()->registr ationContext()) 149 if (CustomElementRegistrationContext* context = element->document()->registr ationContext())
141 context->didGiveTypeExtension(element, type); 150 context->didGiveTypeExtension(element, type);
142 } 151 }
143 152
144 } // namespace WebCore 153 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/custom/type-extension-undo-assert-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698