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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/dom/custom/type-extension-undo-assert-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/CustomElementRegistrationContext.cpp
diff --git a/Source/core/dom/CustomElementRegistrationContext.cpp b/Source/core/dom/CustomElementRegistrationContext.cpp
index 3e37396aea71337bb64b9d39b28da6e2b52c1d0a..4589e7e1c1c88d6f91b046b6df06e9bc0bbf1980 100644
--- a/Source/core/dom/CustomElementRegistrationContext.cpp
+++ b/Source/core/dom/CustomElementRegistrationContext.cpp
@@ -134,8 +134,17 @@ void CustomElementRegistrationContext::setTypeExtension(Element* element, const
if (!element->isHTMLElement() && !element->isSVGElement())
return;
- if (CustomElement::isCustomTagName(element->localName()))
- return; // custom tags take precedence over type extensions
+ if (element->isCustomElement()) {
+ // This can happen if:
+ // 1. The element has a custom tag, which takes precedence over
+ // type extensions.
+ // 2. Undoing a command (eg ReplaceNodeWithSpan) recycles an
+ // element but tries to overwrite its attribute list.
+ return;
+ }
+
+ // Custom tags take precedence over type extensions
+ ASSERT(!CustomElement::isCustomTagName(element->localName()));
if (CustomElementRegistrationContext* context = element->document()->registrationContext())
context->didGiveTypeExtension(element, type);
« 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