Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsIContentView

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

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
28
Introduced
Gecko 2.0
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Mobile Only in Gecko 2.0
Available only in Firefox Mobile as of 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

Attribute Type Description
contentHeight float Read only.
contentWidth float Dimensions of scrolled content in chrome-document CSS pixels. Read only.
id nsContentViewId ID 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.
scrollX float

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.
scrollY float

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

viewportHeight float Height of the viewport in chrome-document CSS pixels. Read only.
viewportWidth float Width 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

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : Sheppy
 Dernière mise à jour par : Sheppy,