OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef DOMWindow_h | 27 #ifndef LocalDOMWindow_h |
28 #define DOMWindow_h | 28 #define LocalDOMWindow_h |
29 | 29 |
30 #include "bindings/core/v8/Dictionary.h" | 30 #include "bindings/core/v8/Dictionary.h" |
31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
32 #include "core/frame/DOMWindowBase64.h" | 32 #include "core/frame/DOMWindowBase64.h" |
33 #include "core/frame/FrameDestructionObserver.h" | 33 #include "core/frame/FrameDestructionObserver.h" |
34 #include "platform/LifecycleContext.h" | 34 #include "platform/LifecycleContext.h" |
35 #include "platform/Supplementable.h" | 35 #include "platform/Supplementable.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "platform/scroll/ScrollableArea.h" | 37 #include "platform/scroll/ScrollableArea.h" |
38 | 38 |
39 #include "wtf/Forward.h" | 39 #include "wtf/Forward.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 class ApplicationCache; | 42 |
43 class BarProp; | 43 class ApplicationCache; |
44 class CSSRuleList; | 44 class BarProp; |
45 class CSSStyleDeclaration; | 45 class CSSRuleList; |
46 class Console; | 46 class CSSStyleDeclaration; |
47 class DOMSelection; | 47 class Console; |
48 class DOMURL; | 48 class DOMSelection; |
49 class DOMWindowProperty; | 49 class DOMURL; |
50 class Database; | 50 class DOMWindowCSS; |
51 class DatabaseCallback; | 51 class DOMWindowEventQueue; |
52 class Document; | 52 class DOMWindowLifecycleNotifier; |
53 class DocumentInit; | 53 class DOMWindowProperty; |
54 class DOMWindowEventQueue; | 54 class Database; |
55 class DOMWindowLifecycleNotifier; | 55 class DatabaseCallback; |
56 class Element; | 56 class Document; |
57 class EventListener; | 57 class DocumentInit; |
58 class EventQueue; | 58 class Element; |
59 class ExceptionState; | 59 class EventListener; |
60 class FloatRect; | 60 class EventQueue; |
61 class FrameConsole; | 61 class ExceptionState; |
62 class History; | 62 class FloatRect; |
63 class IDBFactory; | 63 class FrameConsole; |
64 class LocalFrame; | 64 class History; |
65 class Location; | 65 class IDBFactory; |
66 class MediaQueryList; | 66 class LocalFrame; |
67 class MessageEvent; | 67 class Location; |
68 class Navigator; | 68 class MediaQueryList; |
69 class Node; | 69 class MessageEvent; |
70 class Page; | 70 class Navigator; |
71 class Performance; | 71 class Node; |
72 class PostMessageTimer; | 72 class Page; |
73 class RequestAnimationFrameCallback; | 73 class Performance; |
74 class ScheduledAction; | 74 class PostMessageTimer; |
75 class Screen; | 75 class RequestAnimationFrameCallback; |
76 class ScriptCallStack; | 76 class ScheduledAction; |
77 class SecurityOrigin; | 77 class Screen; |
78 class SerializedScriptValue; | 78 class ScriptCallStack; |
79 class Storage; | 79 class SecurityOrigin; |
80 class StyleMedia; | 80 class SerializedScriptValue; |
81 class DOMWindowCSS; | 81 class Storage; |
82 | 82 class StyleMedia; |
83 struct WindowFeatures; | 83 |
84 | 84 struct WindowFeatures; |
85 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArra
y; | 85 |
| 86 typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray; |
86 | 87 |
87 enum PageshowEventPersistence { | 88 enum PageshowEventPersistence { |
88 PageshowEventNotPersisted = 0, | 89 PageshowEventNotPersisted = 0, |
89 PageshowEventPersisted = 1 | 90 PageshowEventPersisted = 1 |
90 }; | 91 }; |
91 | 92 |
92 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack
ForwardList }; | 93 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForw
ardList }; |
93 | 94 |
94 class LocalDOMWindow FINAL : public RefCountedWillBeGarbageCollectedFinalize
d<LocalDOMWindow>, public EventTargetWithInlineData, public DOMWindowBase64, pub
lic FrameDestructionObserver, public WillBeHeapSupplementable<LocalDOMWindow>, p
ublic LifecycleContext<LocalDOMWindow> { | 95 class LocalDOMWindow FINAL : public RefCountedWillBeGarbageCollectedFinalized<Lo
calDOMWindow>, public EventTargetWithInlineData, public DOMWindowBase64, public
FrameDestructionObserver, public WillBeHeapSupplementable<LocalDOMWindow>, publi
c LifecycleContext<LocalDOMWindow> { |
95 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); | 96 DEFINE_WRAPPERTYPEINFO(); |
96 REFCOUNTED_EVENT_TARGET(LocalDOMWindow); | 97 REFCOUNTED_EVENT_TARGET(LocalDOMWindow); |
97 public: | 98 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); |
98 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mim
eType, const DocumentInit&, bool forceXHTML); | 99 public: |
99 static PassRefPtrWillBeRawPtr<LocalDOMWindow> create(LocalFrame& frame) | 100 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mimeTyp
e, const DocumentInit&, bool forceXHTML); |
100 { | 101 static PassRefPtrWillBeRawPtr<LocalDOMWindow> create(LocalFrame& frame) |
101 return adoptRefWillBeNoop(new LocalDOMWindow(frame)); | 102 { |
102 } | 103 return adoptRefWillBeNoop(new LocalDOMWindow(frame)); |
103 virtual ~LocalDOMWindow(); | 104 } |
104 | 105 virtual ~LocalDOMWindow(); |
105 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeTy
pe, const DocumentInit&, bool forceXHTML = false); | 106 |
106 | 107 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeType,
const DocumentInit&, bool forceXHTML = false); |
107 virtual const AtomicString& interfaceName() const OVERRIDE; | 108 |
108 virtual ExecutionContext* executionContext() const OVERRIDE; | 109 virtual const AtomicString& interfaceName() const OVERRIDE; |
109 | 110 virtual ExecutionContext* executionContext() const OVERRIDE; |
110 virtual LocalDOMWindow* toDOMWindow() OVERRIDE; | 111 |
111 | 112 virtual LocalDOMWindow* toDOMWindow() OVERRIDE; |
112 void registerProperty(DOMWindowProperty*); | 113 |
113 void unregisterProperty(DOMWindowProperty*); | 114 void registerProperty(DOMWindowProperty*); |
114 | 115 void unregisterProperty(DOMWindowProperty*); |
115 void reset(); | 116 |
116 | 117 void reset(); |
117 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); | 118 |
118 | 119 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); |
119 unsigned pendingUnloadEventListeners() const; | 120 |
120 | 121 unsigned pendingUnloadEventListeners() const; |
121 static FloatRect adjustWindowRect(LocalFrame&, const FloatRect& pendingC
hanges); | 122 |
122 | 123 static FloatRect adjustWindowRect(LocalFrame&, const FloatRect& pendingChang
es); |
123 bool allowPopUp(); // Call on first window, not target window. | 124 |
124 static bool allowPopUp(LocalFrame& firstFrame); | 125 bool allowPopUp(); // Call on first window, not target window. |
125 static bool canShowModalDialogNow(const LocalFrame*); | 126 static bool allowPopUp(LocalFrame& firstFrame); |
126 | 127 static bool canShowModalDialogNow(const LocalFrame*); |
127 // DOM Level 0 | 128 |
128 | 129 // DOM Level 0 |
129 Screen& screen() const; | 130 |
130 History& history() const; | 131 Screen& screen() const; |
131 BarProp& locationbar() const; | 132 History& history() const; |
132 BarProp& menubar() const; | 133 BarProp& locationbar() const; |
133 BarProp& personalbar() const; | 134 BarProp& menubar() const; |
134 BarProp& scrollbars() const; | 135 BarProp& personalbar() const; |
135 BarProp& statusbar() const; | 136 BarProp& scrollbars() const; |
136 BarProp& toolbar() const; | 137 BarProp& statusbar() const; |
137 Navigator& navigator() const; | 138 BarProp& toolbar() const; |
138 Navigator& clientInformation() const { return navigator(); } | 139 Navigator& navigator() const; |
139 | 140 Navigator& clientInformation() const { return navigator(); } |
140 Location& location() const; | 141 |
141 void setLocation(const String& location, LocalDOMWindow* callingWindow,
LocalDOMWindow* enteredWindow, | 142 Location& location() const; |
142 SetLocationLocking = LockHistoryBasedOnGestureState); | 143 void setLocation(const String& location, LocalDOMWindow* callingWindow, Loca
lDOMWindow* enteredWindow, |
143 | 144 SetLocationLocking = LockHistoryBasedOnGestureState); |
144 DOMSelection* getSelection(); | 145 |
145 | 146 DOMSelection* getSelection(); |
146 Element* frameElement() const; | 147 |
147 | 148 Element* frameElement() const; |
148 void focus(ExecutionContext* = 0); | 149 |
149 void blur(); | 150 void focus(ExecutionContext* = 0); |
150 void close(ExecutionContext* = 0); | 151 void blur(); |
151 void print(); | 152 void close(ExecutionContext* = 0); |
152 void stop(); | 153 void print(); |
153 | 154 void stop(); |
154 PassRefPtrWillBeRawPtr<LocalDOMWindow> open(const String& urlString, con
st AtomicString& frameName, const String& windowFeaturesString, | 155 |
155 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow); | 156 PassRefPtrWillBeRawPtr<LocalDOMWindow> open(const String& urlString, const A
tomicString& frameName, const String& windowFeaturesString, |
156 | 157 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow); |
157 typedef void (*PrepareDialogFunction)(LocalDOMWindow*, void* context); | 158 |
158 void showModalDialog(const String& urlString, const String& dialogFeatur
esString, | 159 typedef void (*PrepareDialogFunction)(LocalDOMWindow*, void* context); |
159 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, Prepar
eDialogFunction, void* functionContext); | 160 void showModalDialog(const String& urlString, const String& dialogFeaturesSt
ring, |
160 | 161 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, PrepareDia
logFunction, void* functionContext); |
161 void alert(const String& message = String()); | 162 |
162 bool confirm(const String& message); | 163 void alert(const String& message = String()); |
163 String prompt(const String& message, const String& defaultValue); | 164 bool confirm(const String& message); |
164 | 165 String prompt(const String& message, const String& defaultValue); |
165 bool find(const String&, bool caseSensitive, bool backwards, bool wrap,
bool wholeWord, bool searchInFrames, bool showDialog) const; | 166 |
166 | 167 bool find(const String&, bool caseSensitive, bool backwards, bool wrap, bool
wholeWord, bool searchInFrames, bool showDialog) const; |
167 bool offscreenBuffering() const; | 168 |
168 | 169 bool offscreenBuffering() const; |
169 int outerHeight() const; | 170 |
170 int outerWidth() const; | 171 int outerHeight() const; |
171 int innerHeight() const; | 172 int outerWidth() const; |
172 int innerWidth() const; | 173 int innerHeight() const; |
173 int screenX() const; | 174 int innerWidth() const; |
174 int screenY() const; | 175 int screenX() const; |
175 int screenLeft() const { return screenX(); } | 176 int screenY() const; |
176 int screenTop() const { return screenY(); } | 177 int screenLeft() const { return screenX(); } |
177 int scrollX() const; | 178 int screenTop() const { return screenY(); } |
178 int scrollY() const; | 179 int scrollX() const; |
179 int pageXOffset() const { return scrollX(); } | 180 int scrollY() const; |
180 int pageYOffset() const { return scrollY(); } | 181 int pageXOffset() const { return scrollX(); } |
181 | 182 int pageYOffset() const { return scrollY(); } |
182 bool closed() const; | 183 |
183 | 184 bool closed() const; |
184 unsigned length() const; | 185 |
185 | 186 unsigned length() const; |
186 const AtomicString& name() const; | 187 |
187 void setName(const AtomicString&); | 188 const AtomicString& name() const; |
188 | 189 void setName(const AtomicString&); |
189 String status() const; | 190 |
190 void setStatus(const String&); | 191 String status() const; |
191 String defaultStatus() const; | 192 void setStatus(const String&); |
192 void setDefaultStatus(const String&); | 193 String defaultStatus() const; |
193 | 194 void setDefaultStatus(const String&); |
194 // Self-referential attributes | 195 |
195 | 196 // Self-referential attributes |
196 LocalDOMWindow* self() const; | 197 |
197 LocalDOMWindow* window() const { return self(); } | 198 LocalDOMWindow* self() const; |
198 LocalDOMWindow* frames() const { return self(); } | 199 LocalDOMWindow* window() const { return self(); } |
199 | 200 LocalDOMWindow* frames() const { return self(); } |
200 LocalDOMWindow* opener() const; | 201 |
201 LocalDOMWindow* parent() const; | 202 LocalDOMWindow* opener() const; |
202 LocalDOMWindow* top() const; | 203 LocalDOMWindow* parent() const; |
203 | 204 LocalDOMWindow* top() const; |
204 // DOM Level 2 AbstractView Interface | 205 |
205 | 206 // DOM Level 2 AbstractView Interface |
206 Document* document() const; | 207 |
207 | 208 Document* document() const; |
208 // CSSOM View Module | 209 |
209 | 210 // CSSOM View Module |
210 StyleMedia& styleMedia() const; | 211 |
211 | 212 StyleMedia& styleMedia() const; |
212 // DOM Level 2 Style Interface | 213 |
213 | 214 // DOM Level 2 Style Interface |
214 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> getComputedStyle(Element*, c
onst String& pseudoElt) const; | 215 |
215 | 216 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> getComputedStyle(Element*, const
String& pseudoElt) const; |
216 // WebKit extensions | 217 |
217 | 218 // WebKit extensions |
218 PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const S
tring& pseudoElt) const; | 219 |
219 double devicePixelRatio() const; | 220 PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const Strin
g& pseudoElt) const; |
220 | 221 double devicePixelRatio() const; |
221 Console& console() const; | 222 |
222 FrameConsole* frameConsole() const; | 223 Console& console() const; |
223 | 224 FrameConsole* frameConsole() const; |
224 void printErrorMessage(const String&); | 225 |
225 String crossDomainAccessErrorMessage(LocalDOMWindow* callingWindow); | 226 void printErrorMessage(const String&); |
226 String sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* callingWin
dow); | 227 String crossDomainAccessErrorMessage(LocalDOMWindow* callingWindow); |
227 | 228 String sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* callingWindow)
; |
228 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, const String& targetOrigin, LocalDOMWindow* source, ExceptionState&
); | 229 |
229 void postMessageTimerFired(PostMessageTimer*); | 230 void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePor
tArray*, const String& targetOrigin, LocalDOMWindow* source, ExceptionState&); |
230 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetO
rigin, PassRefPtrWillBeRawPtr<Event>, PassRefPtrWillBeRawPtr<ScriptCallStack>); | 231 void postMessageTimerFired(PostMessageTimer*); |
231 | 232 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigi
n, PassRefPtrWillBeRawPtr<Event>, PassRefPtrWillBeRawPtr<ScriptCallStack>); |
232 void scrollBy(int x, int y, ScrollBehavior = ScrollBehaviorAuto) const; | 233 |
233 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 234 void scrollBy(int x, int y, ScrollBehavior = ScrollBehaviorAuto) const; |
234 void scrollTo(int x, int y, ScrollBehavior = ScrollBehaviorAuto) const; | 235 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionState&
) const; |
235 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 236 void scrollTo(int x, int y, ScrollBehavior = ScrollBehaviorAuto) const; |
236 void scroll(int x, int y) const { scrollTo(x, y); } | 237 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionState&
) const; |
237 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionStat
e& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } | 238 void scroll(int x, int y) const { scrollTo(x, y); } |
238 | 239 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionState& e
xceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } |
239 void moveBy(float x, float y) const; | 240 |
240 void moveTo(float x, float y) const; | 241 void moveBy(float x, float y) const; |
241 | 242 void moveTo(float x, float y) const; |
242 void resizeBy(float x, float y) const; | 243 |
243 void resizeTo(float width, float height) const; | 244 void resizeBy(float x, float y) const; |
244 | 245 void resizeTo(float width, float height) const; |
245 // WebKit animation extensions | 246 |
246 int requestAnimationFrame(PassOwnPtrWillBeRawPtr<RequestAnimationFrameCa
llback>); | 247 // WebKit animation extensions |
247 int webkitRequestAnimationFrame(PassOwnPtrWillBeRawPtr<RequestAnimationF
rameCallback>); | 248 int requestAnimationFrame(PassOwnPtrWillBeRawPtr<RequestAnimationFrameCallba
ck>); |
248 void cancelAnimationFrame(int id); | 249 int webkitRequestAnimationFrame(PassOwnPtrWillBeRawPtr<RequestAnimationFrame
Callback>); |
249 | 250 void cancelAnimationFrame(int id); |
250 DOMWindowCSS& css() const; | 251 |
251 | 252 DOMWindowCSS& css() const; |
252 // Events | 253 |
253 // EventTarget API | 254 // Events |
254 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener>, bool useCapture = false) OVERRIDE; | 255 // EventTarget API |
255 virtual bool removeEventListener(const AtomicString& eventType, PassRefP
tr<EventListener>, bool useCapture = false) OVERRIDE; | 256 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; |
256 virtual void removeAllEventListeners() OVERRIDE; | 257 virtual bool removeEventListener(const AtomicString& eventType, PassRefPtr<E
ventListener>, bool useCapture = false) OVERRIDE; |
257 | 258 virtual void removeAllEventListeners() OVERRIDE; |
258 using EventTarget::dispatchEvent; | 259 |
259 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event> prpEvent, PassRefPtrWil
lBeRawPtr<EventTarget> prpTarget); | 260 using EventTarget::dispatchEvent; |
260 | 261 bool dispatchEvent(PassRefPtrWillBeRawPtr<Event> prpEvent, PassRefPtrWillBeR
awPtr<EventTarget> prpTarget); |
261 void dispatchLoadEvent(); | 262 |
262 | 263 void dispatchLoadEvent(); |
263 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); | 264 |
264 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); | 265 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationend); |
265 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); | 266 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationiteration); |
266 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); | 267 DEFINE_ATTRIBUTE_EVENT_LISTENER(animationstart); |
267 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend); | 268 DEFINE_ATTRIBUTE_EVENT_LISTENER(search); |
268 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel); | 269 DEFINE_ATTRIBUTE_EVENT_LISTENER(transitionend); |
269 | 270 DEFINE_ATTRIBUTE_EVENT_LISTENER(wheel); |
270 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnima
tionStart); | 271 |
271 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitA
nimationIteration); | 272 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimation
Start); |
272 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimati
onEnd); | 273 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnima
tionIteration); |
273 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransi
tionEnd); | 274 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEn
d); |
274 | 275 DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransition
End); |
275 void captureEvents() { } | 276 |
276 void releaseEvents() { } | 277 void captureEvents() { } |
277 | 278 void releaseEvents() { } |
278 void finishedLoading(); | 279 |
279 | 280 void finishedLoading(); |
280 // HTML 5 key/value storage | 281 |
281 Storage* sessionStorage(ExceptionState&) const; | 282 // HTML 5 key/value storage |
282 Storage* localStorage(ExceptionState&) const; | 283 Storage* sessionStorage(ExceptionState&) const; |
283 Storage* optionalSessionStorage() const { return m_sessionStorage.get();
} | 284 Storage* localStorage(ExceptionState&) const; |
284 Storage* optionalLocalStorage() const { return m_localStorage.get(); } | 285 Storage* optionalSessionStorage() const { return m_sessionStorage.get(); } |
285 | 286 Storage* optionalLocalStorage() const { return m_localStorage.get(); } |
286 ApplicationCache* applicationCache() const; | 287 |
287 ApplicationCache* optionalApplicationCache() const { return m_applicatio
nCache.get(); } | 288 ApplicationCache* applicationCache() const; |
288 | 289 ApplicationCache* optionalApplicationCache() const { return m_applicationCac
he.get(); } |
289 // This is the interface orientation in degrees. Some examples are: | 290 |
290 // 0 is straight up; -90 is when the device is rotated 90 clockwise; | 291 // This is the interface orientation in degrees. Some examples are: |
291 // 90 is when rotated counter clockwise. | 292 // 0 is straight up; -90 is when the device is rotated 90 clockwise; |
292 int orientation() const; | 293 // 90 is when rotated counter clockwise. |
293 | 294 int orientation() const; |
294 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 295 |
295 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); | 296 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
296 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); | 297 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); |
297 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); | 298 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); |
298 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); | 299 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); |
299 | 300 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); |
300 Performance& performance() const; | 301 |
301 | 302 Performance& performance() const; |
302 // FIXME: When this LocalDOMWindow is no longer the active LocalDOMWindo
w (i.e., | 303 |
303 // when its document is no longer the document that is displayed in its | 304 // FIXME: When this LocalDOMWindow is no longer the active LocalDOMWindow (i
.e., |
304 // frame), we would like to zero out m_frame to avoid being confused | 305 // when its document is no longer the document that is displayed in its |
305 // by the document that is currently active in m_frame. | 306 // frame), we would like to zero out m_frame to avoid being confused |
306 bool isCurrentlyDisplayedInFrame() const; | 307 // by the document that is currently active in m_frame. |
307 | 308 bool isCurrentlyDisplayedInFrame() const; |
308 void willDetachDocumentFromFrame(); | 309 |
309 LocalDOMWindow* anonymousIndexedGetter(uint32_t); | 310 void willDetachDocumentFromFrame(); |
310 | 311 LocalDOMWindow* anonymousIndexedGetter(uint32_t); |
311 bool isInsecureScriptAccess(LocalDOMWindow& callingWindow, const String&
urlString); | 312 |
312 | 313 bool isInsecureScriptAccess(LocalDOMWindow& callingWindow, const String& url
String); |
313 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > createLifecycleNotifier()
; | 314 |
314 | 315 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > createLifecycleNotifier(); |
315 EventQueue* eventQueue() const; | 316 |
316 void enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event>); | 317 EventQueue* eventQueue() const; |
317 void enqueueDocumentEvent(PassRefPtrWillBeRawPtr<Event>); | 318 void enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event>); |
318 void enqueuePageshowEvent(PageshowEventPersistence); | 319 void enqueueDocumentEvent(PassRefPtrWillBeRawPtr<Event>); |
319 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); | 320 void enqueuePageshowEvent(PageshowEventPersistence); |
320 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); | 321 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); |
321 void dispatchWindowLoadEvent(); | 322 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); |
322 void documentWasClosed(); | 323 void dispatchWindowLoadEvent(); |
323 void statePopped(PassRefPtr<SerializedScriptValue>); | 324 void documentWasClosed(); |
324 | 325 void statePopped(PassRefPtr<SerializedScriptValue>); |
325 // FIXME: This shouldn't be public once LocalDOMWindow becomes Execution
Context. | 326 |
326 void clearEventQueue(); | 327 // FIXME: This shouldn't be public once LocalDOMWindow becomes ExecutionCont
ext. |
327 | 328 void clearEventQueue(); |
328 void acceptLanguagesChanged(); | 329 |
329 | 330 void acceptLanguagesChanged(); |
330 virtual void trace(Visitor*) OVERRIDE; | 331 |
331 | 332 virtual void trace(Visitor*) OVERRIDE; |
332 protected: | 333 |
333 DOMWindowLifecycleNotifier& lifecycleNotifier(); | 334 protected: |
334 | 335 DOMWindowLifecycleNotifier& lifecycleNotifier(); |
335 private: | 336 |
336 explicit LocalDOMWindow(LocalFrame&); | 337 private: |
337 | 338 explicit LocalDOMWindow(LocalFrame&); |
338 Page* page(); | 339 |
339 | 340 Page* page(); |
340 virtual void frameDestroyed() OVERRIDE; | 341 |
341 virtual void willDetachFrameHost() OVERRIDE; | 342 virtual void frameDestroyed() OVERRIDE; |
342 | 343 virtual void willDetachFrameHost() OVERRIDE; |
343 void clearDocument(); | 344 |
344 void resetDOMWindowProperties(); | 345 void clearDocument(); |
345 void willDestroyDocumentInFrame(); | 346 void resetDOMWindowProperties(); |
346 | 347 void willDestroyDocumentInFrame(); |
347 // FIXME: Oilpan: the need for this internal method will fall | 348 |
348 // away when EventTargets are no longer using refcounts and | 349 // FIXME: Oilpan: the need for this internal method will fall |
349 // window properties are also on the heap. Inline the minimal | 350 // away when EventTargets are no longer using refcounts and |
350 // do-not-broadcast handling then and remove the enum + | 351 // window properties are also on the heap. Inline the minimal |
351 // removeAllEventListenersInternal(). | 352 // do-not-broadcast handling then and remove the enum + |
352 enum BroadcastListenerRemoval { | 353 // removeAllEventListenersInternal(). |
353 DoNotBroadcastListenerRemoval, | 354 enum BroadcastListenerRemoval { |
354 DoBroadcastListenerRemoval | 355 DoNotBroadcastListenerRemoval, |
355 }; | 356 DoBroadcastListenerRemoval |
356 | 357 }; |
357 void removeAllEventListenersInternal(BroadcastListenerRemoval); | 358 |
358 | 359 void removeAllEventListenersInternal(BroadcastListenerRemoval); |
359 RefPtrWillBeMember<Document> m_document; | 360 |
360 | 361 RefPtrWillBeMember<Document> m_document; |
361 bool m_shouldPrintWhenFinishedLoading; | 362 |
| 363 bool m_shouldPrintWhenFinishedLoading; |
362 #if ENABLE(ASSERT) | 364 #if ENABLE(ASSERT) |
363 bool m_hasBeenReset; | 365 bool m_hasBeenReset; |
364 #endif | 366 #endif |
365 | 367 |
366 HashSet<DOMWindowProperty*> m_properties; | 368 HashSet<DOMWindowProperty*> m_properties; |
367 | 369 |
368 mutable RefPtrWillBeMember<Screen> m_screen; | 370 mutable RefPtrWillBeMember<Screen> m_screen; |
369 mutable RefPtrWillBeMember<History> m_history; | 371 mutable RefPtrWillBeMember<History> m_history; |
370 mutable RefPtrWillBeMember<BarProp> m_locationbar; | 372 mutable RefPtrWillBeMember<BarProp> m_locationbar; |
371 mutable RefPtrWillBeMember<BarProp> m_menubar; | 373 mutable RefPtrWillBeMember<BarProp> m_menubar; |
372 mutable RefPtrWillBeMember<BarProp> m_personalbar; | 374 mutable RefPtrWillBeMember<BarProp> m_personalbar; |
373 mutable RefPtrWillBeMember<BarProp> m_scrollbars; | 375 mutable RefPtrWillBeMember<BarProp> m_scrollbars; |
374 mutable RefPtrWillBeMember<BarProp> m_statusbar; | 376 mutable RefPtrWillBeMember<BarProp> m_statusbar; |
375 mutable RefPtrWillBeMember<BarProp> m_toolbar; | 377 mutable RefPtrWillBeMember<BarProp> m_toolbar; |
376 mutable RefPtrWillBeMember<Console> m_console; | 378 mutable RefPtrWillBeMember<Console> m_console; |
377 mutable RefPtrWillBeMember<Navigator> m_navigator; | 379 mutable RefPtrWillBeMember<Navigator> m_navigator; |
378 mutable RefPtrWillBeMember<Location> m_location; | 380 mutable RefPtrWillBeMember<Location> m_location; |
379 mutable RefPtrWillBeMember<StyleMedia> m_media; | 381 mutable RefPtrWillBeMember<StyleMedia> m_media; |
380 | 382 |
381 String m_status; | 383 String m_status; |
382 String m_defaultStatus; | 384 String m_defaultStatus; |
383 | 385 |
384 mutable RefPtrWillBeMember<Storage> m_sessionStorage; | 386 mutable RefPtrWillBeMember<Storage> m_sessionStorage; |
385 mutable RefPtrWillBeMember<Storage> m_localStorage; | 387 mutable RefPtrWillBeMember<Storage> m_localStorage; |
386 mutable RefPtrWillBeMember<ApplicationCache> m_applicationCache; | 388 mutable RefPtrWillBeMember<ApplicationCache> m_applicationCache; |
387 | 389 |
388 mutable RefPtrWillBeMember<Performance> m_performance; | 390 mutable RefPtrWillBeMember<Performance> m_performance; |
389 | 391 |
390 mutable RefPtrWillBeMember<DOMWindowCSS> m_css; | 392 mutable RefPtrWillBeMember<DOMWindowCSS> m_css; |
391 | 393 |
392 RefPtrWillBeMember<DOMWindowEventQueue> m_eventQueue; | 394 RefPtrWillBeMember<DOMWindowEventQueue> m_eventQueue; |
393 RefPtr<SerializedScriptValue> m_pendingStateObject; | 395 RefPtr<SerializedScriptValue> m_pendingStateObject; |
394 | 396 |
395 HashSet<OwnPtr<PostMessageTimer> > m_postMessageTimers; | 397 HashSet<OwnPtr<PostMessageTimer> > m_postMessageTimers; |
396 }; | 398 }; |
397 | 399 |
398 inline String LocalDOMWindow::status() const | 400 inline String LocalDOMWindow::status() const |
399 { | 401 { |
400 return m_status; | 402 return m_status; |
401 } | 403 } |
402 | 404 |
403 inline String LocalDOMWindow::defaultStatus() const | 405 inline String LocalDOMWindow::defaultStatus() const |
404 { | 406 { |
405 return m_defaultStatus; | 407 return m_defaultStatus; |
406 } | 408 } |
407 | 409 |
408 } // namespace blink | 410 } // namespace blink |
409 | 411 |
410 #endif // DOMWindow_h | 412 #endif // LocalDOMWindow_h |
OLD | NEW |