Commit 4807e647 authored by amaralp's avatar amaralp Committed by Commit bot

Adding null check of |layoutObject()| before calling |visiblePositionOfHitTestResult()|

BUG=667567

Review-Url: https://codereview.chromium.org/2537243002
Cr-Commit-Position: refs/heads/master@{#439073}
parent 1a6bd503
...@@ -652,9 +652,6 @@ void SelectionController::setNonDirectionalSelectionIfNeeded( ...@@ -652,9 +652,6 @@ void SelectionController::setNonDirectionalSelectionIfNeeded(
void SelectionController::setCaretAtHitTestResult( void SelectionController::setCaretAtHitTestResult(
const HitTestResult& hitTestResult) { const HitTestResult& hitTestResult) {
Node* innerNode = hitTestResult.innerNode(); Node* innerNode = hitTestResult.innerNode();
if (!innerNode)
return;
const VisiblePositionInFlatTree& visibleHitPos = const VisiblePositionInFlatTree& visibleHitPos =
visiblePositionOfHitTestResult(hitTestResult); visiblePositionOfHitTestResult(hitTestResult);
const VisiblePositionInFlatTree& visiblePos = const VisiblePositionInFlatTree& visiblePos =
...@@ -892,8 +889,6 @@ bool SelectionController::handleGestureLongPress( ...@@ -892,8 +889,6 @@ bool SelectionController::handleGestureLongPress(
return false; return false;
Node* innerNode = hitTestResult.innerNode(); Node* innerNode = hitTestResult.innerNode();
if (!innerNode)
return false;
innerNode->document().updateStyleAndLayoutTree(); innerNode->document().updateStyleAndLayoutTree();
bool innerNodeIsSelectable = hasEditableStyle(*innerNode) || bool innerNodeIsSelectable = hasEditableStyle(*innerNode) ||
innerNode->isTextNode() || innerNode->isTextNode() ||
......
...@@ -318,7 +318,9 @@ WebInputEventResult GestureManager::handleGestureLongPress( ...@@ -318,7 +318,9 @@ WebInputEventResult GestureManager::handleGestureLongPress(
return WebInputEventResult::HandledSystem; return WebInputEventResult::HandledSystem;
} }
if (m_selectionController->handleGestureLongPress(gestureEvent, Node* innerNode = hitTestResult.innerNode();
if (innerNode && innerNode->layoutObject() &&
m_selectionController->handleGestureLongPress(gestureEvent,
hitTestResult)) { hitTestResult)) {
m_mouseEventManager->focusDocumentView(); m_mouseEventManager->focusDocumentView();
return WebInputEventResult::HandledSystem; return WebInputEventResult::HandledSystem;
...@@ -332,7 +334,9 @@ WebInputEventResult GestureManager::handleGestureLongTap( ...@@ -332,7 +334,9 @@ WebInputEventResult GestureManager::handleGestureLongTap(
#if !OS(ANDROID) #if !OS(ANDROID)
if (m_longTapShouldInvokeContextMenu) { if (m_longTapShouldInvokeContextMenu) {
m_longTapShouldInvokeContextMenu = false; m_longTapShouldInvokeContextMenu = false;
m_selectionController->handleGestureLongTap(targetedEvent); Node* innerNode = targetedEvent.hitTestResult().innerNode();
if (innerNode && innerNode->layoutObject())
m_selectionController->handleGestureLongTap(targetedEvent);
return sendContextMenuEventForGesture(targetedEvent); return sendContextMenuEventForGesture(targetedEvent);
} }
#endif #endif
...@@ -341,7 +345,9 @@ WebInputEventResult GestureManager::handleGestureLongTap( ...@@ -341,7 +345,9 @@ WebInputEventResult GestureManager::handleGestureLongTap(
WebInputEventResult GestureManager::handleGestureTwoFingerTap( WebInputEventResult GestureManager::handleGestureTwoFingerTap(
const GestureEventWithHitTestResults& targetedEvent) { const GestureEventWithHitTestResults& targetedEvent) {
m_selectionController->handleGestureTwoFingerTap(targetedEvent); Node* innerNode = targetedEvent.hitTestResult().innerNode();
if (innerNode && innerNode->layoutObject())
m_selectionController->handleGestureTwoFingerTap(targetedEvent);
return sendContextMenuEventForGesture(targetedEvent); return sendContextMenuEventForGesture(targetedEvent);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment