Reviewers: tkent, yoichio, hajimehoshi,
Message:
PTAL
mac_blink_bot failures,
http/tests/serviceworker/fetch-request-fallback.html and
trace test on NVIDIA GPU aren't related to this patch.
Description:
Make ApplyStyleCommand not to use Position::deprecatedEditingOffset()
This patch replaces |Position::deprecatedEditingOffset()| call in
|ApplyStyleCommand| class by |Position::computeEditingOffset()|, since it
is used for computing offset for positions which can not be
middle of editing ignore content, for improving code health.
This patch is a preparation of getting rid of legacy editing position.
BUG=513114
TEST=n/a; no behavior changes
Please review this at
https://codereview.chromium.org/1259283003/
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Affected files (+3, -3 lines):
M Source/core/editing/ApplyStyleCommand.cpp
Index: Source/core/editing/ApplyStyleCommand.cpp
diff --git a/Source/core/editing/ApplyStyleCommand.cpp
b/Source/core/editing/ApplyStyleCommand.cpp
index
f2e91065132baa77f82c5e6d4da1d6cc85d6c09e..efd732d1b76391042b04bbacd2d2156d118b867e
100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -699,14 +699,14 @@ void
ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
Node* startNode = start.anchorNode();
ASSERT(startNode);
- if (start.deprecatedEditingOffset() >=
caretMaxOffset(start.anchorNode())) {
+ if (start.computeEditingOffset() >=
caretMaxOffset(start.anchorNode())) {
startNode = NodeTraversal::next(*startNode);
if (!startNode || comparePositions(end,
firstPositionInOrBeforeNode(startNode)) < 0)
return;
}
Node* pastEndNode = end.anchorNode();
- if (end.deprecatedEditingOffset() >= caretMaxOffset(end.anchorNode()))
+ if (end.computeEditingOffset() >= caretMaxOffset(end.anchorNode()))
pastEndNode =
NodeTraversal::nextSkippingChildren(*end.anchorNode());
// FIXME: Callers should perform this operation on a Range that
includes the br
@@ -1324,7 +1324,7 @@ bool
ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start,
int startOffsetAdjustment = startChild->nodeIndex();
int endOffsetAdjustment = startNode == end.anchorNode() ?
startOffsetAdjustment : 0;
updateStartEnd(Position(startNode, startOffsetAdjustment),
- Position(end.anchorNode(), end.deprecatedEditingOffset() +
endOffsetAdjustment));
+ Position(end.anchorNode(), end.computeEditingOffset() +
endOffsetAdjustment));
return true;
}