New issue
Advanced search Search tips

Issue 845849 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug-Regression

Blocked on:
issue 846527



Sign in to add a comment

Regression : [md-extensions] Text caret is not seen inside search box after clicking in it for the first instance.

Reported by avsha...@etouch.net, May 23 2018

Issue description

Chrome Version : 67.0.3396.56 (Official Build) eff3e3f46cf53019f8f43c3d4678e87fa7086fb8-refs/branch-heads/3396@{#682} 32/64-bit
OS : Windows(7, 8, 8.1, 10), Linux(14.04 LTS), Mac(10.12.6, 10.13.1, 10.13.5)

What steps will reproduce the problem?
1. Launch chrome and navigate to chrome://extensions page.
2. Now click on toggle button of 'Docs' extension to disable it.
3. Hit Ctrl + A from keyboard and click inside search box present on the extensions page.
4. Observe.

Actual Result : Text caret is not seen inside search box after clicking in it for the first instance.

Expected Result : Text caret should appear inside search box as soon as user click in it.

This is a regression issue, broken in M-63 and providing the bisect using per-revision script:
Good Build : 63.0.3210.0 (Revision : 500530) 
Bad Build : 63.0.3211.0 (Revision : 500753)

Change Log URL :
https://chromium.googlesource.com/chromium/src/+log/06fba2c7e0d9f64343998fe61abc49295b2c784f..14527543958d60b00d130bb0a06945d72b44966f

Suspect : https://chromium.googlesource.com/chromium/src/+/14527543958d60b00d130bb0a06945d72b44966f

@Xiaocheng : Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Note : 
1. After step 3, the search icon (magnifying glass) in search box gets activated but text caret does not appear.
2. This issue is also reproducible on Canary #68.03438.0, Dev #68.0.3432.3 and Stable #66.0.3359.181
 
Actual_Result.mp4
394 KB View Download
Expected_Result.mp4
499 KB View Download
Components: -UI>Browser>ExtensionsManagement Blink>Editing>Selection
My CL fixed some potential bugs but reveal other bugs...

Root cause: we sometimes get inconsistent results from FrameSelection::ComputeVisibleSelectionInDOMTree() and FrameSelection::ComputeVisibleSelectionInFlatTree() that, one of them is non-null but the other is null.

In addition, these two operations have side effect - if one gets null, it sets the other to null. This is normally fine, but when we run into the consistency bug above, we run into troubles...

And chrome://extensions page belongs to such buggy case...

Recap:

1. Ctrl+A sets selection as base: HTML@BeforeChildren, extent: HTML@AfterChildren

2. When clicking back in search field, SelectionController checks whether we are clicking inside existing selection to decide whether create a new selection or not, by calling FrameSelection::Contains()

3. FrameSelection::Contains()_stores the visible selection as

const VisibleSelectionInFlatTree& visible_selection = ComputeVisibleSelectionInFlatTree();

The value of |visible_selection| is non-null at its initialization

4. The function then performs a hit test, which somehow calls ComputeVisibleSelectionInDOMTree() inside and got null, which also sets ComputeVisibleSelectionInFlatTree()'s result to null.

5a. Before my patch, |visible_selection| holds a reference to |SelectionEditor|'s stored result of CVSinFT(), which becomes null after the hit test. Hence, after the hit test, FrameSelection::Contains() checks the hit test result against a null selection and returns false.

5b. After my patch, |visible_selection| becomes an independent temporary variable, which remains non-null after the hit test. Then FrameSelection::Contains() checks the hit test result against this non-null selection and returns true, which blocks the caret to be set in the search field.
Blockedon: 846527

Comment 3 by yosin@chromium.org, May 25 2018

>#c1, The function then performs a hit test, which somehow calls ComputeVisibleSelectionInDOMTree() inside

Could you put exact location where calling ComputeVSInDOMTree() during hit test?
We should fix that.
Project Member

Comment 4 by bugdroid1@chromium.org, May 25 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b6f6b01534cbc5525b5d57b9693a1c2053c52f22

commit b6f6b01534cbc5525b5d57b9693a1c2053c52f22
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Fri May 25 05:30:38 2018

Make FrameSelection::Contains return false for null VisibleSelection in DOM tree

This is a workaround for  crbug.com/845849 .

In some buggy cases, we get ComputeVisibleSelectionInFlatTree() returning
non-null, but ComputeVisibleSelectionInDOMTree() returning null. This
makes FrameSelection::Contains() return true erroneously.

As we don't have a fix to the inconsistency, this patch adds a
workaround that, we call ComputeVisibleSelectionInDOMTree() first to
set the cached VisibleSelections to null also for flat tree, so that
the following computation does not work on a non-null VS in flat tree
erroneously.

Bug:  845849 
Change-Id: I7255d8224b8b6e29d479dd635e2c4ee99b366fc1
Reviewed-on: https://chromium-review.googlesource.com/1072924
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#561775}
[modify] https://crrev.com/b6f6b01534cbc5525b5d57b9693a1c2053c52f22/third_party/blink/renderer/core/editing/frame_selection.cc

Status: Fixed (was: Assigned)
Labels: Merge-Request-68
Project Member

Comment 7 by sheriffbot@chromium.org, May 26 2018

Labels: -Merge-Request-68 Hotlist-Merge-Approved Merge-Approved-68
Your change meets the bar and is auto-approved for M68. Please go ahead and merge the CL to branch 3440 manually. Please contact milestone owner if you have questions.
Owners: cmasso@(Android), kariahda@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 8 by bugdroid1@chromium.org, May 28 2018

Labels: -merge-approved-68 merge-merged-3440
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4a049d47df6ab86b8fa67acefaba87b570948609

commit 4a049d47df6ab86b8fa67acefaba87b570948609
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Mon May 28 18:08:09 2018

Make FrameSelection::Contains return false for null VisibleSelection in DOM tree

This is a workaround for  crbug.com/845849 .

In some buggy cases, we get ComputeVisibleSelectionInFlatTree() returning
non-null, but ComputeVisibleSelectionInDOMTree() returning null. This
makes FrameSelection::Contains() return true erroneously.

As we don't have a fix to the inconsistency, this patch adds a
workaround that, we call ComputeVisibleSelectionInDOMTree() first to
set the cached VisibleSelections to null also for flat tree, so that
the following computation does not work on a non-null VS in flat tree
erroneously.

Bug:  845849 
Change-Id: I7255d8224b8b6e29d479dd635e2c4ee99b366fc1
Reviewed-on: https://chromium-review.googlesource.com/1072924
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#561775}(cherry picked from commit b6f6b01534cbc5525b5d57b9693a1c2053c52f22)
Reviewed-on: https://chromium-review.googlesource.com/1075707
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/branch-heads/3440@{#14}
Cr-Branched-From: 010ddcfda246975d194964ccf20038ebbdec6084-refs/heads/master@{#561733}
[modify] https://crrev.com/4a049d47df6ab86b8fa67acefaba87b570948609/third_party/blink/renderer/core/editing/frame_selection.cc

Comment 9 by avsha...@etouch.net, May 30 2018

Labels: TE-Verified-68.0.3440.7 TE-Verified-M68
Update : 
Retested above issue in latest Dev build #68.0.3440.7 on Windows(7, 8, 8.1, 10), Mac(10.12.6, 10.13.1, 10.13.5) & Linux 14.04 LTS OS and the issue is fixed. Text caret is seen as expected in 'Search box' for the first instance. Kindly review an attached screen-cast for the reference.

Thank you..!
Latest_behaviour.mp4
273 KB View Download

Sign in to add a comment