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

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

Issue 2119083003: Make ApplyStyleCommand::applyRelativeFontStyleChange() to handle AfterAnchor position correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-05T10:59:18 Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/editing/execCommand/font-size-delta-after-anchor-crash.html ('k') | no next file » | 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 12e74730e6ca4d3359d32f7cbd970b1aede12e1f..a2982225f5a44cdfe7bfe5dddffd14aa687f5f2c 100644
--- a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
@@ -365,17 +365,12 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style, Editin
end = endPosition();
}
+ DCHECK(start.anchorNode());
+ DCHECK(end.anchorNode());
// Calculate loop end point.
// If the end node is before the start node (can only happen if the end node is
// an ancestor of the start node), we gather nodes up to the next sibling of the end node
- Node* beyondEnd;
- DCHECK(start.anchorNode());
- DCHECK(end.anchorNode());
- if (start.anchorNode()->isDescendantOf(end.anchorNode()))
- beyondEnd = NodeTraversal::nextSkippingChildren(*end.anchorNode());
- else
- beyondEnd = NodeTraversal::next(*end.anchorNode());
-
+ const Node* const beyondEnd = end.nodeAsRangePastLastNode();
start = mostBackwardCaretPosition(start); // Move upstream to ensure we do not add redundant spans.
Node* startNode = start.anchorNode();
DCHECK(startNode);
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/font-size-delta-after-anchor-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698