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

Unified Diff: third_party/WebKit/Source/core/editing/commands/FormatBlockCommand.cpp

Issue 2729823002: Make FormatBlockCommand::elementForFormatBlockCommand() to take EphemeralRange (Closed)
Patch Set: 2017-03-02T16:28:37 Created 3 years, 10 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
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;

Powered by Google App Engine
This is Rietveld 408576698