| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 PageshowEventNotPersisted = 0, | 87 PageshowEventNotPersisted = 0, |
| 88 PageshowEventPersisted = 1 | 88 PageshowEventPersisted = 1 |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack
ForwardList }; | 91 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBack
ForwardList }; |
| 92 | 92 |
| 93 class DOMWindow FINAL : public RefCounted<DOMWindow>, public ScriptWrappable
, public EventTargetWithInlineData, public FrameDestructionObserver, public Supp
lementable<DOMWindow>, public LifecycleContext<DOMWindow> { | 93 class DOMWindow FINAL : public RefCounted<DOMWindow>, public ScriptWrappable
, public EventTargetWithInlineData, public FrameDestructionObserver, public Supp
lementable<DOMWindow>, public LifecycleContext<DOMWindow> { |
| 94 REFCOUNTED_EVENT_TARGET(DOMWindow); | 94 REFCOUNTED_EVENT_TARGET(DOMWindow); |
| 95 public: | 95 public: |
| 96 static PassRefPtr<Document> createDocument(const String& mimeType, const
DocumentInit&, bool forceXHTML); | 96 static PassRefPtr<Document> createDocument(const String& mimeType, const
DocumentInit&, bool forceXHTML); |
| 97 static PassRefPtr<DOMWindow> create(LocalFrame* frame) { return adoptRef
(new DOMWindow(frame)); } | 97 static PassRefPtr<DOMWindow> create(LocalFrame& frame) { return adoptRef
(new DOMWindow(frame)); } |
| 98 virtual ~DOMWindow(); | 98 virtual ~DOMWindow(); |
| 99 | 99 |
| 100 PassRefPtr<Document> installNewDocument(const String& mimeType, const Do
cumentInit&, bool forceXHTML = false); | 100 PassRefPtr<Document> installNewDocument(const String& mimeType, const Do
cumentInit&, bool forceXHTML = false); |
| 101 | 101 |
| 102 virtual const AtomicString& interfaceName() const OVERRIDE; | 102 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 103 virtual ExecutionContext* executionContext() const OVERRIDE; | 103 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 104 | 104 |
| 105 virtual DOMWindow* toDOMWindow() OVERRIDE; | 105 virtual DOMWindow* toDOMWindow() OVERRIDE; |
| 106 | 106 |
| 107 void registerProperty(DOMWindowProperty*); | 107 void registerProperty(DOMWindowProperty*); |
| 108 void unregisterProperty(DOMWindowProperty*); | 108 void unregisterProperty(DOMWindowProperty*); |
| 109 | 109 |
| 110 void reset(); | 110 void reset(); |
| 111 | 111 |
| 112 PassRefPtr<MediaQueryList> matchMedia(const String&); | 112 PassRefPtr<MediaQueryList> matchMedia(const String&); |
| 113 | 113 |
| 114 unsigned pendingUnloadEventListeners() const; | 114 unsigned pendingUnloadEventListeners() const; |
| 115 | 115 |
| 116 static FloatRect adjustWindowRect(LocalFrame*, const FloatRect& pendingC
hanges); | 116 static FloatRect adjustWindowRect(LocalFrame&, const FloatRect& pendingC
hanges); |
| 117 | 117 |
| 118 bool allowPopUp(); // Call on first window, not target window. | 118 bool allowPopUp(); // Call on first window, not target window. |
| 119 static bool allowPopUp(LocalFrame* firstFrame); | 119 static bool allowPopUp(LocalFrame& firstFrame); |
| 120 | 120 |
| 121 // DOM Level 0 | 121 // DOM Level 0 |
| 122 | 122 |
| 123 Screen* screen() const; | 123 Screen& screen() const; |
| 124 History* history() const; | 124 History& history() const; |
| 125 BarProp* locationbar() const; | 125 BarProp& locationbar() const; |
| 126 BarProp* menubar() const; | 126 BarProp& menubar() const; |
| 127 BarProp* personalbar() const; | 127 BarProp& personalbar() const; |
| 128 BarProp* scrollbars() const; | 128 BarProp& scrollbars() const; |
| 129 BarProp* statusbar() const; | 129 BarProp& statusbar() const; |
| 130 BarProp* toolbar() const; | 130 BarProp& toolbar() const; |
| 131 Navigator* navigator() const; | 131 Navigator& navigator() const; |
| 132 Navigator* clientInformation() const { return navigator(); } | 132 Navigator& clientInformation() const { return navigator(); } |
| 133 | 133 |
| 134 Location* location() const; | 134 Location& location() const; |
| 135 void setLocation(const String& location, DOMWindow* callingWindow, DOMWi
ndow* enteredWindow, | 135 void setLocation(const String& location, DOMWindow* callingWindow, DOMWi
ndow* enteredWindow, |
| 136 SetLocationLocking = LockHistoryBasedOnGestureState); | 136 SetLocationLocking = LockHistoryBasedOnGestureState); |
| 137 | 137 |
| 138 DOMSelection* getSelection(); | 138 DOMSelection* getSelection(); |
| 139 | 139 |
| 140 Element* frameElement() const; | 140 Element* frameElement() const; |
| 141 | 141 |
| 142 void focus(ExecutionContext* = 0); | 142 void focus(ExecutionContext* = 0); |
| 143 void blur(); | 143 void blur(); |
| 144 void close(ExecutionContext* = 0); | 144 void close(ExecutionContext* = 0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 DOMWindow* opener() const; | 190 DOMWindow* opener() const; |
| 191 DOMWindow* parent() const; | 191 DOMWindow* parent() const; |
| 192 DOMWindow* top() const; | 192 DOMWindow* top() const; |
| 193 | 193 |
| 194 // DOM Level 2 AbstractView Interface | 194 // DOM Level 2 AbstractView Interface |
| 195 | 195 |
| 196 Document* document() const; | 196 Document* document() const; |
| 197 | 197 |
| 198 // CSSOM View Module | 198 // CSSOM View Module |
| 199 | 199 |
| 200 PassRefPtr<StyleMedia> styleMedia() const; | 200 StyleMedia& styleMedia() const; |
| 201 | 201 |
| 202 // DOM Level 2 Style Interface | 202 // DOM Level 2 Style Interface |
| 203 | 203 |
| 204 PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String&
pseudoElt) const; | 204 PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String&
pseudoElt) const; |
| 205 | 205 |
| 206 // WebKit extensions | 206 // WebKit extensions |
| 207 | 207 |
| 208 PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseud
oElt) const; | 208 PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseud
oElt) const; |
| 209 double devicePixelRatio() const; | 209 double devicePixelRatio() const; |
| 210 | 210 |
| 211 PassRefPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*, const DOMPo
int*) const; | 211 PassRefPtr<DOMPoint> webkitConvertPointFromPageToNode(Node*, const DOMPo
int*) const; |
| 212 PassRefPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*, const DOMPo
int*) const; | 212 PassRefPtr<DOMPoint> webkitConvertPointFromNodeToPage(Node*, const DOMPo
int*) const; |
| 213 | 213 |
| 214 Console* console() const; | 214 Console& console() const; |
| 215 PageConsole* pageConsole() const; | 215 PageConsole* pageConsole() const; |
| 216 | 216 |
| 217 void printErrorMessage(const String&); | 217 void printErrorMessage(const String&); |
| 218 String crossDomainAccessErrorMessage(DOMWindow* callingWindow); | 218 String crossDomainAccessErrorMessage(DOMWindow* callingWindow); |
| 219 String sanitizedCrossDomainAccessErrorMessage(DOMWindow* callingWindow); | 219 String sanitizedCrossDomainAccessErrorMessage(DOMWindow* callingWindow); |
| 220 | 220 |
| 221 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionState&); | 221 void postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionState&); |
| 222 void postMessageTimerFired(PassOwnPtr<PostMessageTimer>); | 222 void postMessageTimerFired(PassOwnPtr<PostMessageTimer>); |
| 223 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetO
rigin, PassRefPtr<Event>, PassRefPtr<ScriptCallStack>); | 223 void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetO
rigin, PassRefPtr<Event>, PassRefPtr<ScriptCallStack>); |
| 224 | 224 |
| 225 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 225 void scrollBy(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; |
| 226 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; | 226 void scrollTo(int x, int y, const Dictionary& scrollOptions, ExceptionSt
ate&) const; |
| 227 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionStat
e& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } | 227 void scroll(int x, int y, const Dictionary& scrollOptions, ExceptionStat
e& exceptionState) const { scrollTo(x, y, scrollOptions, exceptionState); } |
| 228 | 228 |
| 229 void moveBy(float x, float y) const; | 229 void moveBy(float x, float y) const; |
| 230 void moveTo(float x, float y) const; | 230 void moveTo(float x, float y) const; |
| 231 | 231 |
| 232 void resizeBy(float x, float y) const; | 232 void resizeBy(float x, float y) const; |
| 233 void resizeTo(float width, float height) const; | 233 void resizeTo(float width, float height) const; |
| 234 | 234 |
| 235 // WebKit animation extensions | 235 // WebKit animation extensions |
| 236 int requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback>); | 236 int requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback>); |
| 237 int webkitRequestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback
>); | 237 int webkitRequestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback
>); |
| 238 void cancelAnimationFrame(int id); | 238 void cancelAnimationFrame(int id); |
| 239 | 239 |
| 240 DOMWindowCSS* css(); | 240 DOMWindowCSS& css() const; |
| 241 | 241 |
| 242 // Events | 242 // Events |
| 243 // EventTarget API | 243 // EventTarget API |
| 244 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener>, bool useCapture) OVERRIDE; | 244 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener>, bool useCapture) OVERRIDE; |
| 245 virtual bool removeEventListener(const AtomicString& eventType, EventLis
tener*, bool useCapture) OVERRIDE; | 245 virtual bool removeEventListener(const AtomicString& eventType, EventLis
tener*, bool useCapture) OVERRIDE; |
| 246 virtual void removeAllEventListeners() OVERRIDE; | 246 virtual void removeAllEventListeners() OVERRIDE; |
| 247 | 247 |
| 248 using EventTarget::dispatchEvent; | 248 using EventTarget::dispatchEvent; |
| 249 bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> p
rpTarget); | 249 bool dispatchEvent(PassRefPtr<Event> prpEvent, PassRefPtr<EventTarget> p
rpTarget); |
| 250 | 250 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // 0 is straight up; -90 is when the device is rotated 90 clockwise; | 283 // 0 is straight up; -90 is when the device is rotated 90 clockwise; |
| 284 // 90 is when rotated counter clockwise. | 284 // 90 is when rotated counter clockwise. |
| 285 int orientation() const; | 285 int orientation() const; |
| 286 | 286 |
| 287 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 287 DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
| 288 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); | 288 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart); |
| 289 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); | 289 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove); |
| 290 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); | 290 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend); |
| 291 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); | 291 DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel); |
| 292 | 292 |
| 293 Performance* performance() const; | 293 Performance& performance() const; |
| 294 | 294 |
| 295 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., | 295 // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e., |
| 296 // when its document is no longer the document that is displayed in its | 296 // when its document is no longer the document that is displayed in its |
| 297 // frame), we would like to zero out m_frame to avoid being confused | 297 // frame), we would like to zero out m_frame to avoid being confused |
| 298 // by the document that is currently active in m_frame. | 298 // by the document that is currently active in m_frame. |
| 299 bool isCurrentlyDisplayedInFrame() const; | 299 bool isCurrentlyDisplayedInFrame() const; |
| 300 | 300 |
| 301 void willDetachDocumentFromFrame(); | 301 void willDetachDocumentFromFrame(); |
| 302 DOMWindow* anonymousIndexedGetter(uint32_t); | 302 DOMWindow* anonymousIndexedGetter(uint32_t); |
| 303 | 303 |
| 304 bool isInsecureScriptAccess(DOMWindow* callingWindow, const String& urlS
tring); | 304 bool isInsecureScriptAccess(DOMWindow& callingWindow, const String& urlS
tring); |
| 305 | 305 |
| 306 PassOwnPtr<LifecycleNotifier<DOMWindow> > createLifecycleNotifier(); | 306 PassOwnPtr<LifecycleNotifier<DOMWindow> > createLifecycleNotifier(); |
| 307 | 307 |
| 308 EventQueue* eventQueue() const; | 308 EventQueue* eventQueue() const; |
| 309 void enqueueWindowEvent(PassRefPtr<Event>); | 309 void enqueueWindowEvent(PassRefPtr<Event>); |
| 310 void enqueueDocumentEvent(PassRefPtr<Event>); | 310 void enqueueDocumentEvent(PassRefPtr<Event>); |
| 311 void enqueuePageshowEvent(PageshowEventPersistence); | 311 void enqueuePageshowEvent(PageshowEventPersistence); |
| 312 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); | 312 void enqueueHashchangeEvent(const String& oldURL, const String& newURL); |
| 313 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); | 313 void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue>); |
| 314 void dispatchWindowLoadEvent(); | 314 void dispatchWindowLoadEvent(); |
| 315 void documentWasClosed(); | 315 void documentWasClosed(); |
| 316 void statePopped(PassRefPtr<SerializedScriptValue>); | 316 void statePopped(PassRefPtr<SerializedScriptValue>); |
| 317 | 317 |
| 318 // FIXME: This shouldn't be public once DOMWindow becomes ExecutionConte
xt. | 318 // FIXME: This shouldn't be public once DOMWindow becomes ExecutionConte
xt. |
| 319 void clearEventQueue(); | 319 void clearEventQueue(); |
| 320 | 320 |
| 321 protected: | 321 protected: |
| 322 DOMWindowLifecycleNotifier& lifecycleNotifier(); | 322 DOMWindowLifecycleNotifier& lifecycleNotifier(); |
| 323 | 323 |
| 324 private: | 324 private: |
| 325 explicit DOMWindow(LocalFrame*); | 325 explicit DOMWindow(LocalFrame&); |
| 326 | 326 |
| 327 Page* page(); | 327 Page* page(); |
| 328 | 328 |
| 329 virtual void frameDestroyed() OVERRIDE; | 329 virtual void frameDestroyed() OVERRIDE; |
| 330 virtual void willDetachFrameHost() OVERRIDE; | 330 virtual void willDetachFrameHost() OVERRIDE; |
| 331 | 331 |
| 332 void clearDocument(); | 332 void clearDocument(); |
| 333 void resetDOMWindowProperties(); | 333 void resetDOMWindowProperties(); |
| 334 void willDestroyDocumentInFrame(); | 334 void willDestroyDocumentInFrame(); |
| 335 | 335 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 | 374 |
| 375 inline String DOMWindow::defaultStatus() const | 375 inline String DOMWindow::defaultStatus() const |
| 376 { | 376 { |
| 377 return m_defaultStatus; | 377 return m_defaultStatus; |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace WebCore | 380 } // namespace WebCore |
| 381 | 381 |
| 382 #endif // DOMWindow_h | 382 #endif // DOMWindow_h |
| OLD | NEW |