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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2964863003: Refactor SelectionController::SelectClosestWordFromHitTestResult() (Closed)
Patch Set: 2017-07-04T13:06:21 Created 3 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 | « no previous file | 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/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index 79d43e54169fab9189a6e3e5fd59249023152792..9af52fde2cd19d1b3fb56ef02b90ee7a226ede28 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -479,8 +479,7 @@ bool SelectionController::SelectClosestWordFromHitTestResult(
const HitTestResult& result,
AppendTrailingWhitespace append_trailing_whitespace,
SelectInputEventType select_input_event_type) {
- Node* inner_node = result.InnerNode();
- VisibleSelectionInFlatTree new_selection;
+ Node* const inner_node = result.InnerNode();
if (!inner_node || !inner_node->GetLayoutObject() ||
!inner_node->GetLayoutObject()->IsSelectable())
@@ -498,13 +497,13 @@ bool SelectionController::SelectClosestWordFromHitTestResult(
const VisiblePositionInFlatTree& pos =
VisiblePositionOfHitTestResult(adjusted_hit_test_result);
- if (pos.IsNotNull()) {
- new_selection =
- CreateVisibleSelection(SelectionInFlatTree::Builder()
- .Collapse(pos.ToPositionWithAffinity())
- .SetGranularity(kWordGranularity)
- .Build());
- }
+ VisibleSelectionInFlatTree new_selection =
+ pos.IsNotNull()
+ ? CreateVisibleSelection(SelectionInFlatTree::Builder()
+ .Collapse(pos.ToPositionWithAffinity())
+ .SetGranularity(kWordGranularity)
+ .Build())
+ : VisibleSelectionInFlatTree();
HandleVisibility visibility = HandleVisibility::kNotVisible;
if (select_input_event_type == SelectInputEventType::kTouch) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698