Index: Source/core/editing/htmlediting.cpp |
diff --git a/Source/core/editing/htmlediting.cpp b/Source/core/editing/htmlediting.cpp |
index 084e3d4eaee048680c627f28f0730cb65c45637a..3813ae4cacc9522a4702d2e33e1404b4538b4432 100644 |
--- a/Source/core/editing/htmlediting.cpp |
+++ b/Source/core/editing/htmlediting.cpp |
@@ -575,7 +575,8 @@ Element* enclosingElementWithTag(const Position& p, const QualifiedName& tagName |
return 0; |
ContainerNode* root = highestEditableRoot(p); |
- for (Element* ancestor = ElementTraversal::firstAncestorOrSelf(*p.deprecatedNode()); ancestor; ancestor = ElementTraversal::firstAncestor(*ancestor)) { |
+ Element* ancestor = p.deprecatedNode()->isElementNode() ? toElement(p.deprecatedNode()) : p.deprecatedNode()->parentElement(); |
+ for (; ancestor; ancestor = ancestor->parentElement()) { |
if (root && !ancestor->hasEditableStyle()) |
continue; |
if (ancestor->hasTagName(tagName)) |