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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionController.cpp

Issue 2537243002: Adding |Node::layoutObject()| null check to |setCaretAtHitTestResult()| (Closed)
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
index a38381e9c24ff9ec7cdfc6856a1c536d1eb71c1c..7cc3975ec6f54bad41165386773534ccd82d72ca 100644
--- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
+++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
@@ -652,9 +652,6 @@ void SelectionController::setNonDirectionalSelectionIfNeeded(
void SelectionController::setCaretAtHitTestResult(
const HitTestResult& hitTestResult) {
Node* innerNode = hitTestResult.innerNode();
- if (!innerNode)
- return;
-
const VisiblePositionInFlatTree& visibleHitPos =
visiblePositionOfHitTestResult(hitTestResult);
const VisiblePositionInFlatTree& visiblePos =
@@ -892,7 +889,7 @@ bool SelectionController::handleGestureLongPress(
return false;
Node* innerNode = hitTestResult.innerNode();
- if (!innerNode)
+ if (!innerNode || !innerNode->layoutObject())
yosin_UTC9 2016/12/01 01:51:09 Could you hoist call site of this function or fath
return false;
innerNode->document().updateStyleAndLayoutTree();
bool innerNodeIsSelectable = hasEditableStyle(*innerNode) ||
@@ -912,12 +909,16 @@ bool SelectionController::handleGestureLongPress(
void SelectionController::handleGestureTwoFingerTap(
const GestureEventWithHitTestResults& targetedEvent) {
- setCaretAtHitTestResult(targetedEvent.hitTestResult());
+ Node* innerNode = targetedEvent.hitTestResult().innerNode();
+ if (innerNode && innerNode->layoutObject())
+ setCaretAtHitTestResult(targetedEvent.hitTestResult());
}
void SelectionController::handleGestureLongTap(
const GestureEventWithHitTestResults& targetedEvent) {
- setCaretAtHitTestResult(targetedEvent.hitTestResult());
+ Node* innerNode = targetedEvent.hitTestResult().innerNode();
+ if (innerNode && innerNode->layoutObject())
+ setCaretAtHitTestResult(targetedEvent.hitTestResult());
}
static bool hitTestResultIsMisspelled(const HitTestResult& result) {
« 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