New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 638361 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 638351



Sign in to add a comment

OOPIF: SpellCheckProvider is a RenderViewObserver

Project Member Reported by lukasza@chromium.org, Aug 16 2016

Issue description

AFAIK being an RVO means that SpellCheckProvider won't work for OOPIFs (i.e. won't work for cases where RV is swapped-out).
 
Labels: -OS-Android -OS-Mac
For now I've tried to focus on SpellCheckProvider::OnAdvanceToNextMisspelling.  Unfortunately, I have not been able to come up with a repro that shows things not working in OOPIF case (most likely because I am not familiar with the spellchecking feature...).

I've also tried to see if SpellCheckProvider::OnAdvanceToNextMisspelling is covered by CQ tests, but unfortunately CL that removes body of that methods passes CQ dry run... (https://codereview.chromium.org/2235333004).

Comment 2 by dcheng@chromium.org, Aug 16 2016

A concrete example of a problem that being a RVO causes is  issue 625068 : we have to special case some code for spellcheck, since it can visit render views with no local frames at all.
Owner: ----
Owner: xiaoche...@chromium.org
Status: Assigned (was: Untriaged)
Test case from issue 638351  #13 : http://csreis.github.io/tests/cross-site-iframe-simple.html

I'm going to have a try on this.
SpellCheckProvider is weak referenced in WebViewImpl as a WebSpellCheckClient, and is used by the SpellCheckerClientImpl owned by the same WebViewImpl.

If we change SpellCheckProvider into a RenderFrameObserver, then it should be refererenced in a WebLocalFrameImpl instead of WebViewImpl. Then SpellCheckerClientImpl also needs to be moved to WebLocalFrameImpl.

So if we do this change, basically all renderer-side classes for spellchecking will be owned by frames. The only remaining thing owned by WebViewImpl is the current SpellCheckClientImpl::m_spellCheckThisFieldStatus, since we still want all frames in the same page to have the same spellcheck enabled status.

Comment 6 by creis@chromium.org, Mar 21 2017

Cc: creis@chromium.org dcheng@chromium.org
Labels: M-59
Making it frame-based sounds good to me.  dcheng@ can probably comment on the m_spellCheckThisFieldStatus part, which I imagine might belong on something Page-related rather than View-related?

Thanks for looking into it-- hope we'll be able to get it into M59?
M59 should be doable.
I think I got a better idea.

Blink has two abstract classes:
- SpellCheckerClient, which is a one-per-page class maintaining states of global spellchecking enabled and spelling UI. It doesn't handle any checking.
- TextCheckerClient passes all the checking requests to web/

However, at the web/ level, they are implemented by the same class SpellCheckerClientImpl, which communicates with SpellCheckProvider.

I think we can split SpellCheckerClientImpl into two classes to implement SpellCheckerClient and TextCheckerClient, respectively. We can also make TextCheckerClient frame-owned. Then we can do a similar split to SpellCheckProvider to two parts: an RVO and communicates with SpellCheckerClient, and an RFO that communicates with TextCheckerClient.

WDYT?

Comment 9 by creis@chromium.org, Mar 22 2017

We're trying to eventually eliminate RenderViewObserver.  Is there a way to avoid that part?

Otherwise it sounds reasonable to me (without knowing the spellcheck code), and I'd defer to dcheng@ on the Blink details.
I didn't notice the deprecation message of RenderView...

What's the Blink side plan about the deprecation? Are we going to do any change to WebView and WebViewClient?
I don't have a good idea to completely avoid RenderViewObserver. Anyway, since SpellCheckerProvider is already a RVO, I think it's OK to leave part of this class still as an RVO.

As we plan to fix it in M59, which is not too far away from now, I'll start the implementation as sketched in #22. Detailed plan is at: https://goo.gl/VfCENk
Can we ensure that spell checking is fixed in M59 first? We can look at completely removing RVO later (M60), if it isn't possible in the M59 timeframe. 
Fixing OOPIF spell checking should be doable in M59, as the design is already fixed and there doesn't seem to be too much work.

Completely removing RVO sounds strechy. I don't have a clean idea how to do that, so let's revisit that later.
Project Member

Comment 14 by bugdroid1@chromium.org, Apr 3 2017

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

commit d734458df440a682fd4c32c80153906622188091
Author: xiaochengh <xiaochengh@chromium.org>
Date: Mon Apr 03 20:18:00 2017

Split TextCheckerClientImpl off SpellCheckerClientImpl

This is Patch 1 of 5 for making SpellCheckProvider a
RenderFrameObserver, so that spellcheck can work in OOPIF.
Full design: https://goo.gl/VfCENk

This patch splits the implementation of TextCheckerClient off
SpellCheckerClientImpl into a new class, TextCheckerClientImpl.
The new class is still owned by WebViewImpl and weak referenced
by SpellCheckerClientImpl, so that there is no visible change
outside web/.

BUG= 638361 
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2796473002
Cr-Commit-Position: refs/heads/master@{#461520}

[modify] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/BUILD.gn
[modify] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp
[modify] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/SpellCheckerClientImpl.h
[add] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp
[add] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/TextCheckerClientImpl.h
[modify] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/WebViewImpl.cpp
[modify] https://crrev.com/d734458df440a682fd4c32c80153906622188091/third_party/WebKit/Source/web/WebViewImpl.h

Project Member

Comment 15 by bugdroid1@chromium.org, Apr 4 2017

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

commit 62dc793dc640ae5fd16d571a0c9199fe0fb740d0
Author: xiaochengh <xiaochengh@chromium.org>
Date: Tue Apr 04 21:59:36 2017

Split WebTextCheckClient off WebSpellCheckClient

This is Patch 2 of 5 for making SpellCheckProvider a RenderFrameObserver, so
that spellcheck can work in OOPIF. Full design: https://goo.gl/VfCENk

This patch splits the text checking functions off interface WebSpellCheckClient
into a new interface WebTextCheckClient, and makes it also referenced by WebView
(for now). Clients should call WebView::setTextCheckClient in initialization.

For subclasses implementing the interface:
- SpellCheckProvider is made to implement both interfaces
- Other subclasses are switch to implement WebTextCheckClient since they no
  longer implement any of WebSpellCheckClient's functions

BUG= 638361 
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2791753003
Cr-Commit-Position: refs/heads/master@{#461857}

[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/components/spellcheck/renderer/spellcheck_provider.cc
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/components/spellcheck/renderer/spellcheck_provider.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/content/shell/test_runner/spell_check_client.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/content/shell/test_runner/test_runner.cc
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/core/page/SpellCheckerClient.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/platform/text/TextCheckerClient.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/SpellCheckerClientImpl.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/TextCheckerClientImpl.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/WebViewImpl.cpp
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/WebViewImpl.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/public/BUILD.gn
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/public/web/WebSpellCheckClient.h
[add] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/public/web/WebTextCheckClient.h
[modify] https://crrev.com/62dc793dc640ae5fd16d571a0c9199fe0fb740d0/third_party/WebKit/public/web/WebView.h

Project Member

Comment 16 by bugdroid1@chromium.org, Apr 5 2017

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

commit 12aaa612b318e359ab3d6664c3fbbbb3ea14f034
Author: xiaochengh <xiaochengh@chromium.org>
Date: Wed Apr 05 02:30:58 2017

Move ownership of TextCheckerClientImpl to WebLocalFrameImpl

This is Patch 4 of 5 for making SpellCheckProvider a RenderFrameObserver, so
that spellcheck can work in OOPIF. Full design: https://goo.gl/VfCENk

This patch changes TextCheckerClientImpl from view-based to frame-based, as
a preparation for changing SpellCheckProvider from view-based to frame-based.

BUG= 638361 

Review-Url: https://codereview.chromium.org/2795113002
Cr-Commit-Position: refs/heads/master@{#461945}

[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/editing/spellcheck/SpellCheckTestBase.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/frame/LocalFrameClient.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/loader/EmptyClients.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/loader/EmptyClients.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/core/page/SpellCheckerClient.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/platform/text/TextCheckerClient.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/LocalFrameClientImpl.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/SpellCheckerClientImpl.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/SpellCheckerClientImpl.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/TextCheckerClientImpl.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/WebLocalFrameImpl.h
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/WebViewImpl.cpp
[modify] https://crrev.com/12aaa612b318e359ab3d6664c3fbbbb3ea14f034/third_party/WebKit/Source/web/WebViewImpl.h

Project Member

Comment 17 by bugdroid1@chromium.org, Apr 6 2017

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

commit dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36
Author: xiaochengh <xiaochengh@chromium.org>
Date: Thu Apr 06 02:51:50 2017

Split SpellCheckPanel off SpellCheckProvider

This is Patch 3 of 6 for making SpellCheckProvider a RenderFrameObserver, so
that spellcheck can work in OOPIF. Full design: https://goo.gl/VfCENk

This patch splits SpellCheckProvider into two classes: functions related to
spelling panel are moved to a new class SpellCheckPanel, and the remaining
functions remain in SpellCheckProvider.

This patch is a preparation for changing SpellCheckProvider into a
RenderFrameObserver.

BUG= 638361 

Review-Url: https://codereview.chromium.org/2792233003
Cr-Commit-Position: refs/heads/master@{#462335}

[modify] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/chrome/renderer/chrome_content_renderer_client.cc
[modify] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/components/spellcheck/renderer/BUILD.gn
[add] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/components/spellcheck/renderer/spellcheck_panel.cc
[add] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/components/spellcheck/renderer/spellcheck_panel.h
[modify] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/components/spellcheck/renderer/spellcheck_provider.cc
[modify] https://crrev.com/dd47f6d8f5b234da6ec4bf952d44ff73c01bcc36/components/spellcheck/renderer/spellcheck_provider.h

Project Member

Comment 18 by bugdroid1@chromium.org, Apr 6 2017

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

commit 81bfb1741ab51947f5fc7c741eadd92779fe13b2
Author: xiaochengh <xiaochengh@chromium.org>
Date: Thu Apr 06 17:54:33 2017

Move WebTextCheckClient reference from WebViewImpl to WebLocalFrameImpl

This is Patch 5 of 6 for making SpellCheckProvider a RenderFrameObserver, so
that spellcheck can work in OOPIF. Full design: https://goo.gl/VfCENk

This patch moves the Blink-side reference to WebTextCheckClient from
WebViewImpl to WebLocalFrameImpl, as a preparation for changing
SpellCheckProvider from RenderViewObserver to RenderFrameObserver.

Currently, SpellCheckProvider is still view-based, and all WebLocalFrames of
the same view are holding references to the same SpellCheckProvider. Follow
up patch will change that.

For layout tests, by design there should be only one mock spell checker
instance. This patch also ensures that this instance is used by all
WebLocalFrames.

BUG= 638361 

Review-Url: https://codereview.chromium.org/2797073002
Cr-Commit-Position: refs/heads/master@{#462538}

[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/chrome/renderer/chrome_content_renderer_client.cc
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/components/spellcheck/renderer/spellcheck_provider.cc
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/content/shell/renderer/layout_test/layout_test_render_frame_observer.cc
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/content/shell/test_runner/test_runner.cc
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/content/shell/test_runner/test_runner.h
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/content/shell/test_runner/web_test_runner.h
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/TextCheckerClientImpl.cpp
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/WebLocalFrameImpl.h
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/WebViewImpl.cpp
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/WebViewImpl.h
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/public/web/WebLocalFrame.h
[modify] https://crrev.com/81bfb1741ab51947f5fc7c741eadd92779fe13b2/third_party/WebKit/public/web/WebView.h

Project Member

Comment 19 by bugdroid1@chromium.org, Apr 11 2017

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

commit 57078b411bb68d6db438b05bd90e2bd60cb670e4
Author: xiaochengh <xiaochengh@chromium.org>
Date: Tue Apr 11 23:16:25 2017

Introduce RenderFrameVisitor

This patch introduces RenderFrameVisitor, so that we can perform batch
operations to each living RenderFrame.

This patch is a preparation for making SpellCheckProvider a
RenderFrameObserver: https://crrev.com/2799923003

BUG= 638361 

Review-Url: https://codereview.chromium.org/2797383002
Cr-Commit-Position: refs/heads/master@{#463827}

[modify] https://crrev.com/57078b411bb68d6db438b05bd90e2bd60cb670e4/content/public/renderer/BUILD.gn
[modify] https://crrev.com/57078b411bb68d6db438b05bd90e2bd60cb670e4/content/public/renderer/render_frame.h
[add] https://crrev.com/57078b411bb68d6db438b05bd90e2bd60cb670e4/content/public/renderer/render_frame_visitor.h
[modify] https://crrev.com/57078b411bb68d6db438b05bd90e2bd60cb670e4/content/renderer/render_frame_impl.cc

Project Member

Comment 20 by bugdroid1@chromium.org, Apr 12 2017

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

commit 0c92b1cfa21b855c0e8c19f5550ae5209a325936
Author: xiaochengh <xiaochengh@chromium.org>
Date: Wed Apr 12 03:06:49 2017

Change SpellCheckProvider into a RenderFrameObserver

This is Patch 6 of 6 for making SpellCheckProvider a RenderFrameObserver, so
that spellcheck can work in OOPIF. Full design: https://goo.gl/VfCENk

This patch changes SpellCheckProvider into a RenderFrameObserver, so that
spellcheck messages from OOPIFs can be successfully sent to browser, making
spell-checking work in OOPIFs.

BUG= 638361 ,710044, 625068 

Review-Url: https://codereview.chromium.org/2799923003
Cr-Commit-Position: refs/heads/master@{#463912}

[modify] https://crrev.com/0c92b1cfa21b855c0e8c19f5550ae5209a325936/android_webview/renderer/aw_content_renderer_client.cc
[modify] https://crrev.com/0c92b1cfa21b855c0e8c19f5550ae5209a325936/chrome/renderer/chrome_content_renderer_client.cc
[modify] https://crrev.com/0c92b1cfa21b855c0e8c19f5550ae5209a325936/components/spellcheck/renderer/spellcheck.cc
[modify] https://crrev.com/0c92b1cfa21b855c0e8c19f5550ae5209a325936/components/spellcheck/renderer/spellcheck_provider.cc
[modify] https://crrev.com/0c92b1cfa21b855c0e8c19f5550ae5209a325936/components/spellcheck/renderer/spellcheck_provider.h

Project Member

Comment 21 by bugdroid1@chromium.org, Apr 14 2017

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

commit b6c55a8e1595e5d65760be3adba1e26e0e03e95e
Author: xiaochengh <xiaochengh@chromium.org>
Date: Fri Apr 14 02:14:59 2017

Add a browser test for checking spelling in out-of-process subframes

This patch adds a regression test for a bug that was there but has been
fixed: spellcheck messages were not sent out from out-of-process iframes.

BUG= 638361 

Review-Url: https://codereview.chromium.org/2819463002
Cr-Commit-Position: refs/heads/master@{#464658}

[modify] https://crrev.com/b6c55a8e1595e5d65760be3adba1e26e0e03e95e/chrome/browser/chrome_site_per_process_browsertest.cc
[add] https://crrev.com/b6c55a8e1595e5d65760be3adba1e26e0e03e95e/chrome/test/data/page_with_contenteditable.html
[add] https://crrev.com/b6c55a8e1595e5d65760be3adba1e26e0e03e95e/chrome/test/data/page_with_contenteditable_in_cross_site_subframe.html

Status: Fixed (was: Assigned)

Comment 23 by creis@chromium.org, Apr 14 2017

This is awesome-- thank you!
Components: -UI>Browser>Spellcheck UI>Browser>Language>Spellcheck

Sign in to add a comment