Implement FromDict/IntoDict for BackgroundTracingConfig.
[chromium-blink-merge.git] / ui / gfx / BUILD.gn
blob5d7973cd310e1dd29122c2565df75cf44a307709
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/config.gni")
10   import("//build/config/android/rules.gni")
13 # Several targets want to include this header file, and some of them are
14 # child dependencies of "gfx". Therefore, we separate it out here so multiple
15 # targets can all have a dependency for header checking purposes without
16 # creating circular dependencies.
17 source_set("gfx_export") {
18   sources = [
19     "gfx_export.h",
20   ]
23 component("gfx") {
24   sources = [
25     "android/device_display_info.cc",
26     "android/device_display_info.h",
27     "android/gfx_jni_registrar.cc",
28     "android/gfx_jni_registrar.h",
29     "android/java_bitmap.cc",
30     "android/java_bitmap.h",
31     "android/shared_device_display_info.cc",
32     "android/shared_device_display_info.h",
33     "android/view_configuration.cc",
34     "android/view_configuration.h",
35     "animation/animation.cc",
36     "animation/animation.h",
37     "animation/animation_container.cc",
38     "animation/animation_container.h",
39     "animation/animation_container_element.h",
40     "animation/animation_container_observer.h",
41     "animation/animation_delegate.h",
42     "animation/linear_animation.cc",
43     "animation/linear_animation.h",
44     "animation/multi_animation.cc",
45     "animation/multi_animation.h",
46     "animation/slide_animation.cc",
47     "animation/slide_animation.h",
48     "animation/throb_animation.cc",
49     "animation/throb_animation.h",
50     "animation/tween.cc",
51     "animation/tween.h",
52     "blit.cc",
53     "blit.h",
54     "break_list.h",
55     "canvas.cc",
56     "canvas.h",
57     "canvas_notimplemented.cc",
58     "canvas_paint_mac.h",
59     "canvas_paint_mac.mm",
60     "canvas_skia.cc",
61     "canvas_skia_paint.h",
62     "codec/jpeg_codec.cc",
63     "codec/jpeg_codec.h",
64     "codec/png_codec.cc",
65     "codec/png_codec.h",
66     "color_analysis.cc",
67     "color_analysis.h",
68     "color_profile.cc",
69     "color_profile.h",
70     "color_profile_mac.mm",
71     "color_profile_win.cc",
72     "color_utils.cc",
73     "color_utils.h",
74     "display.cc",
75     "display.h",
76     "display_change_notifier.cc",
77     "display_change_notifier.h",
78     "display_observer.cc",
79     "display_observer.h",
80     "favicon_size.cc",
81     "favicon_size.h",
82     "font.cc",
83     "font.h",
84     "font_fallback.h",
85     "font_fallback_linux.cc",
86     "font_fallback_mac.mm",
87     "font_fallback_win.cc",
88     "font_fallback_win.h",
89     "font_list.cc",
90     "font_list.h",
91     "font_list_impl.cc",
92     "font_list_impl.h",
93     "font_render_params.cc",
94     "font_render_params.h",
95     "font_render_params_android.cc",
96     "font_render_params_linux.cc",
97     "font_render_params_mac.cc",
98     "font_render_params_win.cc",
99     "gdi_util.cc",
100     "gdi_util.h",
101     "gfx_paths.cc",
102     "gfx_paths.h",
103     "gpu_memory_buffer.cc",
104     "gpu_memory_buffer.h",
105     "hud_font.cc",
106     "hud_font.h",
107     "icon_util.cc",
108     "icon_util.h",
109     "image/canvas_image_source.cc",
110     "image/canvas_image_source.h",
111     "image/image.cc",
112     "image/image.h",
113     "image/image_family.cc",
114     "image/image_family.h",
115     "image/image_ios.mm",
116     "image/image_mac.mm",
117     "image/image_png_rep.cc",
118     "image/image_png_rep.h",
119     "image/image_skia.cc",
120     "image/image_skia.h",
121     "image/image_skia_operations.cc",
122     "image/image_skia_operations.h",
123     "image/image_skia_rep.cc",
124     "image/image_skia_rep.h",
125     "image/image_skia_source.h",
126     "image/image_skia_util_ios.h",
127     "image/image_skia_util_ios.mm",
128     "image/image_skia_util_mac.h",
129     "image/image_skia_util_mac.mm",
130     "image/image_util.cc",
131     "image/image_util.h",
132     "image/image_util_ios.mm",
133     "interpolated_transform.cc",
134     "interpolated_transform.h",
135     "linux_font_delegate.cc",
136     "linux_font_delegate.h",
137     "mac/coordinate_conversion.h",
138     "mac/coordinate_conversion.mm",
139     "mac/nswindow_frame_controls.h",
140     "mac/nswindow_frame_controls.mm",
141     "mac/scoped_ns_disable_screen_updates.h",
142     "native_widget_types.h",
143     "nine_image_painter.cc",
144     "nine_image_painter.h",
145     "paint_throbber.cc",
146     "paint_throbber.h",
147     "path.cc",
148     "path.h",
149     "path_aura.cc",
150     "path_win.cc",
151     "path_win.h",
152     "path_x11.cc",
153     "path_x11.h",
154     "platform_font.h",
155     "platform_font_android.cc",
156     "platform_font_ios.h",
157     "platform_font_ios.mm",
158     "platform_font_linux.cc",
159     "platform_font_linux.h",
160     "platform_font_mac.h",
161     "platform_font_mac.mm",
162     "platform_font_win.cc",
163     "platform_font_win.h",
164     "range/range.cc",
165     "range/range.h",
166     "range/range_f.cc",
167     "range/range_f.h",
168     "range/range_mac.mm",
169     "range/range_win.cc",
170     "scoped_canvas.h",
171     "scoped_cg_context_save_gstate_mac.h",
172     "scoped_ns_graphics_context_save_gstate_mac.h",
173     "scoped_ns_graphics_context_save_gstate_mac.mm",
174     "scoped_ui_graphics_push_context_ios.h",
175     "scoped_ui_graphics_push_context_ios.mm",
176     "screen.cc",
177     "screen.h",
178     "screen_android.cc",
179     "screen_aura.cc",
180     "screen_ios.mm",
181     "screen_mac.mm",
182     "screen_win.cc",
183     "screen_win.h",
184     "scrollbar_size.cc",
185     "scrollbar_size.h",
186     "selection_model.cc",
187     "selection_model.h",
188     "sequential_id_generator.cc",
189     "sequential_id_generator.h",
190     "shadow_value.cc",
191     "shadow_value.h",
192     "skbitmap_operations.cc",
193     "skbitmap_operations.h",
194     "skia_util.cc",
195     "skia_util.h",
196     "switches.cc",
197     "switches.h",
198     "sys_color_change_listener.cc",
199     "sys_color_change_listener.h",
200     "text_constants.h",
201     "text_elider.cc",
202     "text_elider.h",
203     "text_utils.cc",
204     "text_utils.h",
205     "text_utils_android.cc",
206     "text_utils_ios.mm",
207     "transform.cc",
208     "transform.h",
209     "transform_util.cc",
210     "transform_util.h",
211     "ui_gfx_exports.cc",
212     "utf16_indexing.cc",
213     "utf16_indexing.h",
214     "vsync_provider.h",
215     "win/direct_write.cc",
216     "win/direct_write.h",
217     "win/dpi.cc",
218     "win/dpi.h",
219     "win/hwnd_util.cc",
220     "win/hwnd_util.h",
221     "win/scoped_set_map_mode.h",
222     "win/singleton_hwnd.cc",
223     "win/singleton_hwnd.h",
224     "win/singleton_hwnd_observer.cc",
225     "win/singleton_hwnd_observer.h",
226     "win/window_impl.cc",
227     "win/window_impl.h",
228   ]
230   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
231   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
233   defines = [ "GFX_IMPLEMENTATION" ]
235   deps = [
236     ":gfx_export",
237     "//base",
238     "//base:i18n",
239     "//base:base_static",
240     "//base/third_party/dynamic_annotations",
241     "//skia",
242     "//third_party/harfbuzz-ng",
243     "//third_party/libpng",
244     "//third_party/zlib",
245     "//ui/gfx/geometry",
246   ]
247   public_deps = [
248     "//base",
249     "//skia",
250     "//third_party/icu",
251   ]
253   # Text rendering conditions (complicated so separated out).
254   if (is_android || is_ios) {
255     # We don't support RenderText on these platforms.
256   } else {
257     # Mac doesn't use RenderTextHarfBuzz by default yet.
258     sources += [
259       "harfbuzz_font_skia.cc",
260       "harfbuzz_font_skia.h",
261       "render_text.cc",
262       "render_text.h",
263       "render_text_harfbuzz.cc",
264       "render_text_harfbuzz.h",
265       "render_text_mac.cc",
266       "render_text_mac.h",
267       "text_utils_skia.cc",
268     ]
269   }
271   # iOS.
272   if (is_ios) {
273     sources -= [
274       "codec/jpeg_codec.cc",
275       "codec/jpeg_codec.h",
276     ]
277   } else {
278     deps += [ "//third_party:jpeg" ]
279   }
281   # Android.
282   if (is_android) {
283     sources -= [
284       "animation/throb_animation.cc",
285       "canvas_skia.cc",
286       "selection_model.cc",
287     ]
289     if (use_aura) {
290       sources -= [ "screen_android.cc" ]
291     } else {
292       sources -= [ "path.cc" ]
293     }
295     if (!is_debug) {
296       configs -= [ "//build/config/compiler:optimize" ]
297       configs += [ "//build/config/compiler:optimize_max" ]
298     }
300     deps += [
301       ":gfx_jni_headers",
302       "//base:base_java",
303     ]
304     libs = [
305       "android",
306       "jnigraphics",
307     ]
308   } else {
309     sources -= [ "canvas_notimplemented.cc" ]
310   }
312   # Windows.
313   if (is_win) {
314     cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()), which is
315                             # uninteresting.
316   } else {
317     sources -= [
318       "gdi_util.cc",
319       "gdi_util.h",
320       "icon_util.cc",
321       "icon_util.h",
322     ]
323   }
325   # Linux.
326   if (is_linux) {
327     configs += [ "//build/config/linux:fontconfig" ]
328   }
330   # Chrome OS
331   if (is_chromeos) {
332     # Robust JPEG decoding for the login screen.
333     sources += [
334       "chromeos/codec/jpeg_codec_robust_slow.cc",
335       "chromeos/codec/jpeg_codec_robust_slow.h",
336     ]
337     deps += [ "//third_party/libjpeg" ]
338   }
340   if (!use_aura) {
341     sources -= [
342       "path_aura.cc",
343       "screen_aura.cc",
344     ]
345     if (!toolkit_views) {
346       sources -= [
347         "nine_image_painter.cc",
348         "nine_image_painter.h",
349       ]
350     }
351   }
353   if (use_x11) {
354     deps += [ "//ui/gfx/x" ]
355     configs += [ "//build/config/linux:x11" ]
356   } else {
357     sources -= [ "path_x11.cc" ]
358   }
360   if (use_cairo) {
361     configs += [ "//build/config/linux:pangocairo" ]
362   }
365 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
367 source_set("test_support") {
368   testonly = true
369   sources = [
370     "image/image_unittest_util.cc",
371     "image/image_unittest_util.h",
372     "image/image_unittest_util_ios.mm",
373     "image/image_unittest_util_mac.mm",
374     "test/fontconfig_util_linux.cc",
375     "test/fontconfig_util_linux.h",
376     "test/gfx_util.cc",
377     "test/gfx_util.h",
378     "test/ui_cocoa_test_helper.h",
379     "test/ui_cocoa_test_helper.mm",
380   ]
382   public_deps = [
383     ":gfx",
384   ]
386   deps = [
387     "//base",
388     "//base/test:test_support",
389     "//skia",
390     "//testing/gtest",
391     "//ui/gfx/geometry",
392   ]
394   if (is_ios) {
395     # The cocoa files don't apply to iOS.
396     sources -= [
397       "test/ui_cocoa_test_helper.h",
398       "test/ui_cocoa_test_helper.mm",
399     ]
400   }
401   if (is_linux) {
402     configs += [ "//build/config/linux:fontconfig" ]
403   }
406 test("gfx_unittests") {
407   sources = [
408     "font_render_params_linux_unittest.cc",
409     "font_unittest.cc",
410     "image/image_family_unittest.cc",
411     "image/image_ios_unittest.mm",
412     "image/image_skia_unittest.cc",
413     "image/image_unittest.cc",
414     "platform_font_linux_unittest.cc",
415     "screen_unittest.cc",
416     "test/run_all_unittests.cc",
417     "text_elider_unittest.cc",
418     "text_utils_unittest.cc",
419   ]
421   if (!is_ios) {
422     sources += [
423       "animation/animation_container_unittest.cc",
424       "animation/animation_unittest.cc",
425       "animation/multi_animation_unittest.cc",
426       "animation/slide_animation_unittest.cc",
427       "animation/tween_unittest.cc",
428       "blit_unittest.cc",
429       "break_list_unittest.cc",
430       "canvas_unittest.cc",
431       "canvas_unittest_mac.mm",
432       "codec/jpeg_codec_unittest.cc",
433       "codec/png_codec_unittest.cc",
434       "color_analysis_unittest.cc",
435       "color_profile_mac_unittest.mm",
436       "color_utils_unittest.cc",
437       "display_change_notifier_unittest.cc",
438       "display_unittest.cc",
439       "font_fallback_mac_unittest.cc",
440       "font_list_unittest.cc",
441       "geometry/box_unittest.cc",
442       "geometry/cubic_bezier_unittest.cc",
443       "geometry/insets_unittest.cc",
444       "geometry/matrix3_unittest.cc",
445       "geometry/point3_unittest.cc",
446       "geometry/point_unittest.cc",
447       "geometry/quad_unittest.cc",
448       "geometry/rect_unittest.cc",
449       "geometry/safe_integer_conversions_unittest.cc",
450       "geometry/scroll_offset_unittest.cc",
451       "geometry/size_unittest.cc",
452       "geometry/vector2d_unittest.cc",
453       "geometry/vector3d_unittest.cc",
454       "image/image_mac_unittest.mm",
455       "image/image_util_unittest.cc",
456       "mac/coordinate_conversion_unittest.mm",
457       "nine_image_painter_unittest.cc",
458       "platform_font_mac_unittest.mm",
459       "range/range_mac_unittest.mm",
460       "range/range_unittest.cc",
461       "range/range_win_unittest.cc",
462       "render_text_unittest.cc",
463       "sequential_id_generator_unittest.cc",
464       "shadow_value_unittest.cc",
465       "skbitmap_operations_unittest.cc",
466       "skrect_conversion_unittest.cc",
467       "transform_util_unittest.cc",
468       "utf16_indexing_unittest.cc",
469     ]
470   }
472   # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
473   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
475   deps = [
476     ":gfx",
477     ":test_support",
478     "//base",
479     "//base/test:test_support",
480     "//skia",
481     "//third_party/icu:icuuc",
482     "//third_party/libpng",
483     "//third_party/zlib",
484     "//testing/gtest",
485     "//ui/base",
486     "//ui/gfx/geometry",
487     "//ui/resources:ui_test_pak",
488   ]
490   if (!is_mac && !is_ios) {
491     sources += [
492       "interpolated_transform_unittest.cc",
493       "transform_unittest.cc",
494     ]
495   }
497   if (is_android) {
498     sources -= [
499       # Do not run display_change_notifier_unittest.cc on Android because it
500       # does not compile display_observer.cc
501       "display_change_notifier_unittest.cc",
502     ]
503   }
505   if (is_android || is_ios) {
506     sources -= [ "render_text_unittest.cc" ]
507   }
509   if (use_aura) {
510     sources -= [ "screen_unittest.cc" ]
511   } else {
512     sources -= [ "nine_image_painter_unittest.cc" ]
513   }
515   if (is_chromeos) {
516     sources += [ "chromeos/codec/jpeg_codec_robust_slow_unittest.cc" ]
517   }
519   if (is_win) {
520     sources += [
521       "color_profile_win_unittest.cc",
522       "font_fallback_win_unittest.cc",
523       "icon_util_unittest.cc",
524       "icon_util_unittests.rc",
525       "path_win_unittest.cc",
526       "platform_font_win_unittest.cc",
527     ]
529     ldflags = [
530       "/DELAYLOAD:d2d1.dll",
531       "/DELAYLOAD:d3d10_1.dll",
532     ]
534     libs = [
535       "d2d1.lib",
536       "d3d10_1.lib",
537       "imm32.lib",
538       "oleacc.lib",
539     ]
540   }
543 if (is_android) {
544   generate_jni("gfx_jni_headers") {
545     sources = [
546       "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
547       "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
548       "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
549     ]
550     jni_package = "gfx"
551   }