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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2735143002: Make GranularityStrategy::updateExtent() to return SelectionInDOM instead of VisibleSelection (Closed)
Patch Set: 2017-03-09T16:45:24 rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/GranularityStrategy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 m_granularityStrategy = WTF::makeUnique<DirectionGranularityStrategy>(); 1085 m_granularityStrategy = WTF::makeUnique<DirectionGranularityStrategy>();
1086 else 1086 else
1087 m_granularityStrategy = WTF::makeUnique<CharacterGranularityStrategy>(); 1087 m_granularityStrategy = WTF::makeUnique<CharacterGranularityStrategy>();
1088 return m_granularityStrategy.get(); 1088 return m_granularityStrategy.get();
1089 } 1089 }
1090 1090
1091 void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint) { 1091 void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint) {
1092 if (computeVisibleSelectionInDOMTreeDeprecated().isNone()) 1092 if (computeVisibleSelectionInDOMTreeDeprecated().isNone())
1093 return; 1093 return;
1094 1094
1095 VisibleSelection newSelection = 1095 const SetSelectionOptions options =
1096 granularityStrategy()->updateExtent(contentsPoint, m_frame); 1096 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle |
1097 setSelection(SelectionInDOMTree::Builder(newSelection.asSelection()) 1097 FrameSelection::DoNotClearStrategy | UserTriggered;
1098 setSelection(SelectionInDOMTree::Builder(
1099 granularityStrategy()->updateExtent(contentsPoint, m_frame))
1098 .setIsHandleVisible(true) 1100 .setIsHandleVisible(true)
1099 .build(), 1101 .build(),
1100 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | 1102 options);
1101 FrameSelection::DoNotClearStrategy | UserTriggered,
1102 CursorAlignOnScroll::IfNeeded, CharacterGranularity);
1103 } 1103 }
1104 1104
1105 // TODO(yosin): We should make |FrameSelection::moveRangeSelection()| to take 1105 // TODO(yosin): We should make |FrameSelection::moveRangeSelection()| to take
1106 // two |IntPoint| instead of two |VisiblePosition| like 1106 // two |IntPoint| instead of two |VisiblePosition| like
1107 // |moveRangeSelectionExtent()|. 1107 // |moveRangeSelectionExtent()|.
1108 void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition, 1108 void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition,
1109 const VisiblePosition& extentPosition, 1109 const VisiblePosition& extentPosition,
1110 TextGranularity granularity) { 1110 TextGranularity granularity) {
1111 SelectionInDOMTree newSelection = 1111 SelectionInDOMTree newSelection =
1112 SelectionInDOMTree::Builder() 1112 SelectionInDOMTree::Builder()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 } 1158 }
1159 1159
1160 void showTree(const blink::FrameSelection* sel) { 1160 void showTree(const blink::FrameSelection* sel) {
1161 if (sel) 1161 if (sel)
1162 sel->showTreeForThis(); 1162 sel->showTreeForThis();
1163 else 1163 else
1164 LOG(INFO) << "Cannot showTree for <null> FrameSelection."; 1164 LOG(INFO) << "Cannot showTree for <null> FrameSelection.";
1165 } 1165 }
1166 1166
1167 #endif 1167 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/GranularityStrategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698