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

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

Issue 2741173002: Reduce canonicalization when dragging (Closed)
Patch Set: update 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
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // |dispatchSelectStart()| can change them by "selectstart" event handler. 380 // |dispatchSelectStart()| can change them by "selectstart" event handler.
381 381
382 PositionInFlatTree basePosition; 382 PositionInFlatTree basePosition;
383 if (m_selectionState != SelectionState::ExtendedSelection) { 383 if (m_selectionState != SelectionState::ExtendedSelection) {
384 // Always extend selection here because it's caused by a mouse drag 384 // Always extend selection here because it's caused by a mouse drag
385 m_selectionState = SelectionState::ExtendedSelection; 385 m_selectionState = SelectionState::ExtendedSelection;
386 basePosition = targetPosition.deepEquivalent(); 386 basePosition = targetPosition.deepEquivalent();
387 } else { 387 } else {
388 basePosition = selection().computeVisibleSelectionInFlatTree().base(); 388 basePosition = selection().computeVisibleSelectionInFlatTree().base();
389 } 389 }
390 if (basePosition.isNull())
yosin_UTC9 2017/03/16 02:30:05 Could you move this change in another patch? with
yoichio 2017/03/16 04:10:59 This needs because of SelectionEditor change. Some
391 return;
392
390 const SelectionInFlatTree& appliedSelection = applySelectAll( 393 const SelectionInFlatTree& appliedSelection = applySelectAll(
391 basePosition, targetPosition.deepEquivalent(), mousePressNode, 394 basePosition, targetPosition.deepEquivalent(), mousePressNode,
392 dragStartPos, target, hitTestResult.localPoint()); 395 dragStartPos, target, hitTestResult.localPoint());
393 SelectionInFlatTree::Builder builder(appliedSelection); 396 SelectionInFlatTree::Builder builder(appliedSelection);
394 397
395 if (selection().granularity() != CharacterGranularity) 398 if (selection().granularity() != CharacterGranularity)
396 builder.setGranularity(selection().granularity()); 399 builder.setGranularity(selection().granularity());
397 400
398 setNonDirectionalSelectionIfNeeded(builder.build(), selection().granularity(), 401 setNonDirectionalSelectionIfNeeded(builder.build(), selection().granularity(),
399 AdjustEndpointsAtBidiBoundary, 402 AdjustEndpointsAtBidiBoundary,
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1091
1089 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { 1092 bool isExtendingSelection(const MouseEventWithHitTestResults& event) {
1090 bool isMouseDownOnLinkOrImage = 1093 bool isMouseDownOnLinkOrImage =
1091 event.isOverLink() || event.hitTestResult().image(); 1094 event.isOverLink() || event.hitTestResult().image();
1092 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) != 1095 return (event.event().modifiers() & WebInputEvent::Modifiers::ShiftKey) !=
1093 0 && 1096 0 &&
1094 !isMouseDownOnLinkOrImage; 1097 !isMouseDownOnLinkOrImage;
1095 } 1098 }
1096 1099
1097 } // namespace blink 1100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698