当前位置: 首页 > news >正文

屏幕分辨率|尺寸|颜色深度指纹

一、前端通过window.screen接口获取屏幕分辨率 尺寸 颜色深度,横屏竖屏信息。 

二、window.screen c++接口实现:

1、third_party\blink\renderer\core\frame\screen.idl

// https://drafts.csswg.org/cssom-view/#the-screen-interface[Exposed=Window
] interface Screen : EventTarget {[HighEntropy=Direct, Measure] readonly attribute long availWidth;[HighEntropy=Direct, Measure] readonly attribute long availHeight;[HighEntropy=Direct, Measure] readonly attribute long width;[HighEntropy=Direct, Measure] readonly attribute long height;[HighEntropy=Direct, Measure] readonly attribute unsigned long colorDepth;// pixelDepth() is an alias for colorDepth(), no need to instrument it twice.[HighEntropy, Measure] readonly attribute unsigned long pixelDepth;// Non-standard[HighEntropy=Direct, Measure] readonly attribute long availLeft;[HighEntropy=Direct, Measure] readonly attribute long availTop;// Fired when the window’s screen or that screen's attributes change.// https://w3c.github.io/window-placement/[SecureContext, HighEntropy, MeasureAs=WindowScreenChange] attribute EventHandler onchange;// Whether the device’s visual output extends over multiple screens.// https://w3c.github.io/window-placement/[SecureContext, HighEntropy=Direct, MeasureAs=WindowScreenIsExtended] readonly attribute boolean isExtended;
};

2、接口实现c++

third_party\blink\renderer\core\frame\screen.h

third_party\blink\renderer\core\frame\screen.cc

namespace display {
struct ScreenInfo;
}namespace blink {class LocalDOMWindow;class CORE_EXPORT Screen : public EventTarget,public ExecutionContextClient,public Supplementable<Screen> {DEFINE_WRAPPERTYPEINFO();public:Screen(LocalDOMWindow*, int64_t display_id);static bool AreWebExposedScreenPropertiesEqual(const display::ScreenInfo& prev,const display::ScreenInfo& current);int height() const;int width() const;unsigned colorDepth() const;unsigned pixelDepth() const;int availLeft() const;int availTop() const;int availHeight() const;int availWidth() const;void Trace(Visitor*) const override;// EventTarget:const WTF::AtomicString& InterfaceName() const override;ExecutionContext* GetExecutionContext() const override;// Whether the device’s visual output extends over multiple screens.// https://w3c.github.io/window-placement/bool isExtended() const;// Fired when the window’s screen or that screen's attributes change.// https://w3c.github.io/window-placement/DEFINE_ATTRIBUTE_EVENT_LISTENER(change, kChange)// Not web-exposed; for internal usage only.static constexpr int64_t kInvalidDisplayId = -1;int64_t DisplayId() const { return display_id_; }void UpdateDisplayId(int64_t display_id) { display_id_ = display_id; }protected:// Helpers to access screen information.gfx::Rect GetRect(bool available) const;const display::ScreenInfo& GetScreenInfo() const;// The internal id of the underlying display, to support multi-screen devices.int64_t display_id_;
};}  // namespace blink

三、总结:

修改屏幕信息指纹只需要在screen.cc文件种修改即可。


http://www.mrgr.cn/news/78552.html

相关文章:

  • apex安装
  • Win32汇编学习笔记06.APIHook
  • 137. 只出现一次的数字 II
  • 使用Clion在ubuntu上进行交叉编译,并在Linux上远程编译五子棋
  • 探索 Vue.js 的动态样式与交互:一个有趣的样式调整应用
  • 《计算机网络A》单选题(详解)
  • Git(一)基本使用
  • 【计网笔记】网络层
  • 分布式系统积累与笔记
  • 【Db First】.NET开源 ORM 框架 SqlSugar 系列
  • Linux操作系统2-进程控制3(进程替换,exec相关函数和系统调用)
  • 一些面试问题的深入与思考
  • JAVA篇07 —— 异常
  • 68000汇编实战01-编程基础
  • Zariski交换代数经典教材Commutative Algebra系列(pdf可复制版)
  • Java进阶七-网络编程,反射
  • ElasticSearch7.x入门教程之全文搜索(五)
  • QT知识整理
  • 快速理解微服务中Ribbon的概念
  • C7.【C++ Cont】范围for的使用和auto关键字
  • 深度学习基础3
  • Android Studio安装TalkX AI编程助手
  • 性能监控系统Prometheus、Node-exporter与Grafana部署详解搭建
  • 网络原理(一)—— http
  • 虚拟机ubuntu-20.04.6-live-server搭建OpenStack:Victoria(三:安装服务-controller node)
  • OceanBase 大数据量导入(obloader)