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

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

Issue 2788473003: Use EphmeralRange insteadof Range in CompositeEditCommands::isNodeVisiblyContainedWithin()
Patch Set: update Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698