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

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

Issue 2537243002: Adding |Node::layoutObject()| null check to |setCaretAtHitTestResult()| (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 const FrameSelection::SetSelectionOptions options = 646 const FrameSelection::SetSelectionOptions options =
647 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle; 647 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle;
648 selection().setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded, 648 selection().setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded,
649 granularity); 649 granularity);
650 } 650 }
651 651
652 bool SelectionController::setCaretAtHitTestResult( 652 bool SelectionController::setCaretAtHitTestResult(
653 const HitTestResult& hitTestResult) { 653 const HitTestResult& hitTestResult) {
654 Node* innerNode = hitTestResult.innerNode(); 654 Node* innerNode = hitTestResult.innerNode();
655 if (!innerNode) 655 if (!innerNode || !innerNode->layoutObject())
yosin_UTC9 2016/11/30 02:01:48 It is strange that HitTestResult picks up "display
amaralp 2016/12/01 01:25:34 I didn't think it was possible for the HitTestResu
yosin_UTC9 2016/12/01 01:51:09 We need to find where we call HitTestResult::setIn
656 return false; 656 return false;
657 657
658 const VisiblePositionInFlatTree& visibleHitPos = 658 const VisiblePositionInFlatTree& visibleHitPos =
659 visiblePositionOfHitTestResult(hitTestResult); 659 visiblePositionOfHitTestResult(hitTestResult);
660 const VisiblePositionInFlatTree& visiblePos = 660 const VisiblePositionInFlatTree& visiblePos =
661 visibleHitPos.isNull() 661 visibleHitPos.isNull()
662 ? createVisiblePosition( 662 ? createVisiblePosition(
663 PositionInFlatTree::firstPositionInOrBeforeNode(innerNode)) 663 PositionInFlatTree::firstPositionInOrBeforeNode(innerNode))
664 : visibleHitPos; 664 : visibleHitPos;
665 665
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 return event.event().altKey() && event.isOverLink(); 1023 return event.event().altKey() && event.isOverLink();
1024 } 1024 }
1025 1025
1026 bool isExtendingSelection(const MouseEventWithHitTestResults& event) { 1026 bool isExtendingSelection(const MouseEventWithHitTestResults& event) {
1027 bool isMouseDownOnLinkOrImage = 1027 bool isMouseDownOnLinkOrImage =
1028 event.isOverLink() || event.hitTestResult().image(); 1028 event.isOverLink() || event.hitTestResult().image();
1029 return event.event().shiftKey() && !isMouseDownOnLinkOrImage; 1029 return event.event().shiftKey() && !isMouseDownOnLinkOrImage;
1030 } 1030 }
1031 1031
1032 } // namespace blink 1032 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698