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

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

Issue 2964893002: Make VisibleSelection::AppendTrailingWhitespace() as const function (Closed)
Patch Set: 2017-07-04T15:32:18 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * Copyright (C) 2015 Google Inc. All rights reserved. 6 * Copyright (C) 2015 Google Inc. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (new_selection.RootEditableElement() && 522 if (new_selection.RootEditableElement() &&
523 pos.DeepEquivalent() == VisiblePositionInFlatTree::LastPositionInNode( 523 pos.DeepEquivalent() == VisiblePositionInFlatTree::LastPositionInNode(
524 *new_selection.RootEditableElement()) 524 *new_selection.RootEditableElement())
525 .DeepEquivalent()) 525 .DeepEquivalent())
526 return false; 526 return false;
527 527
528 visibility = HandleVisibility::kVisible; 528 visibility = HandleVisibility::kVisible;
529 } 529 }
530 530
531 if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend) 531 if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend)
532 new_selection.AppendTrailingWhitespace(); 532 new_selection = new_selection.AppendTrailingWhitespace();
533 533
534 return UpdateSelectionForMouseDownDispatchingSelectStart( 534 return UpdateSelectionForMouseDownDispatchingSelectStart(
535 inner_node, 535 inner_node,
536 ExpandSelectionToRespectUserSelectAll(inner_node, new_selection), 536 ExpandSelectionToRespectUserSelectAll(inner_node, new_selection),
537 kWordGranularity, visibility); 537 kWordGranularity, visibility);
538 } 538 }
539 539
540 void SelectionController::SelectClosestMisspellingFromHitTestResult( 540 void SelectionController::SelectClosestMisspellingFromHitTestResult(
541 const HitTestResult& result, 541 const HitTestResult& result,
542 AppendTrailingWhitespace append_trailing_whitespace) { 542 AppendTrailingWhitespace append_trailing_whitespace) {
(...skipping 23 matching lines...) Expand all
566 return; 566 return;
567 } 567 }
568 568
569 Node* container_node = marker_position.ComputeContainerNode(); 569 Node* container_node = marker_position.ComputeContainerNode();
570 const PositionInFlatTree start(container_node, marker->StartOffset()); 570 const PositionInFlatTree start(container_node, marker->StartOffset());
571 const PositionInFlatTree end(container_node, marker->EndOffset()); 571 const PositionInFlatTree end(container_node, marker->EndOffset());
572 VisibleSelectionInFlatTree new_selection = CreateVisibleSelection( 572 VisibleSelectionInFlatTree new_selection = CreateVisibleSelection(
573 SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build()); 573 SelectionInFlatTree::Builder().Collapse(start).Extend(end).Build());
574 574
575 if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend) 575 if (append_trailing_whitespace == AppendTrailingWhitespace::kShouldAppend)
576 new_selection.AppendTrailingWhitespace(); 576 new_selection = new_selection.AppendTrailingWhitespace();
577 577
578 UpdateSelectionForMouseDownDispatchingSelectStart( 578 UpdateSelectionForMouseDownDispatchingSelectStart(
579 inner_node, 579 inner_node,
580 ExpandSelectionToRespectUserSelectAll(inner_node, new_selection), 580 ExpandSelectionToRespectUserSelectAll(inner_node, new_selection),
581 kWordGranularity, HandleVisibility::kNotVisible); 581 kWordGranularity, HandleVisibility::kNotVisible);
582 } 582 }
583 583
584 bool SelectionController::SelectClosestWordFromMouseEvent( 584 bool SelectionController::SelectClosestWordFromMouseEvent(
585 const MouseEventWithHitTestResults& result) { 585 const MouseEventWithHitTestResults& result) {
586 if (!mouse_down_may_start_select_) 586 if (!mouse_down_may_start_select_)
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 1213
1214 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) { 1214 bool IsExtendingSelection(const MouseEventWithHitTestResults& event) {
1215 bool is_mouse_down_on_link_or_image = 1215 bool is_mouse_down_on_link_or_image =
1216 event.IsOverLink() || event.GetHitTestResult().GetImage(); 1216 event.IsOverLink() || event.GetHitTestResult().GetImage();
1217 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) != 1217 return (event.Event().GetModifiers() & WebInputEvent::Modifiers::kShiftKey) !=
1218 0 && 1218 0 &&
1219 !is_mouse_down_on_link_or_image; 1219 !is_mouse_down_on_link_or_image;
1220 } 1220 }
1221 1221
1222 } // namespace blink 1222 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698