Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp |
| index 2bbc2dcbd69c9d43f7e4ac6392419349cff6f8be..6098bd09edf0b2f09c9653171158039bd288993e 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp |
| @@ -862,11 +862,11 @@ void ApplyStyleCommand::fixRangeAndApplyInlineStyle( |
| // color="blue">hello</font>, we need to include the font element in our run |
| // to generate <font color="blue" size="4">hello</font> instead of <font |
| // color="blue"><font size="4">hello</font></font> |
| - Range* range = Range::create(startNode->document(), start, end); |
| Element* editableRoot = rootEditableElement(*startNode); |
| - if (startNode != editableRoot) { |
| + if (startNode != editableRoot && start <= end) { |
|
yosin_UTC9
2017/04/04 04:54:46
Since this function assumes start <= end, e.g. |st
|
| + const EphemeralRange range = EphemeralRange(start, end); |
| while (editableRoot && startNode->parentNode() != editableRoot && |
| - isNodeVisiblyContainedWithin(*startNode->parentNode(), *range)) |
| + isNodeVisiblyContainedWithin(*startNode->parentNode(), range)) |
| startNode = startNode->parentNode(); |
| } |