Chromium Code Reviews| 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 e85532bc813cdd65e91ae6b3a0a084a3cf793fbb..d50571646e72a3b81d9dc1e6e31674af03d19541 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp |
| @@ -139,18 +139,19 @@ void FormatBlockCommand::formatRange(const Position& start, |
| insertBlockPlaceholder(lastParagraphInBlockNode, editingState); |
| } |
| -Element* FormatBlockCommand::elementForFormatBlockCommand(Range* range) { |
| - if (!range) |
| - return 0; |
| - |
| - Node* commonAncestor = range->commonAncestorContainer(); |
| +Element* FormatBlockCommand::elementForFormatBlockCommand( |
| + const EphemeralRange& range) { |
|
yoichio
2017/03/02 09:21:36
How about passing |selection| directly from caller
yosin_UTC9
2017/03/02 10:05:43
No, we don't want to increase usage of |VisibleSel
|
| + Node* commonAncestor = Range::commonAncestorContainer( |
|
Xiaocheng
2017/03/02 20:21:05
How about waiting until https://codereview.chromiu
yosin_UTC9
2017/03/09 05:18:40
Done.
|
| + range.startPosition().computeContainerNode(), |
| + range.endPosition().computeContainerNode()); |
| while (commonAncestor && !isElementForFormatBlock(commonAncestor)) |
| commonAncestor = commonAncestor->parentNode(); |
| if (!commonAncestor) |
| return 0; |
| - Element* element = rootEditableElement(*range->startContainer()); |
| + Element* element = |
| + rootEditableElement(*range.startPosition().computeContainerNode()); |
| if (!element || commonAncestor->contains(element)) |
| return 0; |