Bug 417561, disable tagging of Talkback now we have prebuilt packages, r=rhelmer
[mozilla-1.9.git] / layout / generic / nsObjectFrame.h
blob998b0c50c76861d7176a608667cd2bde8a3e11cd
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 /* rendering objects for replaced elements implemented by a plugin */
40 #ifndef nsObjectFrame_h___
41 #define nsObjectFrame_h___
43 #ifdef XP_WIN
44 #include <windows.h>
45 #endif
47 #include "nsIObjectFrame.h"
48 #include "nsFrame.h"
50 #ifdef ACCESSIBILITY
51 class nsIAccessible;
52 #endif
54 class nsPluginInstanceOwner;
55 class nsIPluginHost;
56 class nsIPluginInstance;
57 class nsPresContext;
59 #define nsObjectFrameSuper nsFrame
61 class nsObjectFrame : public nsObjectFrameSuper, public nsIObjectFrame {
62 public:
63 friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
65 // nsISupports
66 NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
68 NS_IMETHOD Init(nsIContent* aContent,
69 nsIFrame* aParent,
70 nsIFrame* aPrevInFlow);
71 virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
72 virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
73 NS_IMETHOD Reflow(nsPresContext* aPresContext,
74 nsHTMLReflowMetrics& aDesiredSize,
75 const nsHTMLReflowState& aReflowState,
76 nsReflowStatus& aStatus);
77 NS_IMETHOD DidReflow(nsPresContext* aPresContext,
78 const nsHTMLReflowState* aReflowState,
79 nsDidReflowStatus aStatus);
80 NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
81 const nsRect& aDirtyRect,
82 const nsDisplayListSet& aLists);
84 void PrintPlugin(nsIRenderingContext& aRenderingContext,
85 const nsRect& aDirtyRect);
86 void PaintPlugin(nsIRenderingContext& aRenderingContext,
87 const nsRect& aDirtyRect);
89 NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
90 nsGUIEvent* aEvent,
91 nsEventStatus* aEventStatus);
93 virtual nsIAtom* GetType() const;
95 virtual PRBool IsFrameOfType(PRUint32 aFlags) const
97 return nsObjectFrameSuper::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
100 virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; }
101 virtual PRBool NeedsView() { return PR_TRUE; }
102 virtual nsresult CreateWidgetForView(nsIView* aView);
104 #ifdef DEBUG
105 NS_IMETHOD GetFrameName(nsAString& aResult) const;
106 #endif
108 virtual void Destroy();
110 NS_IMETHOD DidSetStyleContext();
112 NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
113 virtual nsresult Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener);
114 virtual nsresult Instantiate(const char* aMimeType, nsIURI* aURI);
115 virtual void TryNotifyContentObjectWrapper();
116 virtual void StopPlugin();
119 * Stop a plugin instance. If aDelayedStop is true, the plugin will
120 * be stopped at a later point when it's safe to do so (i.e. not
121 * while destroying the frame tree). Delayed stopping is only
122 * implemented on Win32 for now.
124 void StopPluginInternal(PRBool aDelayedStop);
126 /* fail on any requests to get a cursor from us because plugins set their own! see bug 118877 */
127 NS_IMETHOD GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor)
129 return NS_ERROR_NOT_IMPLEMENTED;
132 // accessibility support
133 #ifdef ACCESSIBILITY
134 NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
135 #ifdef XP_WIN
136 NS_IMETHOD GetPluginPort(HWND *aPort);
137 #endif
138 #endif
140 //local methods
141 nsresult CreateWidget(nscoord aWidth, nscoord aHeight, PRBool aViewOnly);
143 // for a given aRoot, this walks the frame tree looking for the next outFrame
144 static nsIObjectFrame* GetNextObjectFrame(nsPresContext* aPresContext,
145 nsIFrame* aRoot);
147 protected:
148 // nsISupports
149 NS_IMETHOD_(nsrefcnt) AddRef(void);
150 NS_IMETHOD_(nsrefcnt) Release(void);
152 nsObjectFrame(nsStyleContext* aContext);
153 virtual ~nsObjectFrame();
155 // NOTE: This frame class does not inherit from |nsLeafFrame|, so
156 // this is not a virtual method implementation.
157 void GetDesiredSize(nsPresContext* aPresContext,
158 const nsHTMLReflowState& aReflowState,
159 nsHTMLReflowMetrics& aDesiredSize);
161 nsresult InstantiatePlugin(nsIPluginHost* aPluginHost,
162 const char* aMimetype,
163 nsIURI* aURL);
166 * Adjust the plugin's idea of its size, using aSize as its new size.
167 * (aSize must be in twips)
169 void FixupWindow(const nsSize& aSize);
172 * Sets up the plugin window and calls SetWindow on the plugin.
174 void CallSetWindow();
176 PRBool IsFocusable(PRInt32 *aTabIndex = nsnull, PRBool aWithMouse = PR_FALSE);
178 // check attributes and optionally CSS to see if we should display anything
179 PRBool IsHidden(PRBool aCheckVisibilityStyle = PR_TRUE) const;
181 void NotifyContentObjectWrapper();
183 nsPoint GetWindowOriginInPixels(PRBool aWindowless);
186 * Makes sure that mInstanceOwner is valid and without a current plugin
187 * instance. Essentially, this prepares the frame to receive a new plugin.
189 NS_HIDDEN_(nsresult) PrepareInstanceOwner();
191 friend class nsPluginInstanceOwner;
192 private:
193 nsRefPtr<nsPluginInstanceOwner> mInstanceOwner;
194 nsRect mWindowlessRect;
196 // For assertions that make it easier to determine if a crash is due
197 // to the underlying problem described in bug 136927, and to prevent
198 // reentry into instantiation.
199 PRBool mInstantiating;
203 #endif /* nsObjectFrame_h___ */