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

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

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

Powered by Google App Engine
This is Rietveld 408576698