Index: third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp |
diff --git a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp |
index 1c72d9b452487d87e062b1f1395fbc785e1379be..07db045f4a8be6f304c48789a0dca9779a6975be 100644 |
--- a/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp |
+++ b/third_party/WebKit/Source/core/editing/EditingStyleUtilities.cpp |
@@ -101,7 +101,12 @@ EditingStyle* EditingStyleUtilities::createStyleAtSelectionStart( |
DocumentLifecycle::DisallowTransitionScope disallowTransition( |
document.lifecycle()); |
- Position position = adjustedSelectionStartForStyleComputation(selection); |
+ // TODO(editing-dev): We should make |position| to |const Position&| by |
+ // integrating this expression and if-statement below. |
+ Position position = |
+ selection.isCaret() |
+ ? createVisiblePosition(selection.start()).deepEquivalent() |
+ : adjustedSelectionStartForStyleComputation(selection.start()); |
// If the pos is at the end of a text node, then this node is not fully |
// selected. Move it to the next deep equivalent position to avoid removing |