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 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; | 86 typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray; |
87 | 87 |
88 enum PageshowEventPersistence { | 88 enum PageshowEventPersistence { |
89 PageshowEventNotPersisted = 0, | 89 PageshowEventNotPersisted = 0, |
90 PageshowEventPersisted = 1 | 90 PageshowEventPersisted = 1 |
91 }; | 91 }; |
92 | 92 |
93 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack
ForwardList }; | 93 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack
ForwardList }; |
94 | 94 |
95 class DOMWindow FINAL : public RefCountedWillBeRefCountedGarbageCollected<DO
MWindow>, public ScriptWrappable, public EventTargetWithInlineData, public DOMWi
ndowBase64, public FrameDestructionObserver, public WillBeHeapSupplementable<DOM
Window>, public LifecycleContext<DOMWindow> { | 95 class LocalDOMWindow FINAL : public RefCountedWillBeRefCountedGarbageCollect
ed<LocalDOMWindow>, public ScriptWrappable, public EventTargetWithInlineData, pu
blic DOMWindowBase64, public FrameDestructionObserver, public WillBeHeapSuppleme
ntable<LocalDOMWindow>, public LifecycleContext<LocalDOMWindow> { |
96 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DOMWindow); | 96 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(LocalDOMWindow); |
97 REFCOUNTED_EVENT_TARGET(DOMWindow); | 97 REFCOUNTED_EVENT_TARGET(LocalDOMWindow); |
98 public: | 98 public: |
99 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mim
eType, const DocumentInit&, bool forceXHTML); | 99 static PassRefPtrWillBeRawPtr<Document> createDocument(const String& mim
eType, const DocumentInit&, bool forceXHTML); |
100 static PassRefPtrWillBeRawPtr<DOMWindow> create(LocalFrame& frame) | 100 static PassRefPtrWillBeRawPtr<LocalDOMWindow> create(LocalFrame& frame) |
101 { | 101 { |
102 return adoptRefWillBeRefCountedGarbageCollected(new DOMWindow(frame)
); | 102 return adoptRefWillBeRefCountedGarbageCollected(new LocalDOMWindow(f
rame)); |
103 } | 103 } |
104 virtual ~DOMWindow(); | 104 virtual ~LocalDOMWindow(); |
105 | 105 |
106 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeTy
pe, const DocumentInit&, bool forceXHTML = false); | 106 PassRefPtrWillBeRawPtr<Document> installNewDocument(const String& mimeTy
pe, const DocumentInit&, bool forceXHTML = false); |
107 | 107 |
108 virtual const AtomicString& interfaceName() const OVERRIDE; | 108 virtual const AtomicString& interfaceName() const OVERRIDE; |
109 virtual ExecutionContext* executionContext() const OVERRIDE; | 109 virtual ExecutionContext* executionContext() const OVERRIDE; |
110 | 110 |
111 virtual DOMWindow* toDOMWindow() OVERRIDE; | 111 virtual LocalDOMWindow* toDOMWindow() OVERRIDE; |
112 | 112 |
113 void registerProperty(DOMWindowProperty*); | 113 void registerProperty(DOMWindowProperty*); |
114 void unregisterProperty(DOMWindowProperty*); | 114 void unregisterProperty(DOMWindowProperty*); |
115 | 115 |
116 void reset(); | 116 void reset(); |
117 | 117 |
118 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); | 118 PassRefPtrWillBeRawPtr<MediaQueryList> matchMedia(const String&); |
119 | 119 |
120 unsigned pendingUnloadEventListeners() const; | 120 unsigned pendingUnloadEventListeners() const; |
121 | 121 |
(...skipping 10 matching lines...) Expand all Loading... |
132 BarProp& locationbar() const; | 132 BarProp& locationbar() const; |
133 BarProp& menubar() const; | 133 BarProp& menubar() const; |
134 BarProp& personalbar() const; | 134 BarProp& personalbar() const; |
135 BarProp& scrollbars() const; | 135 BarProp& scrollbars() const; |
136 BarProp& statusbar() const; | 136 BarProp& statusbar() const; |
137 BarProp& toolbar() const; | 137 BarProp& toolbar() const; |
138 Navigator& navigator() const; | 138 Navigator& navigator() const; |
139 Navigator& clientInformation() const { return navigator(); } | 139 Navigator& clientInformation() const { return navigator(); } |
140 | 140 |
141 Location& location() const; | 141 Location& location() const; |
142 void setLocation(const String& location, DOMWindow* callingWindow, DOMWi
ndow* enteredWindow, | 142 void setLocation(const String& location, LocalDOMWindow* callingWindow,
LocalDOMWindow* enteredWindow, |
143 SetLocationLocking = LockHistoryBasedOnGestureState); | 143 SetLocationLocking = LockHistoryBasedOnGestureState); |
144 | 144 |
145 DOMSelection* getSelection(); | 145 DOMSelection* getSelection(); |
146 | 146 |
147 Element* frameElement() const; | 147 Element* frameElement() const; |
148 | 148 |
149 void focus(ExecutionContext* = 0); | 149 void focus(ExecutionContext* = 0); |
150 void blur(); | 150 void blur(); |
151 void close(ExecutionContext* = 0); | 151 void close(ExecutionContext* = 0); |
152 void print(); | 152 void print(); |
153 void stop(); | 153 void stop(); |
154 | 154 |
155 PassRefPtrWillBeRawPtr<DOMWindow> open(const String& urlString, const At
omicString& frameName, const String& windowFeaturesString, | 155 PassRefPtrWillBeRawPtr<LocalDOMWindow> open(const String& urlString, con
st AtomicString& frameName, const String& windowFeaturesString, |
156 DOMWindow* callingWindow, DOMWindow* enteredWindow); | 156 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow); |
157 | 157 |
158 typedef void (*PrepareDialogFunction)(DOMWindow*, void* context); | 158 typedef void (*PrepareDialogFunction)(LocalDOMWindow*, void* context); |
159 void showModalDialog(const String& urlString, const String& dialogFeatur
esString, | 159 void showModalDialog(const String& urlString, const String& dialogFeatur
esString, |
160 DOMWindow* callingWindow, DOMWindow* enteredWindow, PrepareDialogFun
ction, void* functionContext); | 160 LocalDOMWindow* callingWindow, LocalDOMWindow* enteredWindow, Prepar
eDialogFunction, void* functionContext); |
161 | 161 |
162 void alert(const String& message = String()); | 162 void alert(const String& message = String()); |
163 bool confirm(const String& message); | 163 bool confirm(const String& message); |
164 String prompt(const String& message, const String& defaultValue); | 164 String prompt(const String& message, const String& defaultValue); |
165 | 165 |
166 bool find(const String&, bool caseSensitive, bool backwards, bool wrap,
bool wholeWord, bool searchInFrames, bool showDialog) const; | 166 bool find(const String&, bool caseSensitive, bool backwards, bool wrap,
bool wholeWord, bool searchInFrames, bool showDialog) const; |
167 | 167 |
168 bool offscreenBuffering() const; | 168 bool offscreenBuffering() const; |
169 | 169 |
170 int outerHeight() const; | 170 int outerHeight() const; |
(...skipping 16 matching lines...) Expand all Loading... |
187 const AtomicString& name() const; | 187 const AtomicString& name() const; |
188 void setName(const AtomicString&); | 188 void setName(const AtomicString&); |
189 | 189 |
190 String status() const; | 190 String status() const; |
191 void setStatus(const String&); | 191 void setStatus(const String&); |
192 String defaultStatus() const; | 192 String defaultStatus() const; |
193 void setDefaultStatus(const String&); | 193 void setDefaultStatus(const String&); |
194 | 194 |
195 // Self-referential attributes | 195 // Self-referential attributes |
196 | 196 |
197 DOMWindow* self() const; | 197 LocalDOMWindow* self() const; |
198 DOMWindow* window() const { return self(); } | 198 LocalDOMWindow* window() const { return self(); } |
199 DOMWindow* frames() const { return self(); } | 199 LocalDOMWindow* frames() const { return self(); } |
200 | 200 |
201 DOMWindow* opener() const; | 201 LocalDOMWindow* opener() const; |
202 DOMWindow* parent() const; | 202 LocalDOMWindow* parent() const; |
203 DOMWindow* top() const; | 203 LocalDOMWindow* top() const; |
204 | 204 |
205 // DOM Level 2 AbstractView Interface | 205 // DOM Level 2 AbstractView Interface |
206 | 206 |
207 Document* document() const; | 207 Document* document() const; |
208 | 208 |
209 // CSSOM View Module | 209 // CSSOM View Module |
210 | 210 |
211 StyleMedia& styleMedia() const; | 211 StyleMedia& styleMedia() const; |
212 | 212 |
213 // DOM Level 2 Style Interface | 213 // DOM Level 2 Style Interface |
214 | 214 |
215 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> getComputedStyle(Element*, c
onst String& pseudoElt) const; | 215 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> getComputedStyle(Element*, c
onst String& pseudoElt) const; |
216 | 216 |
217 // WebKit extensions | 217 // WebKit extensions |
218 | 218 |
219 PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const S
tring& pseudoElt) const; | 219 PassRefPtrWillBeRawPtr<CSSRuleList> getMatchedCSSRules(Element*, const S
tring& pseudoElt) const; |
220 double devicePixelRatio() const; | 220 double devicePixelRatio() const; |
221 | 221 |
222 PassRefPtrWillBeRawPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*,
const DOMPoint*) const; | 222 PassRefPtrWillBeRawPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*,
const DOMPoint*) const; |
223 PassRefPtrWillBeRawPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*,
const DOMPoint*) const; | 223 PassRefPtrWillBeRawPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*,
const DOMPoint*) const; |
224 | 224 |
225 Console& console() const; | 225 Console& console() const; |
226 FrameConsole* frameConsole() const; | 226 FrameConsole* frameConsole() const; |
227 | 227 |
228 void printErrorMessage(const String&); | 228 void printErrorMessage(const String&); |
229 String crossDomainAccessErrorMessage(DOMWindow* callingWindow); | 229 String crossDomainAccessErrorMessage(LocalDOMWindow* callingWindow); |
230 String sanitizedCrossDomainAccessErrorMessage(DOMWindow* callingWindow); | 230 String sanitizedCrossDomainAccessErrorMessage(LocalDOMWindow* callingWin
dow); |
231 | 231 |
232 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionState&); | 232 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, const String& targetOrigin, LocalDOMWindow* source, ExceptionState&
); |
233 void postMessageTimerFired(PassOwnPtr<PostMessageTimer>); | 233 void postMessageTimerFired(PassOwnPtr<PostMessageTimer>); |
234 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetO
rigin, PassRefPtrWillBeRawPtr<Event>, PassRefPtrWillBeRawPtr<ScriptCallStack>); | 234 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetO
rigin, PassRefPtrWillBeRawPtr<Event>, PassRefPtrWillBeRawPtr<ScriptCallStack>); |
235 | 235 |
236 void scrollBy(int x, int y) const; | 236 void scrollBy(int x, int y) const; |
237 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 237 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; |
238 void scrollTo(int x, int y) const; | 238 void scrollTo(int x, int y) const; |
239 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 239 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; |
240 void scroll(int x, int y) const { scrollTo(x, y); } | 240 void scroll(int x, int y) const { scrollTo(x, y); } |
241 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionStat
e& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } | 241 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionStat
e& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } |
242 | 242 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 int orientation() const; | 296 int orientation() const; |
297 | 297 |
298 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 298 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
299 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); | 299 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); |
300 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); | 300 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); |
301 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); | 301 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); |
302 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); | 302 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); |
303 | 303 |
304 Performance& performance() const; | 304 Performance& performance() const; |
305 | 305 |
306 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., | 306 // FIXME: When this LocalDOMWindow is no longer the active LocalDOMWindo
w (i.e., |
307 // when its document is no longer the document that is displayed in its | 307 // when its document is no longer the document that is displayed in its |
308 // frame), we would like to zero out m_frame to avoid being confused | 308 // frame), we would like to zero out m_frame to avoid being confused |
309 // by the document that is currently active in m_frame. | 309 // by the document that is currently active in m_frame. |
310 bool isCurrentlyDisplayedInFrame() const; | 310 bool isCurrentlyDisplayedInFrame() const; |
311 | 311 |
312 void willDetachDocumentFromFrame(); | 312 void willDetachDocumentFromFrame(); |
313 DOMWindow* anonymousIndexedGetter(uint32_t); | 313 LocalDOMWindow* anonymousIndexedGetter(uint32_t); |
314 | 314 |
315 bool isInsecureScriptAccess(DOMWindow& callingWindow, const String& urlS
tring); | 315 bool isInsecureScriptAccess(LocalDOMWindow& callingWindow, const String&
urlString); |
316 | 316 |
317 PassOwnPtr<LifecycleNotifier<DOMWindow> > createLifecycleNotifier(); | 317 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > createLifecycleNotifier()
; |
318 | 318 |
319 EventQueue* eventQueue() const; | 319 EventQueue* eventQueue() const; |
320 void enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event>); | 320 void enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event>); |
321 void enqueueDocumentEvent(PassRefPtrWillBeRawPtr<Event>); | 321 void enqueueDocumentEvent(PassRefPtrWillBeRawPtr<Event>); |
322 void enqueuePageshowEvent(PageshowEventPersistence); | 322 void enqueuePageshowEvent(PageshowEventPersistence); |
323 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); | 323 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); |
324 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); | 324 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); |
325 void dispatchWindowLoadEvent(); | 325 void dispatchWindowLoadEvent(); |
326 void documentWasClosed(); | 326 void documentWasClosed(); |
327 void statePopped(PassRefPtr<SerializedScriptValue>); | 327 void statePopped(PassRefPtr<SerializedScriptValue>); |
328 | 328 |
329 // FIXME: This shouldn't be public once DOMWindow becomes ExecutionConte
xt. | 329 // FIXME: This shouldn't be public once LocalDOMWindow becomes Execution
Context. |
330 void clearEventQueue(); | 330 void clearEventQueue(); |
331 | 331 |
332 void acceptLanguagesChanged(); | 332 void acceptLanguagesChanged(); |
333 | 333 |
334 virtual void trace(Visitor*) OVERRIDE; | 334 virtual void trace(Visitor*) OVERRIDE; |
335 | 335 |
336 protected: | 336 protected: |
337 DOMWindowLifecycleNotifier& lifecycleNotifier(); | 337 DOMWindowLifecycleNotifier& lifecycleNotifier(); |
338 | 338 |
339 private: | 339 private: |
340 explicit DOMWindow(LocalFrame&); | 340 explicit LocalDOMWindow(LocalFrame&); |
341 | 341 |
342 Page* page(); | 342 Page* page(); |
343 | 343 |
344 virtual void frameDestroyed() OVERRIDE; | 344 virtual void frameDestroyed() OVERRIDE; |
345 virtual void willDetachFrameHost() OVERRIDE; | 345 virtual void willDetachFrameHost() OVERRIDE; |
346 | 346 |
347 void clearDocument(); | 347 void clearDocument(); |
348 void resetDOMWindowProperties(); | 348 void resetDOMWindowProperties(); |
349 void willDestroyDocumentInFrame(); | 349 void willDestroyDocumentInFrame(); |
350 | 350 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 mutable RefPtrWillBeMember<ApplicationCache> m_applicationCache; | 390 mutable RefPtrWillBeMember<ApplicationCache> m_applicationCache; |
391 | 391 |
392 mutable RefPtrWillBeMember<Performance> m_performance; | 392 mutable RefPtrWillBeMember<Performance> m_performance; |
393 | 393 |
394 mutable RefPtrWillBeMember<DOMWindowCSS> m_css; | 394 mutable RefPtrWillBeMember<DOMWindowCSS> m_css; |
395 | 395 |
396 RefPtrWillBeMember<DOMWindowEventQueue> m_eventQueue; | 396 RefPtrWillBeMember<DOMWindowEventQueue> m_eventQueue; |
397 RefPtr<SerializedScriptValue> m_pendingStateObject; | 397 RefPtr<SerializedScriptValue> m_pendingStateObject; |
398 }; | 398 }; |
399 | 399 |
400 inline String DOMWindow::status() const | 400 inline String LocalDOMWindow::status() const |
401 { | 401 { |
402 return m_status; | 402 return m_status; |
403 } | 403 } |
404 | 404 |
405 inline String DOMWindow::defaultStatus() const | 405 inline String LocalDOMWindow::defaultStatus() const |
406 { | 406 { |
407 return m_defaultStatus; | 407 return m_defaultStatus; |
408 } | 408 } |
409 | 409 |
410 } // namespace WebCore | 410 } // namespace WebCore |
411 | 411 |
412 #endif // DOMWindow_h | 412 #endif // DOMWindow_h |
OLD | NEW |