Fix build dependency error in spellcheck mojo

spellcheck/common:interfaces (via typemap) uses some
spellcheck_result.h and spellcheck_struct_traits.h so those
cannot be in a target "above" the mojom build target.

Bug: 938893
Change-Id: Ic3a307248542dfa9b02cb7fb548d88734c6db509
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1528192
Auto-Submit: Daniel Bratell <bratell@opera.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Rouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#643831}
diff --git a/components/spellcheck/common/BUILD.gn b/components/spellcheck/common/BUILD.gn
index cf40a7397..38a16f7 100644
--- a/components/spellcheck/common/BUILD.gn
+++ b/components/spellcheck/common/BUILD.gn
@@ -11,16 +11,13 @@
     "spellcheck_common.h",
     "spellcheck_features.cc",
     "spellcheck_features.h",
-    "spellcheck_result.cc",
-    "spellcheck_result.h",
-    "spellcheck_struct_traits.cc",
-    "spellcheck_struct_traits.h",
     "spellcheck_switches.cc",
     "spellcheck_switches.h",
   ]
 
   public_deps = [
     ":interfaces",
+    ":spellcheck_result",
     "//components/spellcheck:buildflags",
   ]
 
@@ -31,6 +28,19 @@
   ]
 }
 
+# This is separated out because it is used by both the mojo interfaces below
+# (see spellcheck.typemap) and by "common" above.
+source_set("spellcheck_result") {
+  sources = [
+    "spellcheck_result.cc",
+    "spellcheck_result.h",
+  ]
+
+  deps = [
+    "//base",
+  ]
+}
+
 mojom("interfaces") {
   sources = [
     "spellcheck.mojom",
diff --git a/components/spellcheck/common/spellcheck.typemap b/components/spellcheck/common/spellcheck.typemap
index 42e0739..fa84bd42 100644
--- a/components/spellcheck/common/spellcheck.typemap
+++ b/components/spellcheck/common/spellcheck.typemap
@@ -12,6 +12,15 @@
   "//components/spellcheck:buildflags",
 ]
 
+public_deps = [
+  ":spellcheck_result",
+]
+
+sources = [
+  "spellcheck_struct_traits.cc",
+  "spellcheck_struct_traits.h",
+]
+
 type_mappings = [
   "spellcheck.mojom.Decoration=::SpellCheckResult::Decoration",
   "spellcheck.mojom.SpellCheckResult=::SpellCheckResult",