ImageVerifierCode 换一换
格式:DOCX , 页数:27 ,大小:37KB ,
资源ID:6593802      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6593802.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(WebKit PlugIn Programming Topics.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

WebKit PlugIn Programming Topics.docx

1、WebKit PlugIn Programming TopicsWebKit Plug-In Programming TopicsCreating Plug-ins with the Netscape API创建插件的网景应用编程接口Netscape-style plug-ins are written using a cross-platform C API, and, provided that you are building in Mach-O form, can be developed and debugged with Xcode. These plug-ins are comp

2、atible with a wide range of web scape-style插件使用跨平台的接口,并提供,你是建筑在mach-o形式,可以开发和调试函数。这些插件兼容范围广泛的网页浏览器。The original Netscape plug-in architecture was integrated into Netscape 2.0 in 1996. Since then, the API has been adopted by most common web browsers, including Safari. It has built-in support for onsc

3、reen drawing, various types of event handling, and networking functions.原网景插件架构集成到Nets cape 21996。从此,原料药已经通过了最常见的网页浏览器,包括野生动物园。它具有内置的支持在屏幕上绘制,各种类型的事件处理,和网络功能。In addition to the core plug-in functionality, Apple has extended the capabilities of the Netscape-style plug-ins. Starting with the WebKit fr

4、amework bundled with Safari 1.3 (on Mac OS X version 10.3) or Safari 2.0 (on Mac OS X version 10.4), the Netscape-style plug-ins can also perform scripting functions.除了核心的插件功能,苹果已经扩展能力的netscape-style插件。从Web Kit框架捆绑的Sa fari 1.3(苹果公司的操作系统版本10.3)或2(苹果公司的操作系统版本10.4),该netscape-style插件也可以执行脚本功能。The Netsca

5、pe-style plug-in scripting environment allows plug-ins to access scripting languages such as JavaScript (including accessing script elements such as a web pages Document Object Model). It also allows scripting languages to access and control elements of the plug-scape-style插件的脚本环境允许插件访问等脚本语言脚本(包括访问脚

6、本元素作为一个网页的文档对象模型)。它还允许脚本访问和控制元件的插件。In Mac OS X v10.5 and earlier, Netscape-style plug-ins can be compiled in Mac OS X into either the Mach-O or PEF (CFM) binary format (although CFM is PowerPC-only). Beginning in Mac OS X v10.6, Netscape-style plug-ins should be updated to use a 64-bit binary to wor

7、k with 64-bit instances of Safari or other WebKit clients. To do this, they must be built as 32/64-bit multi-architecture binaries using the Mach-O file format.在操作系统v10.5初期,netscape-style插件可以被编译的操作系统或者mach-o或呼气(立方英尺)的二进制格式(虽然是powerpc-only立方英尺)。开始在苹果操作系统,netscape-style插件应该更新使用64位二进制位的情况下与狩猎或其他Web Kit

8、客户。为此,他们必须建立32/64位多建筑使用mach-o二进制文件格式。Though the API supports both formats, Mac OS X natively supports the Mach-O style, and you will find that your plug-in will run much faster if compiled as a Mach-O binary. In the future, WebKit will continue to support Netscape plug-ins built with the Mach-O form

9、at; no such assurance can be given for plug-ins compiled in the PEF (CFM) format. You can also develop and debug Mach-O plug-ins in Xcode, but not PEF plug-ins. Once compiled, the plug-ins can be installed and used in most web browsers.虽然接口支持的格式,操作系统本身支持的mach-o风格,你会发现,你的插件将运行得更快,如果作为一个mach-o二进制。在未来,

10、它将继续支持网景插件建立的mach-o格式;没有这种保证可以得到插件编译在呼气(立方英尺)格式。你也可以开发和调试mach-o插件在外,而不是呼气插件。一旦编译,插件可以安装和使用在大多数网页浏览器。Using Plug-in Scripting使用脚本插件The scripting capabilities of Netscape-style plug-ins are provided by extensions onto the original plug-in specification. They allow a browser (through JavaScript) to acce

11、ss and control elements of the plug-in and its content, and allow the plug-in to access the enclosing web page and its content through the plug-in script interface.脚本的能力,netscape-style插件是由扩展到原来的插件规范。他们让一个浏览器(通过代码)来访问和控制元件的插件和其内容,并允许插件访问封闭的网页和内容通过插件脚本接口。When a plug-in is loaded, the browser calls the

12、 NPP_GetValue callback in your plug-in, which returns a retained NPObject structure that represent your plug-in. This NPObject structure contains an pointer to an NPClass structure. The NPClass structure contains a series of callbacks that define the interface between the plug-in and the scripting e

13、nvironment. The NPObject instance represents an instance of that plug-in that can then be used by the scripting environment.当一个插件加载,浏览器调用回调的npp_getvalue在你的插件,它返回一个保留npobject结构,代表你的插件。这npobject结构包含一个指向npclass结构。该npclass结构包含一系列的回调定义之间的接口插件和脚本环境。该npobject实例是一个实例,插件,然后可以使用脚本环境。If you want your plug-in t

14、o be scriptable, you need to return the appropriate retained NPObject by reference in your NPP_GetValue callback function.如果你希望你的插件支持脚本,你需要返回适当的保留npobject参照你的npp_getvalue回调函数。Note: In current versions of WebKit and all non-WebKit-based browsers, you must retain the NPObject instance upon return by d

15、oing the following:注意:在当前版本的Web kit和所有non-webkit-based浏览器,你必须保持npobject实例返回后做以下:browser-retainobject(NPObject*)obj);浏览器-retainobject(npobject*)对象);In versions of WebKit prior to version 420 (Safari 3 and earlier), the objects returned are retained by the browser. To avoid memory leaks in older brows

16、ers, you should check the WebKit version and avoid retaining returned objects when your plug-in is loaded by prior versions of WebKit.在420版本之前的版本Web Kit(Sa fari 3和更早),返回的对象保留的浏览器。避免内存泄漏在旧的浏览器,你应该检查它的版本和避免保留返回的对象时,你的插件加载事先版本Web Kit。A good demonstration of accessing plug-ins from JavaScript, as well a

17、s all the other concepts in creating a Netscape plug-in, can be found in the Examples folder of the WebKit source code. See http:/www.webkit.org/ to learn how to download the WebKit source code.一个很好的演示访问插件的脚本,以及所有其他概念,创造一个网景插件,可以发现在文件夹的Web kit的源代码例子。看到http:/www.webkit.org/学习如何下载Web kit的源代码。Core Grap

18、hics and Core Animation Drawing Models核心图形和动画绘图核心模型Safari 4.0 provides two new drawing models: Core Graphics (Quartz 2D) and Core Animation (only in Mac OS X v10.5 and later). These drawing modes are strongly recommended going forwards, and if you move your plug-in to contain a 64-bit slice, that sl

19、ice must use these drawing models. (See “Transitioning a Netscape-Style Plug-in to 64-bit” for more information.)4提供新的绘图模式:核心图形(石英平面)和核心动画(只在操作系统v10.5后)。这些绘图模式是强烈建议将前锋,如果你把你的插件包含一个64位切片,切片必须使用这些模型。(参见“过渡netscape-style插件64位”的更多信息。)Most of the effort in using these drawing models comes from learning C

20、ore Graphics and Core Animation themselves. To learn about Core Graphics, read Quartz 2D Programming Guide. To learn about Core Animation, read Core Animation Programming Guide.大部分的努力在使用这些图模型来自学习核心图形和动画本身的核心。了解核心图形,阅读石英二维编程指南。了解核心动画,看动画核心编程指南。Once you understand how to draw things using Core Graphic

21、s or Core Animation, you can enable these drawing models in your NPP_New function as follows:一旦你了解如何借鉴的东西,使用核心图形或动画核心,你可以使这些模型在npp_new功能如下:Add support in your code for the Cocoa event model. Core Graphics and Core Animation are not supported when using the Carbon event model.添加支持你的代码的可可事件模型。核心图形和动画核

22、心不支持使用碳事件模型。Check to see if the host browser supports the drawing model with the following code:请检查主机的浏览器支持模型与下面的代码:NPBool supportsCG = false;npboolsupportscg=假;NPError error = browser-getvalue(instance,nperror误差=-Value(实例, NPNVsupportsCoreGraphicsBool,npnvsupportscoregraphicsbool, &supportsCG);与sup

23、portscg);Note: If you cannot find a drawing model that both the application and your plug-in supports, your plug-in should return NPERR_INCOMPATIBLE_VERSION_ERROR.注意:如果你不能找到一个模型,应用程序和插件支持,你应该返回nperr_incompatible_version_error插件。Set the browser drawing model with the following code:设置浏览器图形模型以下代码:if (

24、err = NPERR_NO_ERROR & supportsCG) 如果(错误=nperr_no_error& &supportscg) error = browser-setvalue(instance,误差=-的值(例如, NPNVpluginDrawingModel,npnvplugindrawingmodel, (void *)NPDrawingModelCoreGraphics);(无效*)npdrawingmodelcoregraphics); if (err = NPERR_NO_ERROR & supportsCG) 如果(错误=nperr_no_error& &suppor

25、tscg) /* Set state flags as needed to/*设置所需的国旗 tell your own code to use Core Graphics告诉你自己的代码使用核心图形 drawing in the future. */在未来。* / After you have done these two things, the browser fills the window field of the NPWindow structure with an NP_CGContext structure. This structure contains two fields,

26、 context and window, which are defined as follows:当你做到这两点,浏览器填充窗口领域的npwindow结构与np_cgcontext结构。这个结构包含2个领域,背景和窗口,其定义如下:typedef struct NP_CGContextnp_cgcontext树 CGContextRef context;cgcontextref背景; WindowRef window;windowref窗口; NP_CGContext;np_cgcontext;The context value is a Core Graphics drawing cont

27、ext suitable for Quartz 2D drawing. For more information on how to use this context, read Quartz 2D Programming Guide. The window is a reference to an NSWindow object.背景值是一个核心图形绘制背景适合石英二维绘图。更多信息关于如何使用这方面,读石英二维编程指南。窗口是参考一个nswindow对象。To obtain the bounds for your plug-ins drawing region, do the follow

28、ing in your NPP_SetWindow callback:获得跨越你的插件的绘图区域,做以下的npp_setwindow回调:NPError setwindow_cb(NPP instance, NPWindow* npw) nperrorsetwindow_cb(核电站的实例,npwindow*负压波) . NP_CGContext *npcontext = npw.window;np_cgcontext*npcontext=npw.window; CGContextRef context = npcontext.context;cgcontextref背景=npcontext.

29、context; CGRect boundingBox = CGContextGetClipBoundingBox(context);cgrectboundingbox=cgcontextgetclipboundingbox(背景); .The Core Animation model is similar, but reversed. If you set you set NPNVpluginDrawingModel to NPDrawingModelCoreAnimation, your NPN_GetValue callback must provide a retained Core

30、Animation layer to the browser when it queries the NPPVpluginCoreAnimationLayer variable.核心动画模型类似,但扭转。如果你设置你npnvplugindrawingmodel到npdrawingmodelcoreanimationnpn_getvalue回调,你必须提供一个保留核心动画层的浏览器时,它查询nppvplugincoreanimationlayer变量。As with the Core graphics model, you can find out if the browser supports

31、 the Core Animation drawing model by checking the value of the NPNVsupportsCoreAnimationBool variable. For example:与核心图形模型,你可以找到浏览器是否支持核心动画绘制模型通过检查价值的npnvsupportscoreanimationbool变量。比如说呢。NPBool supportsCA = false;npboolsupportsca=假;NPError error = browser-getvalue(instance,nperror误差=-Value(实例, NPNVs

32、upportsCoreAnimationBool,npnvsupportscoreanimationbool, &supportsCA);与supportsca);Out-of-Process Plug-Ins进程外插件Beginning in Mac OS X v10.6, on 64-bit-capable computers, Netscape-style plug-ins execute in an out-of-process fashion. This means that each Netscape-style plug-in gets its own process separate from the applicati

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1