| Index: third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
|
| index 92195e87d13240e3597cf17b5a4896bcc494ecc3..c377e480c6894a6f9b71c588956d5ef0db7f024a 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp
|
| @@ -164,15 +164,15 @@ bool isElementForFormatBlock(const QualifiedName& tagName)
|
| Node* enclosingBlockToSplitTreeTo(Node* startNode)
|
| {
|
| Node* lastBlock = startNode;
|
| - for (Node* n = startNode; n; n = n->parentNode()) {
|
| - if (!n->hasEditableStyle())
|
| + for (Node& runner : NodeTraversal::ancestorsOrSelfOf(startNode)) {
|
| + if (!runner.hasEditableStyle())
|
| return lastBlock;
|
| - if (isTableCell(n) || isHTMLBodyElement(*n) || !n->parentNode() || !n->parentNode()->hasEditableStyle() || isElementForFormatBlock(n))
|
| - return n;
|
| - if (isEnclosingBlock(n))
|
| - lastBlock = n;
|
| - if (isHTMLListElement(n))
|
| - return n->parentNode()->hasEditableStyle() ? n->parentNode() : n;
|
| + if (isTableCell(&runner) || isHTMLBodyElement(&runner) || !runner.parentNode() || !runner.parentNode()->hasEditableStyle() || isElementForFormatBlock(&runner))
|
| + return &runner;
|
| + if (isEnclosingBlock(&runner))
|
| + lastBlock = &runner;
|
| + if (isHTMLListElement(&runner))
|
| + return runner.parentNode()->hasEditableStyle() ? runner.parentNode() : &runner;
|
| }
|
| return lastBlock;
|
| }
|
|
|