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

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

Issue 2121313003: [Editing][DOM][CodeHealth] Make Node::isContentEditable and Node::isRichEditable global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * Copyright (C) 2015 Google Inc. All rights reserved. 5 * Copyright (C) 2015 Google Inc. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 576 }
577 577
578 bool SelectionController::handleGestureLongPress(const PlatformGestureEvent& ges tureEvent, const HitTestResult& hitTestResult) 578 bool SelectionController::handleGestureLongPress(const PlatformGestureEvent& ges tureEvent, const HitTestResult& hitTestResult)
579 { 579 {
580 if (!selection().isAvailable()) 580 if (!selection().isAvailable())
581 return false; 581 return false;
582 if (hitTestResult.isLiveLink()) 582 if (hitTestResult.isLiveLink())
583 return false; 583 return false;
584 584
585 Node* innerNode = hitTestResult.innerNode(); 585 Node* innerNode = hitTestResult.innerNode();
586 bool innerNodeIsSelectable = innerNode && (innerNode->isContentEditable() || innerNode->canStartSelection()); 586 bool innerNodeIsSelectable = innerNode && (isContentEditable(*innerNode) || innerNode->canStartSelection());
587 if (!innerNodeIsSelectable) 587 if (!innerNodeIsSelectable)
588 return false; 588 return false;
589 589
590 selectClosestWordFromHitTestResult(hitTestResult, AppendTrailingWhitespace:: DontAppend, SelectInputEventType::Touch); 590 selectClosestWordFromHitTestResult(hitTestResult, AppendTrailingWhitespace:: DontAppend, SelectInputEventType::Touch);
591 if (!selection().isAvailable()) { 591 if (!selection().isAvailable()) {
592 // "editing/selection/longpress-selection-in-iframe-removed-crash.html" 592 // "editing/selection/longpress-selection-in-iframe-removed-crash.html"
593 // reach here. 593 // reach here.
594 return false; 594 return false;
595 } 595 }
596 return selection().isRange(); 596 return selection().isRange();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 return event.event().altKey() && event.isOverLink(); 675 return event.event().altKey() && event.isOverLink();
676 } 676 }
677 677
678 bool isExtendingSelection(const MouseEventWithHitTestResults& event) 678 bool isExtendingSelection(const MouseEventWithHitTestResults& event)
679 { 679 {
680 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image(); 680 bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult(). image();
681 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 681 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
682 } 682 }
683 683
684 } // namespace blink 684 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698