Commit e2ee0b0a authored by nzolghadr's avatar nzolghadr Committed by Commit bot

Update distribution on the nodes involved in click

Calling updateDistribution function on the nodes
that are involved in a click (both mouseup and
mousedown nodes) to prevent dchecks when calculating
their parents

BUG=604981

Review URL: https://codereview.chromium.org/1907633002

Cr-Commit-Position: refs/heads/master@{#389906}
parent 9af0021f
......@@ -1512,15 +1512,20 @@ WebInputEventResult EventHandler::handleMouseReleaseEvent(const PlatformMouseEve
&& mev.innerNode()->canParticipateInFlatTree() && m_clickNode->canParticipateInFlatTree()
&& !(selectionController().hasExtendedSelection() && isLinkSelection(mev));
if (shouldDispatchClickEvent) {
Node* clickTargetNode = nullptr;
// Updates distribution because a 'mouseup' event listener can make the
// tree dirty at dispatchMouseEvent() invocation above.
// Unless distribution is updated, commonAncestor would hit ASSERT.
// Both m_clickNode and mev.innerNode() don't need to be updated
// because commonAncestor() will exit early if their documents are different.
m_clickNode->updateDistribution();
if (Node* clickTargetNode = mev.innerNode()->commonAncestor(
*m_clickNode, parentForClickEvent)) {
if (m_clickNode == mev.innerNode()) {
clickTargetNode = m_clickNode;
clickTargetNode->updateDistribution();
} else if (m_clickNode->document() == mev.innerNode()->document()) {
m_clickNode->updateDistribution();
mev.innerNode()->updateDistribution();
clickTargetNode = mev.innerNode()->commonAncestor(
*m_clickNode, parentForClickEvent);
}
if (clickTargetNode) {
// Dispatch mouseup directly w/o calling updateMouseEventTargetNodeAndSendEvents
// because the mouseup dispatch above has already updated it
// correctly. Moreover, clickTargetNode is different from
......
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