2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// Copyright (c) 2019 GitHub, Inc.
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// Use of this source code is governed by the MIT license that can be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								// found in the LICENSE file.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_converters/gfx_converter.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "shell/common/gin_helper/dictionary.h"
							 | 
						
					
						
							
								
									
										
										
										
											2016-08-26 15:30:02 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/display/display.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "ui/display/screen.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-10 15:35:53 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/gfx/geometry/point.h"
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/gfx/geometry/point_f.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-10 15:35:53 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/gfx/geometry/rect.h"
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-01 22:37:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/gfx/geometry/resize_utils.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-10 15:35:53 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "ui/gfx/geometry/size.h"
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace gin {
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<gfx::Point>::ToV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                 const gfx::Point& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-27 15:23:23 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.SetHidden("simple", true);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("x", val.x());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("y", val.y());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return dict.GetHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool Converter<gfx::Point>::FromV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                   v8::Local<v8::Value> val,
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                   gfx::Point* out) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Dictionary dict(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!gin::ConvertFromV8(isolate, val, &dict))
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 23:28:56 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  double x, y;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!dict.Get("x", &x) || !dict.Get("y", &y))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 23:28:56 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  *out = gfx::Point(static_cast<int>(std::round(x)),
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                    static_cast<int>(std::round(y)));
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-29 18:01:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<gfx::PointF>::ToV8(v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                  const gfx::PointF& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-29 18:01:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.SetHidden("simple", true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("x", val.x());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("y", val.y());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return dict.GetHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool Converter<gfx::PointF>::FromV8(v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    v8::Local<v8::Value> val,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                    gfx::PointF* out) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Dictionary dict(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!gin::ConvertFromV8(isolate, val, &dict))
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-29 18:01:31 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  float x, y;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!dict.Get("x", &x) || !dict.Get("y", &y))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *out = gfx::PointF(x, y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<gfx::Size>::ToV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 19:19:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                const gfx::Size& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-27 15:23:23 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.SetHidden("simple", true);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("width", val.width());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("height", val.height());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return dict.GetHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool Converter<gfx::Size>::FromV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                  v8::Local<v8::Value> val,
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  gfx::Size* out) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Dictionary dict(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!gin::ConvertFromV8(isolate, val, &dict))
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int width, height;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!dict.Get("width", &width) || !dict.Get("height", &height))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *out = gfx::Size(width, height);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<gfx::Rect>::ToV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                const gfx::Rect& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-27 15:23:23 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.SetHidden("simple", true);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("x", val.x());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("y", val.y());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("width", val.width());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("height", val.height());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return dict.GetHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								bool Converter<gfx::Rect>::FromV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                  v8::Local<v8::Value> val,
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  gfx::Rect* out) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-09 00:10:18 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin::Dictionary dict(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (!gin::ConvertFromV8(isolate, val, &dict))
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  int x, y, width, height;
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!dict.Get("x", &x) || !dict.Get("y", &y) || !dict.Get("width", &width) ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      !dict.Get("height", &height))
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  *out = gfx::Rect(x, y, width, height);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-12 07:34:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								template <>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								struct Converter<display::Display::AccelerometerSupport> {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  static v8::Local<v8::Value> ToV8(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      const display::Display::AccelerometerSupport& val) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    switch (val) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      case display::Display::AccelerometerSupport::AVAILABLE:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "available");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      case display::Display::AccelerometerSupport::UNAVAILABLE:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "unavailable");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "unknown");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								template <>
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 15:08:55 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct Converter<display::Display::TouchSupport> {
							 | 
						
					
						
							
								
									
										
										
										
											2015-05-22 19:11:22 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                   const display::Display::TouchSupport& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    switch (val) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-11 12:39:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      case display::Display::TouchSupport::AVAILABLE:
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "available");
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-11 12:39:03 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      case display::Display::TouchSupport::UNAVAILABLE:
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "unavailable");
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 16:37:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return StringToV8(isolate, "unknown");
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-07-04 19:19:20 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<display::Display>::ToV8(
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-17 21:55:30 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const display::Display& val) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  gin_helper::Dictionary dict = gin::Dictionary::CreateEmpty(isolate);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.SetHidden("simple", true);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("id", val.id());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("bounds", val.bounds());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("workArea", val.work_area());
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-12 07:34:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("accelerometerSupport", val.accelerometer_support());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("monochrome", val.is_monochrome());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("colorDepth", val.color_depth());
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-03 13:35:05 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("colorSpace", val.color_spaces().GetRasterColorSpace().ToString());
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-12 07:34:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("depthPerComponent", val.depth_per_component());
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("size", val.size());
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-16 15:33:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("displayFrequency", val.display_frequency());
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("workAreaSize", val.work_area_size());
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  dict.Set("scaleFactor", val.device_scale_factor());
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("rotation", val.RotationAsDegree());
							 | 
						
					
						
							
								
									
										
										
										
											2019-02-12 07:34:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("internal", val.IsInternal());
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:51:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  dict.Set("touchSupport", val.touch_support());
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-14 14:38:51 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return dict.GetHandle();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-01 22:37:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								v8::Local<v8::Value> Converter<gfx::ResizeEdge>::ToV8(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    v8::Isolate* isolate,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const gfx::ResizeEdge& val) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  switch (val) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kRight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "right");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kBottom:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "bottom");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kTop:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "top");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kLeft:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "left");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kTopLeft:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "top-left");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kTopRight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "top-right");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kBottomLeft:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "bottom-left");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    case gfx::ResizeEdge::kBottomRight:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "bottom-right");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    default:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return StringToV8(isolate, "unknown");
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-10-18 09:31:29 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}  // namespace gin
							 |