Fixing dependency problem for the mojo Range class

The mojo Range class needs range_struct_traits.h and the build
system wasn't setup to allow that. Simplest for everyone is to integrate
the struct_traits target into the mojom target and let the mojo system
figure out dependencies. This made everything simpler.

Without this fix you got errors like the one below:

ERROR at //out/Default/gen/content/common/input/input_handler.mojom-test-utils.cc:49:11: Can't include this header from here.
          ^--------------------------------------
The target:
  //content/common:mojo_bindings
is including a file from the target:
  //ui/gfx/range/mojo:struct_traits

It's usually best to depend directly on the destination target.
In some cases, the destination target is considered a subcomponent
of an intermediate target. In this case, the intermediate target
should depend publicly on the destination to forward the ability
to include headers.

Dependency chain (there may also be others):
  //content/common:mojo_bindings -->
  //services/ws/public/mojom/ime:ime --[private]-->
  //ui/gfx/range/mojo:struct_traits

Bug: 938893
Change-Id: If01554d38ca3d5f4280d32c658d1f7044f14c29e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1536056
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#644390}
diff --git a/ash/public/interfaces/app_list.typemap b/ash/public/interfaces/app_list.typemap
index 66f8326..169a3c49 100644
--- a/ash/public/interfaces/app_list.typemap
+++ b/ash/public/interfaces/app_list.typemap
@@ -8,9 +8,6 @@
 sources = [
   "//ash/public/cpp/app_list/app_list_struct_traits.cc",
 ]
-deps = [
-  "//ui/gfx/range/mojo:struct_traits",
-]
 type_mappings = [
   "ash.mojom.AppListState=ash::AppListState",
   "ash.mojom.AppListModelStatus=ash::AppListModelStatus",
diff --git a/services/ws/public/mojom/BUILD.gn b/services/ws/public/mojom/BUILD.gn
index 9759d0a0..fd5d408 100644
--- a/services/ws/public/mojom/BUILD.gn
+++ b/services/ws/public/mojom/BUILD.gn
@@ -65,6 +65,5 @@
     "//services/ws/public/mojom/ime",
     "//testing/gtest",
     "//ui/gfx:test_support",
-    "//ui/gfx/range/mojo:struct_traits",
   ]
 }
diff --git a/ui/accessibility/mojom/ax_assistant_structure.typemap b/ui/accessibility/mojom/ax_assistant_structure.typemap
index 56161a6f..dc559e8c 100644
--- a/ui/accessibility/mojom/ax_assistant_structure.typemap
+++ b/ui/accessibility/mojom/ax_assistant_structure.typemap
@@ -16,7 +16,6 @@
   "//ui/gfx/geometry/mojo",
   "//ui/gfx/geometry/mojo:struct_traits",
   "//ui/gfx/range/mojo",
-  "//ui/gfx/range/mojo:struct_traits",
 ]
 type_mappings = [
   "ax.mojom.AssistantTree=std::unique_ptr<ui::AssistantTree>[move_only,nullable_is_same_type]",
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
index c063211..a9f5ba1f 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
@@ -967,7 +967,6 @@
     deps += [
       "//ui/base/ime",
       "//ui/base/ime/mojo:test_interfaces",
-      "//ui/gfx/range/mojo:struct_traits",
     ]
   }
 
diff --git a/ui/base/ime/mojo/ime_types.typemap b/ui/base/ime/mojo/ime_types.typemap
index ee4d337..acdc8fff 100644
--- a/ui/base/ime/mojo/ime_types.typemap
+++ b/ui/base/ime/mojo/ime_types.typemap
@@ -19,7 +19,6 @@
 ]
 deps = [
   "//ui/gfx/range",
-  "//ui/gfx/range/mojo:struct_traits",
 ]
 
 type_mappings = [
diff --git a/ui/gfx/range/mojo/BUILD.gn b/ui/gfx/range/mojo/BUILD.gn
index b6d458d..106b6b5 100644
--- a/ui/gfx/range/mojo/BUILD.gn
+++ b/ui/gfx/range/mojo/BUILD.gn
@@ -37,13 +37,3 @@
     "//ui/gfx/range",
   ]
 }
-
-source_set("struct_traits") {
-  sources = [
-    "range_struct_traits.h",
-  ]
-  public_deps = [
-    ":mojo_shared_cpp_sources",
-    "//ui/gfx/range",
-  ]
-}
diff --git a/ui/gfx/range/mojo/OWNERS b/ui/gfx/range/mojo/OWNERS
index 1841ff6..fda0d85 100644
--- a/ui/gfx/range/mojo/OWNERS
+++ b/ui/gfx/range/mojo/OWNERS
@@ -1,5 +1,8 @@
+per-file *.mojom=set noparent
+per-file *.mojom=file://ipc/SECURITY_OWNERS
+
 per-file *_struct_traits*.*=set noparent
 per-file *_struct_traits*.*=file://ipc/SECURITY_OWNERS
 
-per-file *.mojom=set noparent
-per-file *.mojom=file://ipc/SECURITY_OWNERS
+per-file *.typemap=set noparent
+per-file *.typemap=file://ipc/SECURITY_OWNERS
diff --git a/ui/gfx/range/mojo/range.typemap b/ui/gfx/range/mojo/range.typemap
index ebf07d14..b13de282 100644
--- a/ui/gfx/range/mojo/range.typemap
+++ b/ui/gfx/range/mojo/range.typemap
@@ -8,10 +8,13 @@
   "//ui/gfx/range/range_f.h",
 ]
 traits_headers = [ "//ui/gfx/range/mojo/range_struct_traits.h" ]
-deps = [
-  "//ui/gfx/range/mojo:struct_traits",
-]
 type_mappings = [
   "gfx.mojom.Range=gfx::Range",
   "gfx.mojom.RangeF=gfx::RangeF",
 ]
+sources = [
+  "range_struct_traits.h",
+]
+deps = [
+  "//ui/gfx/range",
+]