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

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

Issue 2432173005: Get rid of VisibleSelection::selectionFromContentsOfNode() (Closed)
Patch Set: 2016-10-20T17:14:18 Created 4 years, 2 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 Node* innerNode = result.innerNode(); 496 Node* innerNode = result.innerNode();
497 497
498 if (!innerNode || !innerNode->layoutObject() || !m_mouseDownMayStartSelect) 498 if (!innerNode || !innerNode->layoutObject() || !m_mouseDownMayStartSelect)
499 return; 499 return;
500 500
501 VisibleSelectionInFlatTree newSelection; 501 VisibleSelectionInFlatTree newSelection;
502 Element* URLElement = result.hitTestResult().URLElement(); 502 Element* URLElement = result.hitTestResult().URLElement();
503 const VisiblePositionInFlatTree pos = 503 const VisiblePositionInFlatTree pos =
504 visiblePositionOfHitTestResult(result.hitTestResult()); 504 visiblePositionOfHitTestResult(result.hitTestResult());
505 if (pos.isNotNull() && 505 if (pos.isNotNull() &&
506 pos.deepEquivalent().anchorNode()->isDescendantOf(URLElement)) 506 pos.deepEquivalent().anchorNode()->isDescendantOf(URLElement)) {
507 newSelection = 507 newSelection = createVisibleSelection(
508 VisibleSelectionInFlatTree::selectionFromContentsOfNode(URLElement); 508 SelectionInFlatTree::Builder().selectAllChildren(*URLElement).build());
509 }
509 510
510 updateSelectionForMouseDownDispatchingSelectStart( 511 updateSelectionForMouseDownDispatchingSelectStart(
511 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection), 512 innerNode, expandSelectionToRespectUserSelectAll(innerNode, newSelection),
512 WordGranularity); 513 WordGranularity);
513 } 514 }
514 515
515 bool SelectionController::handleMousePressEventDoubleClick( 516 bool SelectionController::handleMousePressEventDoubleClick(
516 const MouseEventWithHitTestResults& event) { 517 const MouseEventWithHitTestResults& event) {
517 TRACE_EVENT0("blink", 518 TRACE_EVENT0("blink",
518 "SelectionController::handleMousePressEventDoubleClick"); 519 "SelectionController::handleMousePressEventDoubleClick");
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 return event.event().altKey() && event.isOverLink(); 853 return event.event().altKey() && event.isOverLink();
853 } 854 }
854 855
855 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { 856 bool isExtendingSelection(const MouseEventWithHitTestResults& event) {
856 bool isMouseDownOnLinkOrImage = 857 bool isMouseDownOnLinkOrImage =
857 event.isOverLink() || event.hitTestResult().image(); 858 event.isOverLink() || event.hitTestResult().image();
858 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 859 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
859 } 860 }
860 861
861 } // namespace blink 862 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/SelectionTemplate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698