nsIContentView 编辑

content/base/public/nsIFrameLoader.idlScriptable Represents a scrollable content view whose contents are actually drawn by a separate process; this is part of the Electrolysis multi-process support framework. 1.0 66 Introduced Gecko 2.0 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

See Working with content views for details on how to use this API.

Note: Currently, only <frame> and <iframe> elements are handled as content views. Support for using this API for all scrollable elements is coming; see bug 618975 for details.

Method overview

void scrollBy(in float dxPx, in float dyPx);
void scrollTo(in float xPx, in float yPx);
void setScale(in float xScale, in float yScale);

Attributes

AttributeTypeDescription
contentHeightfloatRead only.
contentWidthfloatDimensions of scrolled content in chrome-document CSS pixels. Read only.
idnsContentViewIdID that can be used in conjunction with nsIDOMWindowUtils to change the actual document, instead of just how it is transformed; this is a 64-bit unsigned integer. Read only.
scrollXfloat

Horizontal scroll offset in chrome-document CSS pixels.

When this view is active (that is it is being painted because it's in the visible region of the screen), this value is at first lined up with the content's scroll offset.

Note: When this view becomes inactive, the new content view will have scroll values that are reset to the default. Read only.
scrollYfloat

Horizontal scroll offset in chrome-document CSS pixels. Read only.

viewportHeightfloatHeight of the viewport in chrome-document CSS pixels. Read only.
viewportWidthfloatWidth of the viewport in chrome-document CSS pixels. Read only.

Methods

scrollBy()

Scrolls the content view by the specified number of chrome-document CSS pixels along each axis. Fails if the view isn't valid.

void scrollBy(
  in float dxPx,
  in float dyPx
);
Parameters
dxPx
The number of CSS pixels to scroll on the X axis; specify a positive value to scroll to the right or a negative value to scroll to the left.
dyPx
The number of CSS pixels to scroll on the Y axis; specify a positive value to scroll down or a negative value to scroll up.

scrollTo()

Scrolls the content view to the specified position, in chrome-document CSS pixels. Fails if the view isn't valid.

void scrollTo(
  in float xPx,
  in float yPx
);
Parameters
xPx
The X coordinate to scroll to, in CSS pixels.
yPx
The Y coordinate to scroll to, in CSS pixels.

setScale()

Sets the content view's scale for each axis.

void setScale(
  in float xScale,
  in float yScale
);
Parameters
xScale
Horizontal scaling factor; specify 1.0 to use the natural size of the content.
yScale
Vertical scaling factor; specify 1.0 to use the natural size of the content.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:44 次

字数:6830

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文