michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsFrameLoader; michael@0: interface nsIDocShell; michael@0: interface nsIURI; michael@0: interface nsIFrame; michael@0: interface nsSubDocumentFrame; michael@0: interface nsIMessageSender; michael@0: interface nsIVariant; michael@0: interface nsIDOMElement; michael@0: interface nsITabParent; michael@0: interface nsILoadContext; michael@0: michael@0: typedef unsigned long long nsContentViewId; michael@0: michael@0: /** michael@0: * These interfaces do *not* scroll or scale the content document; michael@0: * instead they set a "goal" scroll/scale wrt the current content michael@0: * view. When the content document is painted, the scroll* michael@0: * attributes are used to set a compensating transform. If the michael@0: * metrics of the content document's current pixels don't match the michael@0: * view config, the transform matrix may need to translate michael@0: * content pixels and/or perform a "fuzzy-scale" that doesn't michael@0: * re-rasterize fonts or intelligently resample images. michael@0: * michael@0: * The attrs are allowed to transform content pixels in michael@0: * such a way that the 's visible rect encloses pixels that michael@0: * the content document does not (yet) define. michael@0: * michael@0: * The view scroll values are in units of chrome-document CSS michael@0: * pixels. michael@0: * michael@0: * These APIs are designed to be used with nsIDOMWindowUtils michael@0: * setDisplayPort() and setResolution(). michael@0: */ michael@0: [scriptable, uuid(c04c5c40-fa2a-4e9c-94f5-b362a10a86cb)] michael@0: interface nsIContentView : nsISupports michael@0: { michael@0: /** michael@0: * Scroll view to or by the given chrome-document CSS pixels. michael@0: * Fails if the view is no longer valid. michael@0: */ michael@0: void scrollTo(in float xPx, in float yPx); michael@0: void scrollBy(in float dxPx, in float dyPx); michael@0: michael@0: void setScale(in float xScale, in float yScale); michael@0: michael@0: /** michael@0: * Scroll offset in chrome-document CSS pixels. michael@0: * michael@0: * When this view is active (i.e. it is being painted because it's in the michael@0: * visible region of the screen), this value is at first lined up with the michael@0: * content's scroll offset. michael@0: * michael@0: * Note that when this view becomes inactive, the new content view will have michael@0: * scroll values that are reset to the default! michael@0: */ michael@0: readonly attribute float scrollX; michael@0: readonly attribute float scrollY; michael@0: michael@0: /** michael@0: * Dimensions of the viewport in chrome-document CSS pixels. michael@0: */ michael@0: readonly attribute float viewportWidth; michael@0: readonly attribute float viewportHeight; michael@0: michael@0: /** michael@0: * Dimensions of scrolled content in chrome-document CSS pixels. michael@0: */ michael@0: readonly attribute float contentWidth; michael@0: readonly attribute float contentHeight; michael@0: michael@0: /** michael@0: * ID that can be used in conjunction with nsIDOMWindowUtils to change michael@0: * the actual document, instead of just how it is transformed. michael@0: */ michael@0: readonly attribute nsContentViewId id; michael@0: }; michael@0: michael@0: [scriptable, uuid(ba5af90d-ece5-40b2-9a1d-a0154128db1c)] michael@0: interface nsIContentViewManager : nsISupports michael@0: { michael@0: /** michael@0: * Retrieve view scrolling/scaling interfaces in a given area, michael@0: * used to support asynchronous re-paints of content pixels. michael@0: * These interfaces are only meaningful for . michael@0: * michael@0: * Pixels are in chrome device pixels and are relative to the browser michael@0: * element. michael@0: * michael@0: * @param aX x coordinate that will be in target rectangle michael@0: * @param aY y coordinate that will be in target rectangle michael@0: * @param aTopSize How much to expand up the rectangle michael@0: * @param aRightSize How much to expand right the rectangle michael@0: * @param aBottomSize How much to expand down the rectangle michael@0: * @param aLeftSize How much to expand left the rectangle michael@0: */ michael@0: void getContentViewsIn(in float aXPx, in float aYPx, michael@0: in float aTopSize, in float aRightSize, michael@0: in float aBottomSize, in float aLeftSize, michael@0: [optional] out unsigned long aLength, michael@0: [retval, array, size_is(aLength)] out nsIContentView aResult); michael@0: michael@0: /** michael@0: * The root content view. michael@0: */ michael@0: readonly attribute nsIContentView rootContentView; michael@0: }; michael@0: michael@0: [scriptable, builtinclass, uuid(a5cefcc8-551b-4901-83f3-7436b09ecaba)] michael@0: interface nsIFrameLoader : nsISupports michael@0: { michael@0: /** michael@0: * Get the docshell from the frame loader. michael@0: */ michael@0: readonly attribute nsIDocShell docShell; michael@0: michael@0: /** michael@0: * Get this frame loader's TabParent, if it has a remote frame. Otherwise, michael@0: * returns null. michael@0: */ michael@0: readonly attribute nsITabParent tabParent; michael@0: michael@0: /** michael@0: * Get an nsILoadContext for the top-level docshell. For remote michael@0: * frames, a shim is returned that contains private browsing and app michael@0: * information. michael@0: */ michael@0: readonly attribute nsILoadContext loadContext; michael@0: michael@0: /** michael@0: * Start loading the frame. This method figures out what to load michael@0: * from the owner content in the frame loader. michael@0: */ michael@0: void loadFrame(); michael@0: michael@0: /** michael@0: * Loads the specified URI in this frame. Behaves identically to loadFrame, michael@0: * except that this method allows specifying the URI to load. michael@0: */ michael@0: void loadURI(in nsIURI aURI); michael@0: michael@0: /** michael@0: * Destroy the frame loader and everything inside it. This will michael@0: * clear the weak owner content reference. michael@0: */ michael@0: void destroy(); michael@0: michael@0: /** michael@0: * Find out whether the loader's frame is at too great a depth in michael@0: * the frame tree. This can be used to decide what operations may michael@0: * or may not be allowed on the loader's docshell. michael@0: */ michael@0: readonly attribute boolean depthTooGreat; michael@0: michael@0: /** michael@0: * Updates the position and size of the subdocument loaded by this frameloader. michael@0: * michael@0: * @param aIFrame The nsIFrame for the content node that owns this frameloader michael@0: */ michael@0: [noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame); michael@0: michael@0: /** michael@0: * Activate remote frame. michael@0: * Throws an exception with non-remote frames. michael@0: */ michael@0: void activateRemoteFrame(); michael@0: michael@0: /** michael@0: * Deactivate remote frame. michael@0: * Throws an exception with non-remote frames. michael@0: */ michael@0: void deactivateRemoteFrame(); michael@0: michael@0: /** michael@0: * @see nsIDOMWindowUtils sendMouseEvent. michael@0: */ michael@0: void sendCrossProcessMouseEvent(in AString aType, michael@0: in float aX, michael@0: in float aY, michael@0: in long aButton, michael@0: in long aClickCount, michael@0: in long aModifiers, michael@0: [optional] in boolean aIgnoreRootScrollFrame); michael@0: michael@0: /** michael@0: * Activate event forwarding from client (remote frame) to parent. michael@0: */ michael@0: void activateFrameEvent(in AString aType, in boolean capture); michael@0: michael@0: // Note, when frameloaders are swapped, also messageManagers are swapped. michael@0: readonly attribute nsIMessageSender messageManager; michael@0: michael@0: /** michael@0: * @see nsIDOMWindowUtils sendKeyEvent. michael@0: */ michael@0: void sendCrossProcessKeyEvent(in AString aType, michael@0: in long aKeyCode, michael@0: in long aCharCode, michael@0: in long aModifiers, michael@0: [optional] in boolean aPreventDefault); michael@0: michael@0: /** michael@0: * The default rendering mode is synchronous scrolling. In this michael@0: * mode, it's an error to try to set a target viewport. michael@0: */ michael@0: const unsigned long RENDER_MODE_DEFAULT = 0x00000000; michael@0: michael@0: /** michael@0: * When asynchronous scrolling is enabled, a target viewport can be michael@0: * set to transform content pixels wrt its CSS viewport. michael@0: * michael@0: * NB: when async scrolling is enabled, it's the *user's* michael@0: * responsibility to update the target scroll offset. In effect, michael@0: * the platform hands over control of scroll offset to the user. michael@0: */ michael@0: const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001; michael@0: michael@0: attribute unsigned long renderMode; michael@0: michael@0: /** michael@0: * The default event mode automatically forwards the events michael@0: * handled in EventStateManager::HandleCrossProcessEvent to michael@0: * the child content process when these events are targeted to michael@0: * the remote browser element. michael@0: * michael@0: * Used primarly for input events (mouse, keyboard) michael@0: */ michael@0: const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000; michael@0: michael@0: /** michael@0: * With this event mode, it's the application's responsability to michael@0: * convert and forward events to the content process michael@0: */ michael@0: const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001; michael@0: michael@0: attribute unsigned long eventMode; michael@0: michael@0: /** michael@0: * If false, then the subdocument is not clipped to its CSS viewport, and the michael@0: * subdocument's viewport scrollbar(s) are not rendered. michael@0: * Defaults to true. michael@0: */ michael@0: attribute boolean clipSubdocument; michael@0: michael@0: /** michael@0: * If false, then the subdocument's scroll coordinates will not be clamped michael@0: * to their scroll boundaries. michael@0: * Defaults to true. michael@0: */ michael@0: attribute boolean clampScrollPosition; michael@0: michael@0: /** michael@0: * The element which owns this frame loader. michael@0: * michael@0: * For example, if this is a frame loader for an