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

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

Issue 2390613002: [Bugfix][Editing] Null check in SelectionController::handleGestureLongPress. (Closed)
Patch Set: modify 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/long-press-on-hidden-node-crash.html ('k') | no next file » | 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 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 bool SelectionController::handleGestureLongPress( 700 bool SelectionController::handleGestureLongPress(
701 const PlatformGestureEvent& gestureEvent, 701 const PlatformGestureEvent& gestureEvent,
702 const HitTestResult& hitTestResult) { 702 const HitTestResult& hitTestResult) {
703 if (!selection().isAvailable()) 703 if (!selection().isAvailable())
704 return false; 704 return false;
705 if (hitTestResult.isLiveLink()) 705 if (hitTestResult.isLiveLink())
706 return false; 706 return false;
707 707
708 Node* innerNode = hitTestResult.innerNode(); 708 Node* innerNode = hitTestResult.innerNode();
709 if (!innerNode)
710 return false;
709 innerNode->document().updateStyleAndLayoutTree(); 711 innerNode->document().updateStyleAndLayoutTree();
710 bool innerNodeIsSelectable = innerNode && (hasEditableStyle(*innerNode) || 712 bool innerNodeIsSelectable =
711 innerNode->canStartSelection()); 713 hasEditableStyle(*innerNode) || innerNode->canStartSelection();
712 if (!innerNodeIsSelectable) 714 if (!innerNodeIsSelectable)
713 return false; 715 return false;
714 716
715 selectClosestWordFromHitTestResult(hitTestResult, 717 selectClosestWordFromHitTestResult(hitTestResult,
716 AppendTrailingWhitespace::DontAppend, 718 AppendTrailingWhitespace::DontAppend,
717 SelectInputEventType::Touch); 719 SelectInputEventType::Touch);
718 if (!selection().isAvailable()) { 720 if (!selection().isAvailable()) {
719 // "editing/selection/longpress-selection-in-iframe-removed-crash.html" 721 // "editing/selection/longpress-selection-in-iframe-removed-crash.html"
720 // reach here. 722 // reach here.
721 return false; 723 return false;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 return event.event().altKey() && event.isOverLink(); 822 return event.event().altKey() && event.isOverLink();
821 } 823 }
822 824
823 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { 825 bool isExtendingSelection(const MouseEventWithHitTestResults& event) {
824 bool isMouseDownOnLinkOrImage = 826 bool isMouseDownOnLinkOrImage =
825 event.isOverLink() || event.hitTestResult().image(); 827 event.isOverLink() || event.hitTestResult().image();
826 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 828 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
827 } 829 }
828 830
829 } // namespace blink 831 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/selection/mouse/long-press-on-hidden-node-crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698