当前位置: 首页 > 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.lryc.cn/news/493772.html

相关文章:

  • docker-elasticsearch-kibana-logstash
  • C#设计模式——抽象工厂模式(重点)
  • 全新AI模型家族登场:完全可复现的开源语言模型OLMo 2
  • 用Matlab和SIMULINK实现DPCM仿真和双边带调幅系统仿真
  • RabbitMQ的交换机总结
  • Android so库的编译
  • 2024年底-Arch linux或转为0BSD许可证!
  • 深入解析音视频流媒体SIP协议交互过程
  • linux安装mysql8.0.40
  • Java基础之控制语句:开启编程逻辑之门
  • 如何还原 HTTP 请求日志中的 URL 编码参数?详解 %40 到 @
  • usb_cam ros包话题说明,image transport包使用
  • 微前端-MicroApp
  • Unity UGUI 垂直循环复用滚动
  • Spring MVC 深度剖析:优势与劣势全面解读
  • 力扣hot100-->前缀和/前缀书/LRU缓存
  • Three.js CSS2D/CSS3D渲染器
  • mongodb文档字符串批量替换
  • 前端安全和解决方案
  • Tlias智能辅助学习系统-部门管理
  • React第十节组件之间传值之context
  • flink中barrier不对齐的原因和影响
  • 软银集团孙正义再度加码OpenAI,近屿智能专注AI人才培养
  • 麒麟系统x86安装达梦数据库
  • Java中的“多态“详解
  • buuctf-[SUCTF 2019]EasySQL 1解题记录
  • ASP.NET Core 入门
  • php反序列化1_常见php序列化的CTF考题
  • 题目 1013: [编程入门]Sn的公式求和
  • 算法——赎金信(leetcode383)