| Index: Source/core/editing/InsertParagraphSeparatorCommand.cpp
|
| diff --git a/Source/core/editing/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
|
| index 7f982205430f57b1261488288021694fffe2114a..417ab39e4d0bc9e65afc10d9d69080a69f7b4313 100644
|
| --- a/Source/core/editing/InsertParagraphSeparatorCommand.cpp
|
| +++ b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
|
| @@ -50,7 +50,7 @@ static Element* highestVisuallyEquivalentDivBelowRoot(Element* startBlock)
|
| Element* curBlock = startBlock;
|
| // We don't want to return a root node (if it happens to be a div, e.g., in a document fragment) because there are no
|
| // siblings for us to append to.
|
| - while (!curBlock->nextSibling() && curBlock->parentElement()->hasTagName(divTag) && curBlock->parentElement()->parentElement()) {
|
| + while (!curBlock->nextSibling() && isHTMLDivElement(*curBlock->parentElement()) && curBlock->parentElement()->parentElement()) {
|
| if (curBlock->parentElement()->hasAttributes())
|
| break;
|
| curBlock = curBlock->parentElement();
|
| @@ -170,10 +170,10 @@ void InsertParagraphSeparatorCommand::doApply()
|
| if (!startBlock
|
| || !startBlock->nonShadowBoundaryParentNode()
|
| || isTableCell(startBlock.get())
|
| - || startBlock->hasTagName(formTag)
|
| + || isHTMLFormElement(*startBlock)
|
| // FIXME: If the node is hidden, we don't have a canonical position so we will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug.cgi?id=40342
|
| || (!canonicalPos.isNull() && isRenderedTable(canonicalPos.deprecatedNode()))
|
| - || (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(hrTag))) {
|
| + || (!canonicalPos.isNull() && isHTMLHRElement(*canonicalPos.deprecatedNode()))) {
|
| applyCommandToComposite(InsertLineBreakCommand::create(document()));
|
| return;
|
| }
|
| @@ -240,7 +240,7 @@ void InsertParagraphSeparatorCommand::doApply()
|
| // Most of the time we want to stay at the nesting level of the startBlock (e.g., when nesting within lists). However,
|
| // for div nodes, this can result in nested div tags that are hard to break out of.
|
| Element* siblingNode = startBlock.get();
|
| - if (blockToInsert->hasTagName(divTag))
|
| + if (isHTMLDivElement(*blockToInsert))
|
| siblingNode = highestVisuallyEquivalentDivBelowRoot(startBlock.get());
|
| insertNodeAfter(blockToInsert, siblingNode);
|
| }
|
|
|